ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/pack/freebsd/sysutils/psmisc/files/patch-src-pstree.c
Revision: 279
Committed: 2010-05-18T03:59:26-07:00 (15 years, 1 month ago) by douglas
Content type: text/x-diff
File size: 1384 byte(s)
Log Message:
Import psmisc so we can fix it up a bit.

File Contents

# User Rev Content
1 douglas 279 --- src/pstree.c.orig 2009-12-27 15:46:47.000000000 +0900
2     +++ src/pstree.c 2010-01-03 00:52:21.437862505 +0900
3     @@ -37,6 +37,7 @@
4     #include <term.h>
5     #include <termios.h>
6     #include <langinfo.h>
7     +#include <limits.h>
8     #include <assert.h>
9     #include <sys/types.h>
10     #include <sys/stat.h>
11     @@ -590,7 +591,11 @@
12     struct dirent *de;
13     FILE *file;
14     struct stat st;
15     +#ifdef __FreeBSD__
16     + char *path, comm[COMM_LEN + 1];
17     +#else
18     char *path, *comm;
19     +#endif
20     char *buffer;
21     size_t buffer_size;
22     char readbuf[BUFSIZ + 1];
23     @@ -623,7 +628,7 @@
24     if ((pid = (pid_t) atoi(de->d_name)) != 0) {
25     if (! (path = malloc(strlen(PROC_BASE) + strlen(de->d_name) + 10)))
26     exit(2);
27     - sprintf(path, "%s/%d/stat", PROC_BASE, pid);
28     + sprintf (path, "%s/%d/status", PROC_BASE, pid);
29     if ((file = fopen(path, "r")) != NULL) {
30     empty = 0;
31     sprintf(path, "%s/%d", PROC_BASE, pid);
32     @@ -638,6 +643,10 @@
33     perror(path);
34     exit(1);
35     }
36     +#ifdef __FreeBSD__
37     + if (fscanf(file, "%s %*d %d", comm, &ppid) == 2)
38     + add_proc(comm, pid, ppid, st.st_uid, NULL, 0, 0);
39     +#else
40     size = fread(readbuf, 1, BUFSIZ, file);
41     if (ferror(file) == 0) {
42     readbuf[size] = 0;
43     @@ -725,6 +734,7 @@
44     }
45     }
46     }
47     +#endif /*__FreeBSD__*/
48     (void) fclose(file);
49     }
50     free(path);

Properties

Name Value
svn:mime-type text/x-diff