From 331b54742623cd498687a9d449d9900de7a0045b Mon Sep 17 00:00:00 2001 From: albert <> Date: Sat, 31 May 2003 15:18:13 +0000 Subject: [PATCH] message: mount -t proc none /proc --- proc/readproc.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/proc/readproc.c b/proc/readproc.c index 52f60024..e3d9448a 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -719,14 +719,13 @@ next_proc: /* get next PID for consideration */ void look_up_our_self(proc_t *p) { - static char path[32], sbuf[1024]; /* bufs for stat,statm */ - sprintf(path, "/proc/%d", getpid()); - file2str(path, "stat", sbuf, sizeof sbuf); - stat2proc(sbuf, p); /* parse /proc/#/stat */ - file2str(path, "statm", sbuf, sizeof sbuf); - statm2proc(sbuf, p); /* ignore statm errors here */ - file2str(path, "status", sbuf, sizeof sbuf); - status2proc(sbuf, p); + char sbuf[1024]; + + if(file2str("/proc/self", "stat", sbuf, sizeof sbuf) == -1){ + fprintf(stderr, "Error, do this: mount -t proc none /proc\n"); + _exit(47); + } + stat2proc(sbuf, p); // parse /proc/self/stat } HIDDEN_ALIAS(readproc);