Subject: bin/9819: procfs based ps(1) displays its infomation twice
To: None <gnats-bugs@gnats.netbsd.org>
From: NAKAJIMA Yoshihiro <nakayosh@kcn.ne.jp>
List: netbsd-bugs
Date: 04/07/2000 10:53:51
>Number: 9819
>Category: bin
>Synopsis: procfs based ps(1) displays its infomation twice
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 07 08:08:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: NAKAJIMA Yoshihiro
>Release: NetBSD-current 2000/04/05
>Organization:
>Environment:
System: NetBSD asura 1.4X NetBSD 1.4X (ASURA) #1: Thu Apr 6 20:31:06 JST 2000 nakayosh@asura:/usr/src/sys/arch/i386/compile/ASURA i386
>Description:
Procfs based ps(1) displays its infomation twice.
>How-To-Repeat:
% cp /bin/ps . # Clear sgid bit
% ./ps
ps: kvm_openfiles: /dev/mem: Permission denied
ps: falling back to /proc-based lookup
Warning: /proc does not provide valid data for all fields.
PID TT STAT TIME COMMAND
11915 01- ?<s 0:00.13 -tcsh
11925 01- ?< 0:00.04 ./ps
11925 01- ?< 0:00.04 ./ps
%
>Fix:
diff -u src/bin/ps/procfs_ops.c.ORIG src/bin/ps/procfs_ops.c
--- src/bin/ps/procfs_ops.c.ORIG Sat Oct 16 20:03:17 1999
+++ src/bin/ps/procfs_ops.c Fri Apr 7 22:57:24 2000
@@ -283,6 +283,8 @@
continue;
if (strcmp(dp->d_name, "curproc") == 0)
continue;
+ if (strcmp(dp->d_name, "self") == 0)
+ continue;
ki[knum].ki_p = &kp[knum];
if (parsekinfo(dp->d_name, &ki[knum]) != 0)
continue;
>Release-Note:
>Audit-Trail:
>Unformatted: