summaryrefslogtreecommitdiffhomepage
path: root/patches/procps_ng-3.3.17.local.patch
blob: d4f8119d8249b67684ec92bfd82d2de650dad7bd (plain)
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
diff -ru procps-3.3.17.orig/lib/nsutils.c procps-3.3.17/lib/nsutils.c
--- procps-3.3.17.orig/lib/nsutils.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/lib/nsutils.c	2022-11-07 00:01:25.779153614 +0100
@@ -16,7 +16,7 @@
 	int i, rc = 0;
 
 	for (i = 0; i < NUM_NS; i++) {
-		snprintf(buff, sizeof(buff), "/proc/%i/ns/%s", pid,
+		snprintf(buff, sizeof(buff), "/proc/sysproc/%i/ns/%s", pid,
 			get_ns_name(i));
 		if (stat(buff, &st)) {
 			if (errno != ENOENT)
diff -ru procps-3.3.17.orig/pidof.c procps-3.3.17/pidof.c
--- procps-3.3.17.orig/pidof.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/pidof.c	2022-11-07 00:01:45.927153736 +0100
@@ -117,7 +117,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-3.3.17.orig/pmap.c procps-3.3.17/pmap.c
--- procps-3.3.17.orig/pmap.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/pmap.c	2022-11-07 00:02:54.791154154 +0100
@@ -539,11 +539,11 @@
 	printf("%u:   %s\n", p->tgid, cmdbuf);
 
 	if (x_option || X_option || c_option) {
-		snprintf(buf, sizeof buf, "/proc/%u/smaps", p->tgid);
+		snprintf(buf, sizeof buf, "/proc/sysproc/%u/smaps", p->tgid);
 		if ((fp = fopen(buf, "r")) == NULL)
 			return 1;
 	} else {
-		snprintf(buf, sizeof buf, "/proc/%u/maps", p->tgid);
+		snprintf(buf, sizeof buf, "/proc/sysproc/%u/maps", p->tgid);
 		if ((fp = fopen(buf, "r")) == NULL)
 			return 1;
 	}
diff -ru procps-3.3.17.orig/proc/devname.c procps-3.3.17/proc/devname.c
--- procps-3.3.17.orig/proc/devname.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/proc/devname.c	2022-11-06 23:54:22.462970842 +0100
@@ -289,7 +289,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;
diff -ru procps-3.3.17.orig/proc/escape.c procps-3.3.17/proc/escape.c
--- procps-3.3.17.orig/proc/escape.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/proc/escape.c	2022-11-04 15:46:20.305190037 +0100
@@ -21,6 +21,7 @@
 #include <sys/types.h>
 #include <string.h>
 #include <limits.h>
+#include <langinfo.h>
 #include "procps.h"
 #include "escape.h"
 #include "readproc.h"
diff -ru procps-3.3.17.orig/proc/readproc.c procps-3.3.17/proc/readproc.c
--- procps-3.3.17.orig/proc/readproc.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/proc/readproc.c	2022-11-06 23:57:14.382411315 +0100
@@ -883,7 +883,7 @@
 // warning: interface may change
 int read_cmdline(char *restrict const dst, unsigned sz, unsigned pid) {
     char path[PROCPATHLEN];
-    snprintf(path, sizeof(path), "/proc/%u", pid);
+    snprintf(path, sizeof(path), "/proc/sysproc/%u", pid);
     return read_unvectored(dst, sz, path, "cmdline", ' ');
 }
 
@@ -1239,7 +1239,7 @@
   }
   p->tgid = strtoul(ent->d_name, NULL, 10);
   p->tid = p->tgid;
-  snprintf(path, PROCPATHLEN, "/proc/%s", ent->d_name);
+  snprintf(path, PROCPATHLEN, "/proc/sysproc/%s", ent->d_name);
   return 1;
 }
 
@@ -1253,7 +1253,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;
@@ -1266,7 +1266,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/%s", p->tgid, ent->d_name);
+  snprintf(path, PROCPATHLEN, "/proc/sysproc/%d/task/%s", p->tgid, ent->d_name);
   return 1;
 }
 
@@ -1277,7 +1277,7 @@
   char *restrict const path = PT->path;
   pid_t tgid = *(PT->pids)++;
   if(likely(tgid)){
-    snprintf(path, PROCPATHLEN, "/proc/%d", tgid);
+    snprintf(path, PROCPATHLEN, "/proc/sysproc/%d", tgid);
     p->tgid = tgid;
     p->tid = tgid;  // they match for leaders
   }
@@ -1677,7 +1677,7 @@
     static char path[32];
     struct stat statbuf;
 
