Blame patches/procps_ng-3.3.17.local.patch

d2bcc3
diff -ru procps-3.3.17.orig/lib/nsutils.c procps-3.3.17/lib/nsutils.c
d2bcc3
--- procps-3.3.17.orig/lib/nsutils.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/lib/nsutils.c	2022-11-07 00:01:25.779153614 +0100
d2bcc3
@@ -16,7 +16,7 @@
d2bcc3
 	int i, rc = 0;
d2bcc3
 
d2bcc3
 	for (i = 0; i < NUM_NS; i++) {
d2bcc3
-		snprintf(buff, sizeof(buff), "/proc/%i/ns/%s", pid,
d2bcc3
+		snprintf(buff, sizeof(buff), "/proc/syspid/%i/ns/%s", pid,
d2bcc3
 			get_ns_name(i));
d2bcc3
 		if (stat(buff, &st)) {
d2bcc3
 			if (errno != ENOENT)
d2bcc3
diff -ru procps-3.3.17.orig/pidof.c procps-3.3.17/pidof.c
d2bcc3
--- procps-3.3.17.orig/pidof.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/pidof.c	2022-11-07 00:01:45.927153736 +0100
d2bcc3
@@ -117,7 +117,7 @@
d2bcc3
 	ssize_t path_alloc_size;
d2bcc3
 	ssize_t len;
d2bcc3
 
d2bcc3
-	snprintf(link, sizeof(link), "/proc/%d/%s", pid, base_name);
d2bcc3
+	snprintf(link, sizeof(link), "/proc/syspid/%d/%s", pid, base_name);
d2bcc3
 
d2bcc3
 	len = path_alloc_size = 0;
d2bcc3
 	result = NULL;
d2bcc3
diff -ru procps-3.3.17.orig/pmap.c procps-3.3.17/pmap.c
d2bcc3
--- procps-3.3.17.orig/pmap.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/pmap.c	2022-11-07 00:02:54.791154154 +0100
d2bcc3
@@ -539,11 +539,11 @@
d2bcc3
 	printf("%u:   %s\n", p->tgid, cmdbuf);
d2bcc3
 
d2bcc3
 	if (x_option || X_option || c_option) {
d2bcc3
-		snprintf(buf, sizeof buf, "/proc/%u/smaps", p->tgid);
d2bcc3
+		snprintf(buf, sizeof buf, "/proc/syspid/%u/smaps", p->tgid);
d2bcc3
 		if ((fp = fopen(buf, "r")) == NULL)
d2bcc3
 			return 1;
d2bcc3
 	} else {
d2bcc3
-		snprintf(buf, sizeof buf, "/proc/%u/maps", p->tgid);
d2bcc3
+		snprintf(buf, sizeof buf, "/proc/syspid/%u/maps", p->tgid);
d2bcc3
 		if ((fp = fopen(buf, "r")) == NULL)
d2bcc3
 			return 1;
d2bcc3
 	}
d2bcc3
diff -ru procps-3.3.17.orig/proc/devname.c procps-3.3.17/proc/devname.c
d2bcc3
--- procps-3.3.17.orig/proc/devname.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/proc/devname.c	2022-11-06 23:54:22.462970842 +0100
d2bcc3
@@ -289,7 +289,7 @@
d2bcc3
   struct stat sbuf;
d2bcc3
   char path[32];
d2bcc3
   ssize_t count;
d2bcc3
-  const int len = snprintf(path, sizeof path, "/proc/%d/%s", pid, name);  /* often permission denied */
d2bcc3
+  const int len = snprintf(path, sizeof path, "/proc/syspid/%d/%s", pid, name);  /* often permission denied */
d2bcc3
   if(len <= 0 || (size_t)len >= sizeof path) return 0;
d2bcc3
   count = readlink(path,buf,TTY_NAME_SIZE-1);
d2bcc3
   if(count <= 0 || count >= TTY_NAME_SIZE-1) return 0;
ac98b6
diff -ru procps-3.3.17.orig/proc/escape.c procps-3.3.17/proc/escape.c
d2bcc3
--- procps-3.3.17.orig/proc/escape.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/proc/escape.c	2022-11-04 15:46:20.305190037 +0100
ac98b6
@@ -21,6 +21,7 @@
ac98b6
 #include <sys/types.h>
ac98b6
 #include <string.h>
ac98b6
 #include <limits.h>
ac98b6
+#include <langinfo.h>
ac98b6
 #include "procps.h"
ac98b6
 #include "escape.h"
ac98b6
 #include "readproc.h"
d2bcc3
diff -ru procps-3.3.17.orig/proc/readproc.c procps-3.3.17/proc/readproc.c
d2bcc3
--- procps-3.3.17.orig/proc/readproc.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/proc/readproc.c	2022-11-06 23:57:14.382411315 +0100
d2bcc3
@@ -883,7 +883,7 @@
d2bcc3
 // warning: interface may change
d2bcc3
 int read_cmdline(char *restrict const dst, unsigned sz, unsigned pid) {
d2bcc3
     char path[PROCPATHLEN];
d2bcc3
-    snprintf(path, sizeof(path), "/proc/%u", pid);
d2bcc3
+    snprintf(path, sizeof(path), "/proc/syspid/%u", pid);
d2bcc3
     return read_unvectored(dst, sz, path, "cmdline", ' ');
d2bcc3
 }
d2bcc3
 
d2bcc3
@@ -1239,7 +1239,7 @@
d2bcc3
   }
d2bcc3
   p->tgid = strtoul(ent->d_name, NULL, 10);
d2bcc3
   p->tid = p->tgid;
d2bcc3
-  snprintf(path, PROCPATHLEN, "/proc/%s", ent->d_name);
d2bcc3
+  snprintf(path, PROCPATHLEN, "/proc/syspid/%s", ent->d_name);
d2bcc3
   return 1;
d2bcc3
 }
d2bcc3
 
d2bcc3
@@ -1253,7 +1253,7 @@
d2bcc3
       closedir(PT->taskdir);
d2bcc3
     }
d2bcc3
     // use "path" as some tmp space
d2bcc3
-    snprintf(path, PROCPATHLEN, "/proc/%d/task", p->tgid);
d2bcc3
+    snprintf(path, PROCPATHLEN, "/proc/syspid/%d/task", p->tgid);
d2bcc3
     PT->taskdir = opendir(path);
d2bcc3
     if(!PT->taskdir) return 0;
d2bcc3
     PT->taskdir_user = p->tgid;
d2bcc3
@@ -1266,7 +1266,7 @@
d2bcc3
   t->tid = strtoul(ent->d_name, NULL, 10);
d2bcc3
   t->tgid = p->tgid;
d2bcc3
 //t->ppid = p->ppid;  // cover for kernel behavior? we want both actually...?
d2bcc3
-  snprintf(path, PROCPATHLEN, "/proc/%d/task/%s", p->tgid, ent->d_name);
d2bcc3
+  snprintf(path, PROCPATHLEN, "/proc/syspid/%d/task/%s", p->tgid, ent->d_name);
d2bcc3
   return 1;
d2bcc3
 }
d2bcc3
 
d2bcc3
@@ -1277,7 +1277,7 @@
d2bcc3
   char *restrict const path = PT->path;
d2bcc3
   pid_t tgid = *(PT->pids)++;
d2bcc3
   if(likely(tgid)){
d2bcc3
-    snprintf(path, PROCPATHLEN, "/proc/%d", tgid);
d2bcc3
+    snprintf(path, PROCPATHLEN, "/proc/syspid/%d", tgid);
d2bcc3
     p->tgid = tgid;
d2bcc3
     p->tid = tgid;  // they match for leaders
d2bcc3
   }
d2bcc3
@@ -1677,7 +1677,7 @@
d2bcc3
     static char path[32];
d2bcc3
     struct stat statbuf;
d2bcc3
 
