| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ps.c,v 1.90 2018/04/11 18:52:05 christos Exp $ */ | | 1 | /* $NetBSD: ps.c,v 1.91 2018/04/11 18:52:29 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2000-2008 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2000-2008 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Simon Burge. | | 8 | * by Simon Burge. |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -58,27 +58,27 @@ | | | @@ -58,27 +58,27 @@ |
58 | * SUCH DAMAGE. | | 58 | * SUCH DAMAGE. |
59 | */ | | 59 | */ |
60 | | | 60 | |
61 | #include <sys/cdefs.h> | | 61 | #include <sys/cdefs.h> |
62 | #ifndef lint | | 62 | #ifndef lint |
63 | __COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\ | | 63 | __COPYRIGHT("@(#) Copyright (c) 1990, 1993, 1994\ |
64 | The Regents of the University of California. All rights reserved."); | | 64 | The Regents of the University of California. All rights reserved."); |
65 | #endif /* not lint */ | | 65 | #endif /* not lint */ |
66 | | | 66 | |
67 | #ifndef lint | | 67 | #ifndef lint |
68 | #if 0 | | 68 | #if 0 |
69 | static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; | | 69 | static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; |
70 | #else | | 70 | #else |
71 | __RCSID("$NetBSD: ps.c,v 1.90 2018/04/11 18:52:05 christos Exp $"); | | 71 | __RCSID("$NetBSD: ps.c,v 1.91 2018/04/11 18:52:29 christos Exp $"); |
72 | #endif | | 72 | #endif |
73 | #endif /* not lint */ | | 73 | #endif /* not lint */ |
74 | | | 74 | |
75 | #include <sys/param.h> | | 75 | #include <sys/param.h> |
76 | #include <sys/time.h> | | 76 | #include <sys/time.h> |
77 | #include <sys/resource.h> | | 77 | #include <sys/resource.h> |
78 | #include <sys/lwp.h> | | 78 | #include <sys/lwp.h> |
79 | #include <sys/proc.h> | | 79 | #include <sys/proc.h> |
80 | #include <sys/stat.h> | | 80 | #include <sys/stat.h> |
81 | #include <sys/ioctl.h> | | 81 | #include <sys/ioctl.h> |
82 | #include <sys/sysctl.h> | | 82 | #include <sys/sysctl.h> |
83 | | | 83 | |
84 | #include <stddef.h> | | 84 | #include <stddef.h> |
| @@ -415,27 +415,27 @@ main(int argc, char *argv[]) | | | @@ -415,27 +415,27 @@ main(int argc, char *argv[]) |
415 | calc_pcpu = 1; | | 415 | calc_pcpu = 1; |
416 | break; | | 416 | break; |
417 | } | | 417 | } |
418 | | | 418 | |
419 | /* | | 419 | /* |
420 | * scan requested variables, noting what structures are needed. | | 420 | * scan requested variables, noting what structures are needed. |
421 | */ | | 421 | */ |
422 | scanvars(); | | 422 | scanvars(); |
423 | | | 423 | |
424 | /* | | 424 | /* |
425 | * select procs | | 425 | * select procs |
426 | */ | | 426 | */ |
427 | if (!(kinfo = getkinfo_kvm(kd, what, flag, &nentries))) | | 427 | if (!(kinfo = getkinfo_kvm(kd, what, flag, &nentries))) |
428 | err(EXIT_FAILURE, "%s", kvm_geterr(kd)); | | 428 | errx(EXIT_FAILURE, "%s", kvm_geterr(kd)); |
429 | if (nentries == 0) { | | 429 | if (nentries == 0) { |
430 | printheader(); | | 430 | printheader(); |
431 | return 1; | | 431 | return 1; |
432 | } | | 432 | } |
433 | pinfo = setpinfo(kinfo, nentries, calc_pcpu, rawcpu); | | 433 | pinfo = setpinfo(kinfo, nentries, calc_pcpu, rawcpu); |
434 | | | 434 | |
435 | /* | | 435 | /* |
436 | * sort proc list | | 436 | * sort proc list |
437 | */ | | 437 | */ |
438 | qsort(pinfo, nentries, sizeof(struct pinfo), pscomp); | | 438 | qsort(pinfo, nentries, sizeof(struct pinfo), pscomp); |
439 | | | 439 | |
440 | /* | | 440 | /* |
441 | * We want things in descendant order | | 441 | * We want things in descendant order |