Need limits.h for PATH_MAX on SunOS.diff -r1.4 -r1.5 pkgsrc/sysutils/psmisc/distinfo
(jperkin)
@@ -1,12 +1,12 @@ | @@ -1,12 +1,12 @@ | |||
1 | $NetBSD: distinfo,v 1.4 2005/02/24 13:40:56 agc Exp $ | 1 | $NetBSD: distinfo,v 1.5 2013/12/13 09:58:58 jperkin Exp $ | |
2 | 2 | |||
3 | SHA1 (psmisc-20.1.tar.gz) = e969a2f539b181c372b0f82bbbd430c4d57d5d6b | 3 | SHA1 (psmisc-20.1.tar.gz) = e969a2f539b181c372b0f82bbbd430c4d57d5d6b | |
4 | RMD160 (psmisc-20.1.tar.gz) = 48698ad9f431c881bcb42394f5c912ef91b84d2b | 4 | RMD160 (psmisc-20.1.tar.gz) = 48698ad9f431c881bcb42394f5c912ef91b84d2b | |
5 | Size (psmisc-20.1.tar.gz) = 57767 bytes | 5 | Size (psmisc-20.1.tar.gz) = 57767 bytes | |
6 | SHA1 (patch-aa) = 97b586e06444b9aa2a6ba95c10eaabc93f89c833 | 6 | SHA1 (patch-aa) = 97b586e06444b9aa2a6ba95c10eaabc93f89c833 | |
7 | SHA1 (patch-ab) = 4aadacec85e2234c010aad2db5fa9fe469562f4f | 7 | SHA1 (patch-ab) = 4aadacec85e2234c010aad2db5fa9fe469562f4f | |
8 | SHA1 (patch-ac) = 9f9a7c7c5155345a1045aee70a2dd65a25ec7219 | 8 | SHA1 (patch-ac) = 9f9a7c7c5155345a1045aee70a2dd65a25ec7219 | |
9 | SHA1 (patch-ad) = 73ae9467e783957ce7ff638d8637e7398f75c5fe | 9 | SHA1 (patch-ad) = 6e2886ca59160d161d334e276675f187f138db7c | |
10 | SHA1 (patch-ae) = 484305118582c575f8c4827783aa3d5f57b25b5d | 10 | SHA1 (patch-ae) = 484305118582c575f8c4827783aa3d5f57b25b5d | |
11 | SHA1 (patch-af) = 3c5ba3cf27a422943f984b8414ac29da0b8934da | 11 | SHA1 (patch-af) = 28a9417dda852ad5b76ad44774f1aeb3d66e2791 | |
12 | SHA1 (patch-ag) = a03a4a0c0dbf065e2b2785cee8f23579a11ae13f | 12 | SHA1 (patch-ag) = a03a4a0c0dbf065e2b2785cee8f23579a11ae13f |
@@ -1,71 +1,79 @@ | @@ -1,71 +1,79 @@ | |||
1 | $NetBSD: patch-ad,v 1.6 2001/04/24 16:59:35 jlam Exp $ | 1 | $NetBSD: patch-ad,v 1.7 2013/12/13 09:58:58 jperkin Exp $ | |
2 | 2 | |||
3 | --- src/killall.c.orig Sat Mar 31 05:26:47 2001 | 3 | Need limits.h for PATH_MAX | |
4 | ||||
5 | --- src/killall.c.orig 2001-03-31 10:26:47.000000000 +0000 | |||
4 | +++ src/killall.c | 6 | +++ src/killall.c | |
5 | @@ -18,10 +18,10 @@ | 7 | @@ -13,15 +13,16 @@ | |
8 | #include <dirent.h> | |||
9 | #include <signal.h> | |||
10 | #include <errno.h> | |||
11 | +#include <limits.h> | |||
12 | #include <sys/types.h> | |||
13 | #include <sys/stat.h> | |||
6 | #include <getopt.h> | 14 | #include <getopt.h> | |
7 | 15 | |||
8 | #include "comm.h" | 16 | #include "comm.h" | |
9 | +#include "procfs.h" | 17 | +#include "procfs.h" | |
10 | #include "signals.h" | 18 | #include "signals.h" | |
11 | 19 | |||
12 | 20 | |||
13 | -#define PROC_BASE "/proc" | 21 | -#define PROC_BASE "/proc" | |
14 | #define MAX_NAMES (sizeof(unsigned long)*8) | 22 | #define MAX_NAMES (sizeof(unsigned long)*8) | |
15 | 23 | |||
16 | 24 | |||
17 | @@ -138,11 +138,15 @@ | 25 | @@ -138,11 +139,15 @@ kill_all (int signal, int names, char ** | |
18 | } | 26 | } | |
19 | for (i = 0; i < pids; i++) | 27 | for (i = 0; i < pids; i++) | |
20 | { | 28 | { | |
21 | - sprintf (path, PROC_BASE "/%d/stat", pid_table[i]); | 29 | - sprintf (path, PROC_BASE "/%d/stat", pid_table[i]); | |
22 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], STATUS_FILE); | 30 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], STATUS_FILE); | |
23 | if (!(file = fopen (path, "r"))) | 31 | if (!(file = fopen (path, "r"))) | |
24 | continue; | 32 | continue; | |
25 | empty = 0; | 33 | empty = 0; | |
26 | +#ifdef BSD_44_PROCFS | 34 | +#ifdef BSD_44_PROCFS | |
27 | + okay = fscanf (file, "%s", comm) == 1; | 35 | + okay = fscanf (file, "%s", comm) == 1; | |
28 | +#else | 36 | +#else | |
29 | okay = fscanf (file, "%*d (%[^)]", comm) == 1; | 37 | okay = fscanf (file, "%*d (%[^)]", comm) == 1; | |
30 | +#endif | 38 | +#endif | |
31 | (void) fclose (file); | 39 | (void) fclose (file); | |
32 | if (!okay) | 40 | if (!okay) | |
33 | continue; | 41 | continue; | |
34 | @@ -151,7 +155,10 @@ | 42 | @@ -151,7 +156,10 @@ kill_all (int signal, int names, char ** | |
35 | length = strlen (comm); | 43 | length = strlen (comm); | |
36 | if (length == COMM_LEN - 1) | 44 | if (length == COMM_LEN - 1) | |
37 | { | 45 | { | |
38 | - sprintf (path, PROC_BASE "/%d/cmdline", pid_table[i]); | 46 | - sprintf (path, PROC_BASE "/%d/cmdline", pid_table[i]); | |
39 | +#if defined(BSD_44_PROCFS) && !defined(BSD_PROCFS_CMDLINE) | 47 | +#if defined(BSD_44_PROCFS) && !defined(BSD_PROCFS_CMDLINE) | |
40 | + okay = 0; | 48 | + okay = 0; | |
41 | +#else | 49 | +#else | |
42 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], CMDLINE_FILE); | 50 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], CMDLINE_FILE); | |
43 | if (!(file = fopen (path, "r"))) | 51 | if (!(file = fopen (path, "r"))) | |
44 | continue; | 52 | continue; | |
45 | while (1) { | 53 | while (1) { | |
46 | @@ -180,6 +187,7 @@ | 54 | @@ -180,6 +188,7 @@ kill_all (int signal, int names, char ** | |
47 | } | 55 | } | |
48 | } | 56 | } | |
49 | (void) fclose(file); | 57 | (void) fclose(file); | |
50 | +#endif | 58 | +#endif | |
51 | if (exact && !okay) | 59 | if (exact && !okay) | |
52 | { | 60 | { | |
53 | if (verbose) | 61 | if (verbose) | |
54 | @@ -206,7 +214,7 @@ | 62 | @@ -206,7 +215,7 @@ kill_all (int signal, int names, char ** | |
55 | } | 63 | } | |
56 | else | 64 | else | |
57 | { | 65 | { | |
58 | - sprintf (path, PROC_BASE "/%d/exe", pid_table[i]); | 66 | - sprintf (path, PROC_BASE "/%d/exe", pid_table[i]); | |
59 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], EXE_FILE); | 67 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid_table[i], EXE_FILE); | |
60 | if (stat (path, &st) < 0) | 68 | if (stat (path, &st) < 0) | |
61 | continue; | 69 | continue; | |
62 | if (sts[j].st_dev != st.st_dev || sts[j].st_ino != st.st_ino) | 70 | if (sts[j].st_dev != st.st_dev || sts[j].st_ino != st.st_ino) | |
63 | @@ -369,7 +377,7 @@ | 71 | @@ -369,7 +378,7 @@ main (int argc, char **argv) | |
64 | sig_num = SIGTERM; | 72 | sig_num = SIGTERM; | |
65 | 73 | |||
66 | opterr = 0; | 74 | opterr = 0; | |
67 | - while ( (optc = getopt_long_only(argc,argv,"egilqs:vwV",options,NULL)) != EOF) { | 75 | - while ( (optc = getopt_long_only(argc,argv,"egilqs:vwV",options,NULL)) != EOF) { | |
68 | + while ( (optc = getopt_long(argc,argv,"egilqs:vwV",options,NULL)) != EOF) { | 76 | + while ( (optc = getopt_long(argc,argv,"egilqs:vwV",options,NULL)) != EOF) { | |
69 | switch (optc) { | 77 | switch (optc) { | |
70 | case 'e': | 78 | case 'e': | |
71 | exact = 1; | 79 | exact = 1; |
@@ -1,92 +1,102 @@ | @@ -1,92 +1,102 @@ | |||
1 | $NetBSD: patch-af,v 1.4 2001/04/24 16:59:35 jlam Exp $ | 1 | $NetBSD: patch-af,v 1.5 2013/12/13 09:58:58 jperkin Exp $ | |
2 | 2 | |||
3 | --- src/pstree.c.orig Mon Dec 18 00:59:23 2000 | 3 | Need limits.h for PATH_MAX | |
4 | ||||
5 | --- src/pstree.c.orig 2000-12-18 05:59:23.000000000 +0000 | |||
4 | +++ src/pstree.c | 6 | +++ src/pstree.c | |
5 | @@ -22,12 +22,12 @@ | 7 | @@ -15,6 +15,7 @@ | |
8 | #include <getopt.h> | |||
9 | #include <pwd.h> | |||
10 | #include <dirent.h> | |||
11 | +#include <limits.h> | |||
12 | #include <termios.h> | |||
13 | #include <termcap.h> | |||
14 | #include <sys/types.h> | |||
15 | @@ -22,12 +23,12 @@ | |||
6 | #include <sys/ioctl.h> | 16 | #include <sys/ioctl.h> | |
7 | 17 | |||
8 | #include "comm.h" | 18 | #include "comm.h" | |
9 | +#include "procfs.h" | 19 | +#include "procfs.h" | |
10 | 20 | |||
11 | 21 | |||
12 | #ifndef MAX_DEPTH | 22 | #ifndef MAX_DEPTH | |
13 | #define MAX_DEPTH 100 | 23 | #define MAX_DEPTH 100 | |
14 | #endif | 24 | #endif | |
15 | -#define PROC_BASE "/proc" | 25 | -#define PROC_BASE "/proc" | |
16 | 26 | |||
17 | /* UTF-8 defines by Johan Myreen */ | 27 | /* UTF-8 defines by Johan Myreen */ | |
18 | #define UTF_V "\342\224\202\277" /* Vertical line drawing char */ | 28 | #define UTF_V "\342\224\202\277" /* Vertical line drawing char */ | |
19 | @@ -303,6 +303,7 @@ | 29 | @@ -303,6 +304,7 @@ dump_tree (PROC * current, int level, in | |
20 | const struct passwd *pw; | 30 | const struct passwd *pw; | |
21 | int lvl, i, add, offset, len, swapped, info, count, comm_len, first; | 31 | int lvl, i, add, offset, len, swapped, info, count, comm_len, first; | |
22 | const char *tmp, *here; | 32 | const char *tmp, *here; | |
23 | + char tbuf[1024], *pbuf; | 33 | + char tbuf[1024], *pbuf; | |
24 | char comm_tmp[5]; | 34 | char comm_tmp[5]; | |
25 | 35 | |||
26 | if (!current) | 36 | if (!current) | |
27 | @@ -327,7 +328,8 @@ | 37 | @@ -327,7 +329,8 @@ dump_tree (PROC * current, int level, in | |
28 | add = out_int (rep) + 2; | 38 | add = out_int (rep) + 2; | |
29 | out_string ("*["); | 39 | out_string ("*["); | |
30 | } | 40 | } | |
31 | - if (current->highlight && (tmp = tgetstr ("md", NULL))) | 41 | - if (current->highlight && (tmp = tgetstr ("md", NULL))) | |
32 | + pbuf = tbuf; | 42 | + pbuf = tbuf; | |
33 | + if (current->highlight && (tmp = tgetstr ("md", &pbuf))) | 43 | + if (current->highlight && (tmp = tgetstr ("md", &pbuf))) | |
34 | tputs (tmp, 1, putchar); | 44 | tputs (tmp, 1, putchar); | |
35 | if ((swapped = print_args) && current->argc < 0) | 45 | if ((swapped = print_args) && current->argc < 0) | |
36 | out_char ('('); | 46 | out_char ('('); | |
37 | @@ -366,7 +368,8 @@ | 47 | @@ -366,7 +369,8 @@ dump_tree (PROC * current, int level, in | |
38 | } | 48 | } | |
39 | if (info || swapped) | 49 | if (info || swapped) | |
40 | out_char (')'); | 50 | out_char (')'); | |
41 | - if (current->highlight && (tmp = tgetstr ("me", NULL))) | 51 | - if (current->highlight && (tmp = tgetstr ("me", NULL))) | |
42 | + pbuf = tbuf; | 52 | + pbuf = tbuf; | |
43 | + if (current->highlight && (tmp = tgetstr ("me", &pbuf))) | 53 | + if (current->highlight && (tmp = tgetstr ("me", &pbuf))) | |
44 | tputs (tmp, 1, putchar); | 54 | tputs (tmp, 1, putchar); | |
45 | if (print_args) | 55 | if (print_args) | |
46 | { | 56 | { | |
47 | @@ -504,7 +507,7 @@ | 57 | @@ -504,7 +508,7 @@ read_proc (void) | |
48 | while ((de = readdir (dir)) != NULL) | 58 | while ((de = readdir (dir)) != NULL) | |
49 | if ((pid = atoi (de->d_name)) != 0) | 59 | if ((pid = atoi (de->d_name)) != 0) | |
50 | { | 60 | { | |
51 | - sprintf (path, "%s/%d/stat", PROC_BASE, pid); | 61 | - sprintf (path, "%s/%d/stat", PROC_BASE, pid); | |
52 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid, STATUS_FILE); | 62 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid, STATUS_FILE); | |
53 | if ((file = fopen (path, "r")) != NULL) | 63 | if ((file = fopen (path, "r")) != NULL) | |
54 | { | 64 | { | |
55 | empty = 0; | 65 | empty = 0; | |
56 | @@ -513,6 +516,10 @@ | 66 | @@ -513,6 +517,10 @@ read_proc (void) | |
57 | perror (path); | 67 | perror (path); | |
58 | exit (1); | 68 | exit (1); | |
59 | } | 69 | } | |
60 | +#ifdef BSD_44_PROCFS | 70 | +#ifdef BSD_44_PROCFS | |
61 | + if (fscanf(file, "%s %*d %d", comm, &ppid) == 2) | 71 | + if (fscanf(file, "%s %*d %d", comm, &ppid) == 2) | |
62 | + { { { | 72 | + { { { | |
63 | +#else | 73 | +#else | |
64 | fread(readbuf, BUFSIZ, 1, file) ; | 74 | fread(readbuf, BUFSIZ, 1, file) ; | |
65 | if (ferror(file) == 0) | 75 | if (ferror(file) == 0) | |
66 | { | 76 | { | |
67 | @@ -532,11 +539,12 @@ | 77 | @@ -532,11 +540,12 @@ read_proc (void) | |
68 | (file, "%d (%s) %c %d", &dummy, comm, (char *) &dummy, | 78 | (file, "%d (%s) %c %d", &dummy, comm, (char *) &dummy, | |
69 | &ppid) == 4) | 79 | &ppid) == 4) | |
70 | */ | 80 | */ | |
71 | +#endif | 81 | +#endif | |
72 | if (!print_args) | 82 | if (!print_args) | |
73 | add_proc (comm, pid, ppid, st.st_uid, NULL, 0); | 83 | add_proc (comm, pid, ppid, st.st_uid, NULL, 0); | |
74 | else | 84 | else | |
75 | { | 85 | { | |
76 | - sprintf (path, "%s/%d/cmdline", PROC_BASE, pid); | 86 | - sprintf (path, "%s/%d/cmdline", PROC_BASE, pid); | |
77 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid, CMDLINE_FILE); | 87 | + sprintf (path, "%s/%d/%s", PROC_BASE, pid, CMDLINE_FILE); | |
78 | if ((fd = open (path, O_RDONLY)) < 0) | 88 | if ((fd = open (path, O_RDONLY)) < 0) | |
79 | { | 89 | { | |
80 | perror (path); | 90 | perror (path); | |
81 | @@ -641,7 +649,11 @@ | 91 | @@ -641,7 +650,11 @@ main (int argc, char **argv) | |
82 | switch (c) | 92 | switch (c) | |
83 | { | 93 | { | |
84 | case 'a': | 94 | case 'a': | |
85 | +#if defined(BSD_44_PROCFS) && !defined(BSD_PROCFS_CMDLINE) | 95 | +#if defined(BSD_44_PROCFS) && !defined(BSD_PROCFS_CMDLINE) | |
86 | + print_args = 0; | 96 | + print_args = 0; | |
87 | +#else | 97 | +#else | |
88 | print_args = 1; | 98 | print_args = 1; | |
89 | +#endif | 99 | +#endif | |
90 | break; | 100 | break; | |
91 | case 'c': | 101 | case 'c': | |
92 | compact = 0; | 102 | compact = 0; |