summaryrefslogtreecommitdiff
path: root/lib/libutil
diff options
context:
space:
mode:
authorJordan K. Hubbard <jkh@FreeBSD.org>1996-06-05 02:59:00 +0000
committerJordan K. Hubbard <jkh@FreeBSD.org>1996-06-05 02:59:00 +0000
commit78e55a1f29558e8be54566ead1e7be8ab9d45273 (patch)
tree65fd45fa55d0cd3888b40a4f41dd3383616dfd74 /lib/libutil
parent885f2f31b4599f4bc7468278c783c1c30f1f86ed (diff)
Notes
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/setproctitle.c27
1 files changed, 10 insertions, 17 deletions
diff --git a/lib/libutil/setproctitle.c b/lib/libutil/setproctitle.c
index b13409d4ba96..804b7eb991b8 100644
--- a/lib/libutil/setproctitle.c
+++ b/lib/libutil/setproctitle.c
@@ -11,16 +11,19 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Absolutely no warranty of function or purpose is made by the author
+ * 3. This work was done expressly for inclusion into FreeBSD. Other use
+ * is permitted provided this notation is included.
+ * 4. Absolutely no warranty of function or purpose is made by the author
* Peter Wemm.
+ * 5. Modifications may be freely made to this file providing the above
+ * conditions are met.
*
- * $Id: setproctitle.c,v 1.2 1996/02/24 14:37:29 peter Exp $
+ * $Id: setproctitle.c,v 1.1 1995/12/26 22:50:08 peter Exp $
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/exec.h>
-#include <sys/sysctl.h>
#include <vm/vm.h>
#include <vm/vm_param.h>
@@ -68,12 +71,10 @@ setproctitle(fmt, va_alist)
#endif
{
char *p;
+ int len;
static char buf[SPT_BUFSIZE];
static char *ps_argv[2];
va_list ap;
- int mib[2];
- struct ps_strings *ps_strings;
- size_t len;
#if defined(__STDC__)
va_start(ap, fmt);
@@ -103,21 +104,13 @@ setproctitle(fmt, va_alist)
va_end(ap);
- ps_strings = NULL;
- mib[0] = CTL_KERN;
- mib[1] = KERN_PS_STRINGS;
- len = sizeof(ps_strings);
- if (sysctl(mib, 2, &ps_strings, &len, NULL, 0) < 0 ||
- ps_strings == NULL)
- ps_strings = PS_STRINGS;
-
/* PS_STRINGS points to zeroed memory on a style #2 kernel */
- if (ps_strings->ps_argvstr) {
+ if (PS_STRINGS->ps_argvstr) {
/* style #3 */
ps_argv[0] = buf;
ps_argv[1] = NULL;
- ps_strings->ps_nargvstr = 1;
- ps_strings->ps_argvstr = ps_argv;
+ PS_STRINGS->ps_nargvstr = 1;
+ PS_STRINGS->ps_argvstr = ps_argv;
} else {
/* style #2 */
OLD_PS_STRINGS->old_ps_nargvstr = 1;