From: Delepine Jean Charles > On Sun, 21 Apr 1996, David S. Miller wrote: > > > > > format of /proc/$pid/stat has changed in 1.3.91 > Here's what I seen : (with procps0.99a) > zulte:~$ ps -t1 > PID TTY STAT TIME COMMAND > Segmentation fault > zulte:~$ ps -at1 > PID TTY STAT TIME COMMAND > 70 1 S 0:00 -bash > 2289 1 S 0:03 pine > zulte:~$ uname -a > Linux zulte 1.3.91 #9 Thu Apr 18 17:29:52 MET DST 1996 i586 > > Is there a new patched procps available somewhere ? The following patch fixed the SEGV problem for me, and it made "ps -t" work the "right" way: diff -ru orig/procps-0.99a/proc/devname.c build/procps-0.99a/proc/devname.c --- orig/procps-0.99a/proc/devname.c Wed Jan 17 19:47:13 1996 +++ build/procps-0.99a/proc/devname.c Tue Apr 23 01:10:40 1996 @@ -43,8 +43,13 @@ many-to-one: -1 on failed match. */ dev_t name_to_dev(char* name) { - static struct stat sbuf; - return (stat(name_to_path(name), &sbuf) < 0) ? -1 : sbuf.st_rdev; + struct stat sbuf; + if (*name) { /* use named tty */ + if (stat(name_to_path(name), &sbuf) < 0) return -1; + } + else if (fstat(0, &sbuf) < 0) return -1; /* use current tty */ + if (!S_ISCHR(sbuf.st_mode)) return -1; + return sbuf.st_rdev; } /* find m in a[] assuming a is sorted into ascending order */ diff -ru orig/procps-0.99a/proc/readproc.c build/procps-0.99a/proc/readproc.c --- orig/procps-0.99a/proc/readproc.c Sun Feb 25 02:31:32 1996 +++ build/procps-0.99a/proc/readproc.c Mon Apr 22 02:41:02 1996 @@ -186,7 +186,7 @@ T x = (X), *l = (L); \ int i = 0, n = (N); \ while (i < n && l[i] != x) i++; \ - l[i] == x; \ + i < n && l[i] == x; \ } ) /* readproc: return a pointer to a proc_t filled with requested info about the diff -ru orig/procps-0.99a/ps.c build/procps-0.99a/ps.c --- orig/procps-0.99a/ps.c Sat Feb 24 21:50:04 1996 +++ build/procps-0.99a/ps.c Tue Apr 23 01:06:19 1996 @@ -244,7 +244,7 @@ fprintf(stderr, "the name `%s' is not a tty\n", CL_ctty); exit(1); } - pflags = (pflags | PROC_TTY) & ~PROC_ANYTTY; + pflags = (pflags | PROC_TTY) & ~(PROC_ANYTTY|PROC_STAT|PROC_UID|PROC_PID); args = tty; } show_procs(cmdspc, do_header, pflags, args, N); -- Michael "Tired" Riepe "Beware the storm that gathers here!" (The Prophet's Song)