summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/kern/imgact_elf.c1
-rw-r--r--sys/sys/procfs.h9
-rw-r--r--usr.bin/gcore/elfcore.c1
3 files changed, 9 insertions, 2 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 7dc785b..293a65d 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -1835,6 +1835,7 @@ __elfN(note_prpsinfo)(void *arg, struct sbuf *sb, size_t *sizep)
*cp = ' ';
}
}
+ psinfo->pr_pid = p->p_pid;
sbuf_bcat(sb, psinfo, sizeof(*psinfo));
free(psinfo, M_TEMP);
}
diff --git a/sys/sys/procfs.h b/sys/sys/procfs.h
index 6b32dfd..5f857ef 100644
--- a/sys/sys/procfs.h
+++ b/sys/sys/procfs.h
@@ -49,7 +49,10 @@ typedef struct fpreg fpregset_t;
/*
* The parenthsized numbers like (1) indicate the minimum version number
- * for which each element exists in the structure.
+ * for which each element exists in the structure. The version number is
+ * not bumped when adding new fields to the end, only if the meaning of
+ * an existing field changes. Additional fields are annotated as (1a),
+ * (1b), etc. to indicate the groupings of additions.
*/
#define PRSTATUS_VERSION 1 /* Current version of prstatus_t */
@@ -61,7 +64,7 @@ typedef struct prstatus {
size_t pr_fpregsetsz; /* sizeof(fpregset_t) (1) */
int pr_osreldate; /* Kernel version (1) */
int pr_cursig; /* Current signal (1) */
- pid_t pr_pid; /* Process ID (1) */
+ pid_t pr_pid; /* LWP (Thread) ID (1) */
gregset_t pr_reg; /* General purpose registers (1) */
} prstatus_t;
@@ -78,6 +81,7 @@ typedef struct prpsinfo {
size_t pr_psinfosz; /* sizeof(prpsinfo_t) (1) */
char pr_fname[PRFNAMESZ+1]; /* Command name, null terminated (1) */
char pr_psargs[PRARGSZ+1]; /* Arguments, null terminated (1) */
+ pid_t pr_pid; /* Process ID (1a) */
} prpsinfo_t;
typedef struct thrmisc {
@@ -104,6 +108,7 @@ typedef struct prpsinfo32 {
uint32_t pr_psinfosz;
char pr_fname[PRFNAMESZ+1];
char pr_psargs[PRARGSZ+1];
+ int32_t pr_pid;
} prpsinfo32_t;
struct thrmisc32 {
diff --git a/usr.bin/gcore/elfcore.c b/usr.bin/gcore/elfcore.c
index 3d87d29..7dcf6a1 100644
--- a/usr.bin/gcore/elfcore.c
+++ b/usr.bin/gcore/elfcore.c
@@ -580,6 +580,7 @@ elf_note_prpsinfo(void *arg, size_t *sizep)
} else
strlcpy(psinfo->pr_psargs, kip.ki_comm,
sizeof(psinfo->pr_psargs));
+ psinfo->pr_pid = pid;
*sizep = sizeof(*psinfo);
return (psinfo);
OpenPOWER on IntegriCloud