Lines 39-50
Link Here
|
39 |
#define _SYS_EXEC_H_ |
39 |
#define _SYS_EXEC_H_ |
40 |
|
40 |
|
41 |
/* |
41 |
/* |
42 |
* The following structure is found at the top of the user stack of each |
42 |
* Before ps_args existed, the following structure, found at the top of |
43 |
* user process. The ps program uses it to locate argv and environment |
43 |
* the user stack of each user process, was used by ps(1) to locate |
44 |
* strings. Programs that wish ps to display other information may modify |
44 |
* environment and argv strings. Normally ps_argvstr points to the |
45 |
* it; normally ps_argvstr points to the argv vector, and ps_nargvstr |
45 |
* argv vector, and ps_nargvstr is the same as the program's argc. The |
46 |
* is the same as the program's argc. The fields ps_envstr and ps_nenvstr |
46 |
* fields ps_envstr and ps_nenvstr are the equivalent for the environment. |
47 |
* are the equivalent for the environment. |
47 |
* |
|
|
48 |
* Programs should now use setproctitle(3) to change ps output. |
49 |
* setproctitle() always informs the kernel with sysctl and sets the |
50 |
* pointers in ps_strings. The kern.proc.args sysctl first tries p_args. |
51 |
* If p_args is NULL, it then falls back to reading ps_strings and following |
52 |
* the pointers. |
48 |
*/ |
53 |
*/ |
49 |
struct ps_strings { |
54 |
struct ps_strings { |
50 |
char **ps_argvstr; /* first of 0 or more argument strings */ |
55 |
char **ps_argvstr; /* first of 0 or more argument strings */ |
Lines 55-60
Link Here
|
55 |
|
60 |
|
56 |
/* |
61 |
/* |
57 |
* Address of ps_strings structure (in user space). |
62 |
* Address of ps_strings structure (in user space). |
|
|
63 |
* Prefer the kern.ps_strings or kern.proc.ps_strings sysctls to this constant. |
58 |
*/ |
64 |
*/ |
59 |
#define PS_STRINGS (USRSTACK - sizeof(struct ps_strings)) |
65 |
#define PS_STRINGS (USRSTACK - sizeof(struct ps_strings)) |
60 |
#define SPARE_USRSPACE 4096 |
66 |
#define SPARE_USRSPACE 4096 |