Print this page
3946 ::gcore
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
*** 24,33 ****
--- 24,34 ----
* Use is subject to license terms.
*
* Portions Copyright 2007 Chad Mynhier
* Copyright 2012 DEY Storage Systems, Inc. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
+ * Copyright (c) 2013 by Delphix. All rights reserved.
*/
/*
* Interfaces available from the process control library, libproc.
*
*** 125,134 ****
--- 126,136 ----
/* Flags accepted by Pgrab() */
#define PGRAB_RETAIN 0x01 /* Retain tracing flags, else clear flags */
#define PGRAB_FORCE 0x02 /* Open the process w/o O_EXCL */
#define PGRAB_RDONLY 0x04 /* Open the process or core w/ O_RDONLY */
#define PGRAB_NOSTOP 0x08 /* Open the process but do not stop it */
+ #define PGRAB_INCORE 0x10 /* Use in-core data to build symbol tables */
/* Error codes from Pcreate() */
#define C_STRANGE -1 /* Unanticipated error, errno is meaningful */
#define C_FORK 1 /* Unable to fork */
#define C_PERM 2 /* No permission (file set-id or unreadable) */
*** 186,195 ****
--- 188,246 ----
/* maximum size in bytes of a BYREF argument */
#define MAXARGL (4*1024)
/*
+ * Ops vector definition for the Pgrab_ops().
+ */
+ typedef ssize_t (*pop_pread_t)(struct ps_prochandle *, void *, size_t,
+ uintptr_t, void *);
+ typedef ssize_t (*pop_pwrite_t)(struct ps_prochandle *, const void *, size_t,
+ uintptr_t, void *);
+ typedef int (*pop_read_maps_t)(struct ps_prochandle *, prmap_t **, ssize_t *,
+ void *);
+ typedef void (*pop_read_aux_t)(struct ps_prochandle *, auxv_t **, int *,
+ void *);
+ typedef int (*pop_cred_t)(struct ps_prochandle *, prcred_t *, int,
+ void *);
+ typedef int (*pop_priv_t)(struct ps_prochandle *, prpriv_t **, void *);
+ typedef const psinfo_t *(*pop_psinfo_t)(struct ps_prochandle *, psinfo_t *,
+ void *);
+ typedef void (*pop_status_t)(struct ps_prochandle *, pstatus_t *, void *);
+ typedef prheader_t *(*pop_lstatus_t)(struct ps_prochandle *, void *);
+ typedef prheader_t *(*pop_lpsinfo_t)(struct ps_prochandle *, void *);
+ typedef void (*pop_fini_t)(struct ps_prochandle *, void *);
+ typedef char *(*pop_platform_t)(struct ps_prochandle *, char *, size_t, void *);
+ typedef int (*pop_uname_t)(struct ps_prochandle *, struct utsname *, void *);
+ typedef char *(*pop_zonename_t)(struct ps_prochandle *, char *, size_t, void *);
+ typedef char *(*pop_execname_t)(struct ps_prochandle *, char *, size_t, void *);
+ #if defined(__i386) || defined(__amd64)
+ typedef int (*pop_ldt_t)(struct ps_prochandle *, struct ssd *, int, void *);
+ #endif
+
+ typedef struct ps_ops {
+ pop_pread_t pop_pread;
+ pop_pwrite_t pop_pwrite;
+ pop_read_maps_t pop_read_maps;
+ pop_read_aux_t pop_read_aux;
+ pop_cred_t pop_cred;
+ pop_priv_t pop_priv;
+ pop_psinfo_t pop_psinfo;
+ pop_status_t pop_status;
+ pop_lstatus_t pop_lstatus;
+ pop_lpsinfo_t pop_lpsinfo;
+ pop_fini_t pop_fini;
+ pop_platform_t pop_platform;
+ pop_uname_t pop_uname;
+ pop_zonename_t pop_zonename;
+ pop_execname_t pop_execname;
+ #if defined(__i386) || defined(__amd64)
+ pop_ldt_t pop_ldt;
+ #endif
+ } ps_ops_t;
+
+ /*
* Function prototypes for routines in the process control package.
*/
extern struct ps_prochandle *Pcreate(const char *, char *const *,
int *, char *, size_t);
extern struct ps_prochandle *Pxcreate(const char *, char *const *,
*** 199,208 ****
--- 250,260 ----
extern struct ps_prochandle *Pgrab(pid_t, int, int *);
extern struct ps_prochandle *Pgrab_core(const char *, const char *, int, int *);
extern struct ps_prochandle *Pfgrab_core(int, const char *, int *);
extern struct ps_prochandle *Pgrab_file(const char *, int *);
+ extern struct ps_prochandle *Pgrab_ops(pid_t, void *, const ps_ops_t *, int);
extern const char *Pgrab_error(int);
extern int Preopen(struct ps_prochandle *);
extern void Prelease(struct ps_prochandle *, int);
extern void Pfree(struct ps_prochandle *);
*** 219,229 ****
extern int Pstate(struct ps_prochandle *);
extern const psinfo_t *Ppsinfo(struct ps_prochandle *);
extern const pstatus_t *Pstatus(struct ps_prochandle *);
extern int Pcred(struct ps_prochandle *, prcred_t *, int);
extern int Psetcred(struct ps_prochandle *, const prcred_t *);
! extern ssize_t Ppriv(struct ps_prochandle *, prpriv_t *, size_t);
extern int Psetpriv(struct ps_prochandle *, prpriv_t *);
extern void *Pprivinfo(struct ps_prochandle *);
extern int Psetzoneid(struct ps_prochandle *, zoneid_t);
extern int Pgetareg(struct ps_prochandle *, int, prgreg_t *);
extern int Pputareg(struct ps_prochandle *, int, prgreg_t);
--- 271,281 ----
extern int Pstate(struct ps_prochandle *);
extern const psinfo_t *Ppsinfo(struct ps_prochandle *);
extern const pstatus_t *Pstatus(struct ps_prochandle *);
extern int Pcred(struct ps_prochandle *, prcred_t *, int);
extern int Psetcred(struct ps_prochandle *, const prcred_t *);
! extern int Ppriv(struct ps_prochandle *, prpriv_t **);
extern int Psetpriv(struct ps_prochandle *, prpriv_t *);
extern void *Pprivinfo(struct ps_prochandle *);
extern int Psetzoneid(struct ps_prochandle *, zoneid_t);
extern int Pgetareg(struct ps_prochandle *, int, prgreg_t *);
extern int Pputareg(struct ps_prochandle *, int, prgreg_t);