Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Aug 2014 19:58:49 +0000 (UTC)
From:      Warren Block <wblock@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r270670 - stable/10/sys/sys
Message-ID:  <201408261958.s7QJwn3E081168@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: wblock (doc committer)
Date: Tue Aug 26 19:58:48 2014
New Revision: 270670
URL: http://svnweb.freebsd.org/changeset/base/270670

Log:
  MFC r269743:
  
  Update the comments in exec.h with help from jilles.

Modified:
  stable/10/sys/sys/exec.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/exec.h
==============================================================================
--- stable/10/sys/sys/exec.h	Tue Aug 26 19:36:47 2014	(r270669)
+++ stable/10/sys/sys/exec.h	Tue Aug 26 19:58:48 2014	(r270670)
@@ -39,12 +39,17 @@
 #define _SYS_EXEC_H_
 
 /*
- * The following structure is found at the top of the user stack of each
- * user process. The ps program uses it to locate argv and environment
- * strings. Programs that wish ps to display other information may modify
- * it; normally ps_argvstr points to the argv vector, and ps_nargvstr
- * is the same as the program's argc. The fields ps_envstr and ps_nenvstr
- * are the equivalent for the environment.
+ * Before ps_args existed, the following structure, found at the top of
+ * the user stack of each user process, was used by ps(1) to locate
+ * environment and argv strings.  Normally ps_argvstr points to the
+ * argv vector, and ps_nargvstr is the same as the program's argc. The
+ * fields ps_envstr and ps_nenvstr are the equivalent for the environment.
+ *
+ * Programs should now use setproctitle(3) to change ps output.
+ * setproctitle() always informs the kernel with sysctl and sets the
+ * pointers in ps_strings.  The kern.proc.args sysctl first tries p_args.
+ * If p_args is NULL, it then falls back to reading ps_strings and following
+ * the pointers.
  */
 struct ps_strings {
 	char	**ps_argvstr;	/* first of 0 or more argument strings */
@@ -55,6 +60,7 @@ struct ps_strings {
 
 /*
  * Address of ps_strings structure (in user space).
+ * Prefer the kern.ps_strings or kern.proc.ps_strings sysctls to this constant.
  */
 #define	PS_STRINGS	(USRSTACK - sizeof(struct ps_strings))
 #define SPARE_USRSPACE	4096



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408261958.s7QJwn3E081168>