d2bcc3
-    snprintf(path, sizeof path, "/proc/%d", pid);
d2bcc3
+    snprintf(path, sizeof path, "/proc/syspid/%d", pid);
d2bcc3
     if (stat(path, &statbuf)) {
d2bcc3
         perror("stat");
d2bcc3
         return NULL;
d2bcc3
diff -ru procps-3.3.17.orig/proc/sysinfo.c procps-3.3.17/proc/sysinfo.c
d2bcc3
--- procps-3.3.17.orig/proc/sysinfo.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/proc/sysinfo.c	2022-11-06 23:53:23.999176866 +0100
d2bcc3
@@ -488,7 +488,7 @@
d2bcc3
     char c;
d2bcc3
 
d2bcc3
     if (!isdigit(ent->d_name[0])) continue;
d2bcc3
-    snprintf(tbuf, sizeof(tbuf), "/proc/%s/stat", ent->d_name);
d2bcc3
+    snprintf(tbuf, sizeof(tbuf), "/proc/syspid/%s/stat", ent->d_name);
d2bcc3
 
d2bcc3
     fd = open(tbuf, O_RDONLY, 0);
d2bcc3
     if (fd == -1) continue;
d2bcc3
diff -ru procps-3.3.17.orig/proc/wchan.c procps-3.3.17/proc/wchan.c
d2bcc3
--- procps-3.3.17.orig/proc/wchan.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/proc/wchan.c	2022-11-06 23:55:15.750410595 +0100
d2bcc3
@@ -32,7 +32,7 @@
d2bcc3
    ssize_t num;
d2bcc3
    int fd;
d2bcc3
 
d2bcc3
-   snprintf(buf, sizeof buf, "/proc/%d/wchan", pid);
d2bcc3
+   snprintf(buf, sizeof buf, "/proc/syspid/%d/wchan", pid);
d2bcc3
    fd = open(buf, O_RDONLY);
d2bcc3
    if (fd==-1) return "?";
d2bcc3
 
d2bcc3
diff -ru procps-3.3.17.orig/ps/output.c procps-3.3.17/ps/output.c
d2bcc3
--- procps-3.3.17.orig/ps/output.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/ps/output.c	2022-11-06 23:59:52.026412271 +0100
d2bcc3
@@ -1229,7 +1229,7 @@
d2bcc3
     int fd;
d2bcc3
     u_int32_t luid;
d2bcc3
 
d2bcc3
-    snprintf(filename, sizeof filename, "/proc/%d/loginuid", pp->tgid);
d2bcc3
+    snprintf(filename, sizeof filename, "/proc/syspid/%d/loginuid", pp->tgid);
d2bcc3
 
d2bcc3
     if ((fd = open(filename, O_RDONLY, 0)) != -1) {
d2bcc3
         num_read = read(fd, outbuf, OUTBUF_SIZE - 1);
d2bcc3
@@ -1255,7 +1255,7 @@
d2bcc3
     char filename[48];
d2bcc3
     ssize_t num_read;
d2bcc3
 
d2bcc3
-    snprintf(filename, sizeof filename, "/proc/%d/exe", pp->tgid);
d2bcc3
+    snprintf(filename, sizeof filename, "/proc/syspid/%d/exe", pp->tgid);
d2bcc3
 
d2bcc3
     num_read = readlink(filename, outbuf, OUTBUF_SIZE-1);
d2bcc3
     if (num_read > 0) {
d2bcc3
@@ -1371,7 +1371,7 @@
d2bcc3
 
d2bcc3
 // wchan file is suitable for testing
d2bcc3
 //snprintf(filename, sizeof filename, "/proc/%d/wchan", pp->tgid);
d2bcc3
-    snprintf(filename, sizeof filename, "/proc/%d/attr/current", pp->tgid);
d2bcc3
+    snprintf(filename, sizeof filename, "/proc/syspid/%d/attr/current", pp->tgid);
d2bcc3
 
d2bcc3
     if ((fd = open(filename, O_RDONLY, 0)) != -1) {
d2bcc3
       num_read = read(fd, outbuf, OUTBUF_SIZE-1);
d2bcc3
diff -ru procps-3.3.17.orig/pwdx.c procps-3.3.17/pwdx.c
d2bcc3
--- procps-3.3.17.orig/pwdx.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/pwdx.c	2022-11-07 00:00:51.339153405 +0100
d2bcc3
@@ -118,7 +118,7 @@
d2bcc3
 		 * the first char is possible
d2bcc3
 		 */
d2bcc3
 		if (argv[i][0] != '/')
d2bcc3
-			snprintf(buf, buflen, "/proc/%s/cwd", argv[i]);
d2bcc3
+			snprintf(buf, buflen, "/proc/syspid/%s/cwd", argv[i]);
d2bcc3
 		else
d2bcc3
 			snprintf(buf, buflen, "%s/cwd", argv[i]);
d2bcc3
 
d2bcc3
diff -ru procps-3.3.17.orig/skill.c procps-3.3.17/skill.c
d2bcc3
--- procps-3.3.17.orig/skill.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/skill.c	2022-11-07 00:00:34.811153304 +0100
d2bcc3
@@ -181,7 +181,7 @@
d2bcc3
 	if (pid == my_pid || pid == 0)
d2bcc3
 		return;
d2bcc3
 	/* pid (cmd) state ppid pgrp session tty */
d2bcc3
-	sprintf(buf, "/proc/%d/stat", pid);
d2bcc3
+	sprintf(buf, "/proc/syspid/%d/stat", pid);
d2bcc3
 	fd = open(buf, O_RDONLY);
d2bcc3
 	if (fd == -1) {
d2bcc3
 		/* process exited maybe */
ac98b6
diff -ru procps-3.3.17.orig/w.c procps-3.3.17/w.c
ac98b6
--- procps-3.3.17.orig/w.c	2021-02-09 11:11:25.000000000 +0100
d2bcc3
+++ procps-3.3.17/w.c	2022-11-04 15:46:20.305190037 +0100
ac98b6
@@ -55,11 +55,7 @@
ac98b6
 #include <termios.h>
ac98b6
 #include <time.h>
ac98b6
 #include <unistd.h>
ac98b6
-#ifdef HAVE_UTMPX_H
ac98b6
-#	include <utmpx.h>
ac98b6
-#else
ac98b6
-#	include <utmp.h>
ac98b6
-#endif
ac98b6
+#include <utmp.h>
ac98b6
 #include <arpa/inet.h>
ac98b6
 
ac98b6
 static int ignoreuser = 0;	/* for '-u' */