1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
diff -ru procps-ng-4.0.4.orig/library/devname.c procps-ng-4.0.4/library/devname.c
--- procps-ng-4.0.4.orig/library/devname.c 2023-07-11 11:09:18.436786212 +0200
+++ procps-ng-4.0.4/library/devname.c 2024-08-13 11:40:55.012140114 +0200
@@ -287,7 +287,7 @@
struct stat sbuf;
char path[32];
ssize_t count;
- const int len = snprintf(path, sizeof path, "/proc/%d/%s", pid, name); /* often permission denied */
+ const int len = snprintf(path, sizeof path, "/proc/sysproc/%d/%s", pid, name); /* often permission denied */
if(len <= 0 || (size_t)len >= sizeof path) return 0;
count = readlink(path,buf,TTY_NAME_SIZE-1);
if(count <= 0 || count >= TTY_NAME_SIZE-1) return 0;
@@ -305,7 +305,7 @@
char path[32];
FILE *fp;
char *lf;
- sprintf (path, "/proc/%d/ctty", pid); /* often permission denied */
+ sprintf (path, "/proc/sysproc/%d/ctty", pid); /* often permission denied */
fp = fopen (path, "r");
if (!fp)
return 0;
diff -ru procps-ng-4.0.4.orig/library/readproc.c procps-ng-4.0.4/library/readproc.c
--- procps-ng-4.0.4.orig/library/readproc.c 2023-07-11 11:09:18.436786212 +0200
+++ procps-ng-4.0.4/library/readproc.c 2024-08-13 11:38:26.689488350 +0200
@@ -1389,7 +1389,7 @@
p->tgid = strtoul(ent->d_name, NULL, 10);
if (errno == 0) {
p->tid = p->tgid;
- snprintf(path, PROCPATHLEN, "/proc/%d", p->tgid);
+ snprintf(path, PROCPATHLEN, "/proc/sysproc/%d", p->tgid);
return 1;
}
}
@@ -1408,7 +1408,7 @@
closedir(PT->taskdir);
}
// use "path" as some tmp space
- snprintf(path, PROCPATHLEN, "/proc/%d/task", p->tgid);
+ snprintf(path, PROCPATHLEN, "/proc/sysproc/%d/task", p->tgid);
PT->taskdir = opendir(path);
if(!PT->taskdir) return 0;
PT->taskdir_user = p->tgid;
@@ -1421,7 +1421,7 @@
t->tid = strtoul(ent->d_name, NULL, 10);
t->tgid = p->tgid;
//t->ppid = p->ppid; // cover for kernel behavior? we want both actually...?
- snprintf(path, PROCPATHLEN, "/proc/%d/task/%.10s", p->tgid, ent->d_name);
+ snprintf(path, PROCPATHLEN, "/proc/sysproc/%d/task/%.10s", p->tgid, ent->d_name);
return 1;
}
@@ -1435,7 +1435,7 @@
char *path = PT->path;
if (pid) {
- snprintf(path, PROCPATHLEN, "/proc/%d", pid);
+ snprintf(path, PROCPATHLEN, "/proc/sysproc/%d", pid);
p->tid = p->tgid = pid; // this tgid may be a huge fib |
/* the 'status' directory is the only place where we find the |
diff -ru procps-ng-4.0.4.orig/src/pidof.c procps-ng-4.0.4/src/pidof.c
--- procps-ng-4.0.4.orig/src/pidof.c 2023-08-15 13:02:25.783784823 +0200
+++ procps-ng-4.0.4/src/pidof.c 2024-08-13 11:31:47.634655407 +0200
@@ -124,7 +124,7 @@
ssize_t path_alloc_size;
ssize_t len;
- snprintf(link, sizeof(link), "/proc/%d/%s", pid, base_name);
+ snprintf(link, sizeof(link), "/proc/sysproc/%d/%s", pid, base_name);
len = path_alloc_size = 0;
result = NULL;
diff -ru procps-ng-4.0.4.orig/src/pmap.c procps-ng-4.0.4/src/pmap.c
--- procps-ng-4.0.4.orig/src/pmap.c 2023-08-15 12:43:38.772140122 +0200
+++ procps-ng-4.0.4/src/pmap.c 2024-08-13 11:28:36.375534274 +0200
@@ -554,11 +554,11 @@
printf("%u: %s\n", PIDS_VAL(tgid, s_int, p, Pids_info), PIDS_VAL(cmdline, str, p, Pids_info));
if (x_option || X_option || c_option) {
- snprintf(buf, sizeof buf, "/proc/%u/smaps", PIDS_VAL(tgid, s_int, p, Pids_info));
+ snprintf(buf, sizeof buf, "/proc/sysproc/%u/smaps", PIDS_VAL(tgid, s_int, p, Pids_info));
if ((fp = fopen(buf, "r")) == NULL)
return 1;
} else {
- snprintf(buf, sizeof buf, "/proc/%u/maps", PIDS_VAL(tgid, s_int, p, Pids_info));
+ snprintf(buf, sizeof buf, "/proc/sysproc/%u/maps", PIDS_VAL(tgid, s_int, p, Pids_info));
if ((fp = fopen(buf, "r")) == NULL)
return 1;
}
diff -ru procps-ng-4.0.4.orig/src/ps/global.c procps-ng-4.0.4/src/ps/global.c
--- procps-ng-4.0.4.orig/src/ps/global.c 2023-08-16 00:54:03.759538026 +0200
+++ procps-ng-4.0.4/src/ps/global.c 2024-08-13 11:25:38.536358536 +0200
@@ -176,7 +176,7 @@
const char *bsd_v_format = (const char *)0xdeadbeef;
int bsd_c_option = -1;
int bsd_e_option = -1;
-unsigned cached_euid = 0xffffffff;
+uid_t cached_euid = 0xffffffff;
int cached_tty = -1;
char forest_prefix[4 * 32*1024 + 100]; // FIXME
int forest_type = -1;
diff -ru procps-ng-4.0.4.orig/src/pwdx.c procps-ng-4.0.4/src/pwdx.c
--- procps-ng-4.0.4.orig/src/pwdx.c 2023-07-11 11:09:18.464787022 +0200
+++ procps-ng-4.0.4/src/pwdx.c 2024-08-13 11:31:25.734756041 +0200
@@ -53,8 +53,8 @@
long pid;
char *end = NULL;
- if (!strncmp("/proc/", input, 6))
- skip = 6;
+ if (!strncmp("/proc/sysproc/", input, 14))
+ skip = 14;
errno = 0;
pid = strtol(input + skip, &end, 10);
@@ -122,7 +122,7 @@
* the first char is possible
*/
if (argv[i][0] != '/')
- snprintf(buf, buflen, "/proc/%s/cwd", argv[i]);
+ snprintf(buf, buflen, "/proc/sysproc/%s/cwd", argv[i]);
else
snprintf(buf, buflen, "%s/cwd", argv[i]);
|