Deleted Added
full compact
killall.c (93432) killall.c (94689)
1/*-
2 * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
3 * Copyright (c) 2000 Paul Saab <ps@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
1/*-
2 * Copyright (c) 2000 Peter Wemm <peter@FreeBSD.org>
3 * Copyright (c) 2000 Paul Saab <ps@FreeBSD.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 *
27 * $FreeBSD: head/usr.bin/killall/killall.c 93432 2002-03-30 16:24:03Z dwmalone $
27 * $FreeBSD: head/usr.bin/killall/killall.c 94689 2002-04-14 22:25:57Z des $
28 */
29
30#include <sys/cdefs.h>
31#include <sys/param.h>
32#include <sys/stat.h>
33#include <sys/user.h>
34#include <sys/sysctl.h>
35#include <fcntl.h>

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

108 char buf[256];
109 char *user = NULL;
110 char *tty = NULL;
111 char *cmd = NULL;
112 int vflag = 0;
113 int sflag = 0;
114 int dflag = 0;
115 int mflag = 0;
28 */
29
30#include <sys/cdefs.h>
31#include <sys/param.h>
32#include <sys/stat.h>
33#include <sys/user.h>
34#include <sys/sysctl.h>
35#include <fcntl.h>

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

108 char buf[256];
109 char *user = NULL;
110 char *tty = NULL;
111 char *cmd = NULL;
112 int vflag = 0;
113 int sflag = 0;
114 int dflag = 0;
115 int mflag = 0;
116 int zflag = 0;
116 uid_t uid = 0;
117 dev_t tdev = 0;
118 char thiscmd[MAXCOMLEN + 1];
119 pid_t thispid;
120 uid_t thisuid;
121 dev_t thistdev;
122 int sig = SIGTERM;
123 const char *const *p;

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

172 sflag++;
173 break;
174 case 'd':
175 dflag++;
176 break;
177 case 'm':
178 mflag++;
179 break;
117 uid_t uid = 0;
118 dev_t tdev = 0;
119 char thiscmd[MAXCOMLEN + 1];
120 pid_t thispid;
121 uid_t thisuid;
122 dev_t thistdev;
123 int sig = SIGTERM;
124 const char *const *p;

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

173 sflag++;
174 break;
175 case 'd':
176 dflag++;
177 break;
178 case 'm':
179 mflag++;
180 break;
181 case 'z':
182 zflag++;
183 break;
180 default:
181 if (isalpha(**av)) {
182 if (strncasecmp(*av, "sig", 3) == 0)
183 *av += 3;
184 for (sig = NSIG, p = sys_signame + 1;
185 --sig; ++p)
186 if (strcasecmp(*p, *av) == 0) {
187 sig = p - sys_signame;

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

281 fprintf(stderr, "userland out of sync with kernel, recompile libkvm etc\n");
282 exit(1);
283 }
284 nprocs = size / sizeof(struct kinfo_proc);
285 if (dflag)
286 printf("nprocs %d\n", nprocs);
287
288 for (i = 0; i < nprocs; i++) {
184 default:
185 if (isalpha(**av)) {
186 if (strncasecmp(*av, "sig", 3) == 0)
187 *av += 3;
188 for (sig = NSIG, p = sys_signame + 1;
189 --sig; ++p)
190 if (strcasecmp(*p, *av) == 0) {
191 sig = p - sys_signame;

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

285 fprintf(stderr, "userland out of sync with kernel, recompile libkvm etc\n");
286 exit(1);
287 }
288 nprocs = size / sizeof(struct kinfo_proc);
289 if (dflag)
290 printf("nprocs %d\n", nprocs);
291
292 for (i = 0; i < nprocs; i++) {
293 if ((procs[i].ki_stat & SZOMB) == SZOMB && !zflag)
294 continue;
289 thispid = procs[i].ki_pid;
290 strncpy(thiscmd, procs[i].ki_comm, MAXCOMLEN);
291 thiscmd[MAXCOMLEN] = '\0';
292 thistdev = procs[i].ki_tdev;
293 thisuid = procs[i].ki_ruid; /* real uid */
294
295 matched = 1;
296 if (user) {

--- 79 unchanged lines hidden ---
295 thispid = procs[i].ki_pid;
296 strncpy(thiscmd, procs[i].ki_comm, MAXCOMLEN);
297 thiscmd[MAXCOMLEN] = '\0';
298 thistdev = procs[i].ki_tdev;
299 thisuid = procs[i].ki_ruid; /* real uid */
300
301 matched = 1;
302 if (user) {

--- 79 unchanged lines hidden ---