-    snprintf(path, sizeof path, "/proc/%d", pid);
+    snprintf(path, sizeof path, "/proc/sysproc/%d", pid);
     if (stat(path, &statbuf)) {
         perror("stat");
         return NULL;
diff -ru procps-3.3.17.orig/proc/sysinfo.c procps-3.3.17/proc/sysinfo.c
--- procps-3.3.17.orig/proc/sysinfo.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/proc/sysinfo.c	2022-11-06 23:53:23.999176866 +0100
@@ -488,7 +488,7 @@
     char c;
 
     if (!isdigit(ent->d_name[0])) continue;
-    snprintf(tbuf, sizeof(tbuf), "/proc/%s/stat", ent->d_name);
+    snprintf(tbuf, sizeof(tbuf), "/proc/sysproc/%s/stat", ent->d_name);
 
     fd = open(tbuf, O_RDONLY, 0);
     if (fd == -1) continue;
diff -ru procps-3.3.17.orig/proc/wchan.c procps-3.3.17/proc/wchan.c
--- procps-3.3.17.orig/proc/wchan.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/proc/wchan.c	2022-11-06 23:55:15.750410595 +0100
@@ -32,7 +32,7 @@
    ssize_t num;
    int fd;
 
-   snprintf(buf, sizeof buf, "/proc/%d/wchan", pid);
+   snprintf(buf, sizeof buf, "/proc/sysproc/%d/wchan", pid);
    fd = open(buf, O_RDONLY);
    if (fd==-1) return "?";
 
diff -ru procps-3.3.17.orig/ps/output.c procps-3.3.17/ps/output.c
--- procps-3.3.17.orig/ps/output.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/ps/output.c	2022-11-06 23:59:52.026412271 +0100
@@ -1229,7 +1229,7 @@
     int fd;
     u_int32_t luid;
 
-    snprintf(filename, sizeof filename, "/proc/%d/loginuid", pp->tgid);
+    snprintf(filename, sizeof filename, "/proc/sysproc/%d/loginuid", pp->tgid);
 
     if ((fd = open(filename, O_RDONLY, 0)) != -1) {
         num_read = read(fd, outbuf, OUTBUF_SIZE - 1);
@@ -1255,7 +1255,7 @@
     char filename[48];
     ssize_t num_read;
 
-    snprintf(filename, sizeof filename, "/proc/%d/exe", pp->tgid);
+    snprintf(filename, sizeof filename, "/proc/sysproc/%d/exe", pp->tgid);
 
     num_read = readlink(filename, outbuf, OUTBUF_SIZE-1);
     if (num_read > 0) {
@@ -1371,7 +1371,7 @@
 
 // wchan file is suitable for testing
 //snprintf(filename, sizeof filename, "/proc/%d/wchan", pp->tgid);
-    snprintf(filename, sizeof filename, "/proc/%d/attr/current", pp->tgid);
+    snprintf(filename, sizeof filename, "/proc/sysproc/%d/attr/current", pp->tgid);
 
     if ((fd = open(filename, O_RDONLY, 0)) != -1) {
       num_read = read(fd, outbuf, OUTBUF_SIZE-1);
diff -ru procps-3.3.17.orig/pwdx.c procps-3.3.17/pwdx.c
--- procps-3.3.17.orig/pwdx.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/pwdx.c	2022-11-07 00:00:51.339153405 +0100
@@ -118,7 +118,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]);
 
diff -ru procps-3.3.17.orig/skill.c procps-3.3.17/skill.c
--- procps-3.3.17.orig/skill.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/skill.c	2022-11-07 00:00:34.811153304 +0100
@@ -181,7 +181,7 @@
 	if (pid == my_pid || pid == 0)
 		return;
 	/* pid (cmd) state ppid pgrp session tty */
-	sprintf(buf, "/proc/%d/stat", pid);
+	sprintf(buf, "/proc/sysproc/%d/stat", pid);
 	fd = open(buf, O_RDONLY);
 	if (fd == -1) {
 		/* process exited maybe */
diff -ru procps-3.3.17.orig/w.c procps-3.3.17/w.c
--- procps-3.3.17.orig/w.c	2021-02-09 11:11:25.000000000 +0100
+++ procps-3.3.17/w.c	2022-11-04 15:46:20.305190037 +0100
@@ -55,11 +55,7 @@
 #include <termios.h>
 #include <time.h>
 #include <unistd.h>
-#ifdef HAVE_UTMPX_H
-#	include <utmpx.h>
-#else
-#	include <utmp.h>
-#endif
+#include <utmp.h>
 #include <arpa/inet.h>
 
 static int ignoreuser = 0;	/* for '-u' */