Deleted Added
full compact
setproctitle.c (90039) setproctitle.c (93399)
1/*
2 * Copyright (c) 1995 Peter Wemm <peter@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, is permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice immediately at the beginning of the file, without modification,
10 * this list of conditions, and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Absolutely no warranty of function or purpose is made by the author
15 * Peter Wemm.
16 */
17
18#include <sys/cdefs.h>
1/*
2 * Copyright (c) 1995 Peter Wemm <peter@freebsd.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, is permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice immediately at the beginning of the file, without modification,
10 * this list of conditions, and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Absolutely no warranty of function or purpose is made by the author
15 * Peter Wemm.
16 */
17
18#include <sys/cdefs.h>
19__FBSDID("$FreeBSD: head/lib/libc/gen/setproctitle.c 90039 2002-02-01 00:57:29Z obrien $");
19__FBSDID("$FreeBSD: head/lib/libc/gen/setproctitle.c 93399 2002-03-29 22:43:43Z markm $");
20
20
21#include "namespace.h"
21#include <sys/types.h>
22#include <sys/param.h>
23#include <sys/exec.h>
24#include <sys/sysctl.h>
25
26#include <vm/vm.h>
27#include <vm/vm_param.h>
28#include <vm/pmap.h>
29
30#include <stdio.h>
31#include <string.h>
32#include <stdlib.h>
33#include <unistd.h>
22#include <sys/types.h>
23#include <sys/param.h>
24#include <sys/exec.h>
25#include <sys/sysctl.h>
26
27#include <vm/vm.h>
28#include <vm/vm_param.h>
29#include <vm/pmap.h>
30
31#include <stdio.h>
32#include <string.h>
33#include <stdlib.h>
34#include <unistd.h>
35#include "un-namespace.h"
34
36
37#include "libc_private.h"
38
35/*
36 * Older FreeBSD 2.0, 2.1 and 2.2 had different ps_strings structures and
37 * in different locations.
38 * 1: old_ps_strings at the very top of the stack.
39 * 2: old_ps_strings at SPARE_USRSPACE below the top of the stack.
40 * 3: ps_strings at the very top of the stack.
41 * This attempts to support a kernel built in the #2 and #3 era.
42 */

--- 5 unchanged lines hidden (view full) ---

48 int old_ps_nenvstr;
49};
50#define OLD_PS_STRINGS ((struct old_ps_strings *) \
51 (USRSTACK - SPARE_USRSPACE - sizeof(struct old_ps_strings)))
52
53#include <stdarg.h>
54
55#define SPT_BUFSIZE 2048 /* from other parts of sendmail */
39/*
40 * Older FreeBSD 2.0, 2.1 and 2.2 had different ps_strings structures and
41 * in different locations.
42 * 1: old_ps_strings at the very top of the stack.
43 * 2: old_ps_strings at SPARE_USRSPACE below the top of the stack.
44 * 3: ps_strings at the very top of the stack.
45 * This attempts to support a kernel built in the #2 and #3 era.
46 */

--- 5 unchanged lines hidden (view full) ---

52 int old_ps_nenvstr;
53};
54#define OLD_PS_STRINGS ((struct old_ps_strings *) \
55 (USRSTACK - SPARE_USRSPACE - sizeof(struct old_ps_strings)))
56
57#include <stdarg.h>
58
59#define SPT_BUFSIZE 2048 /* from other parts of sendmail */
56extern char * __progname; /* is this defined in a .h anywhere? */
57
58void
59setproctitle(const char *fmt, ...)
60{
61 static struct ps_strings *ps_strings;
62 static char buf[SPT_BUFSIZE];
63 static char obuf[SPT_BUFSIZE];
64 static char **oargv, *kbuf;

--- 13 unchanged lines hidden (view full) ---

78 buf[sizeof(buf) - 1] = '\0';
79
80 if (fmt[0] == '-') {
81 /* skip program name prefix */
82 fmt++;
83 len = 0;
84 } else {
85 /* print program name heading for grep */
60
61void
62setproctitle(const char *fmt, ...)
63{
64 static struct ps_strings *ps_strings;
65 static char buf[SPT_BUFSIZE];
66 static char obuf[SPT_BUFSIZE];
67 static char **oargv, *kbuf;

--- 13 unchanged lines hidden (view full) ---

81 buf[sizeof(buf) - 1] = '\0';
82
83 if (fmt[0] == '-') {
84 /* skip program name prefix */
85 fmt++;
86 len = 0;
87 } else {
88 /* print program name heading for grep */
86 (void) snprintf(buf, sizeof(buf), "%s: ", __progname);
89 (void)snprintf(buf, sizeof(buf), "%s: ", _getprogname());
87 len = strlen(buf);
88 }
89
90 /* print the argument string */
91 (void) vsnprintf(buf + len, sizeof(buf) - len, fmt, ap);
92
93 nargvp = nargv;
94 nargc = 1;

--- 65 unchanged lines hidden ---
90 len = strlen(buf);
91 }
92
93 /* print the argument string */
94 (void) vsnprintf(buf + len, sizeof(buf) - len, fmt, ap);
95
96 nargvp = nargv;
97 nargc = 1;

--- 65 unchanged lines hidden ---