Bug 508701 - "ps -e" does not show nscd (but "ps ax" does)
"ps -e" does not show nscd (but "ps ax" does)
Status: CLOSED DUPLICATE of bug 490010
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: glibc (Show other bugs)
5.3
All Linux
low Severity medium
: rc
: ---
Assigned To: Andreas Schwab
qe-baseos-tools
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-29 10:38 EDT by Matteo Corti
Modified: 2016-11-24 10:39 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-02-02 12:03:32 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Matteo Corti 2009-06-29 10:38:04 EDT
Description of problem:

ps -e -o comm or (ps axo comm) are not showing all the processes

Version-Release number of selected component (if applicable):

procps-3.2.7-11.1.el5

How reproducible:

Always. Start nscd and search for it with ps -e -o comm: the process is not listed (although running).
The very same works without any problem on Fedora

Steps to Reproduce:
1. start nscd (service nscd start)
2. check that nscd is running using BSD syntax (ps ax | grep nscd)
3. check that nscd is running using standard syntac (ps -e | grep nscd)
  
Actual results:

$ ps -e | grep nscd
$ 

Expected results:

$ ps -e | grep nscd
14175 ?        00:00:03 nscd
$

Additional info:

The same command works without problems on Fedora (F11, procps-3.2.7-27.fc11.i586)
Comment 1 Matteo Corti 2009-06-30 10:17:37 EDT
After further investigation I found out that the entry in /proc for ntsc is strange:

RH5 $ cat /proc/PID/stat

28793 (exe) S 1 28793 28793 0 -1 4202816 2918 0 0 0 22 253 0 0 15 0 7 0 37808079 115728384 798 4294967295 7360512 7463540 3214996912 3214995252 4903938 0 0 3674112 16391 4294967295 0 0 17 1 0 0 0

tcomm is exe instead of nscd
/proc/PID/exe is a link to /usr/sbin/nscd

ps reads 'exe' and lists exe with the 'comm' argument

This does not happen on Fedora:

F11 $ cat /proc/PID/stat

14175 (nscd) S 1 14175 14175 0 -1 4194624 37521 0 5 0 467 1853 0 0 20 0 12 0 1878751 153812992 310 4294967295 1843200 1977488 3219997600 3219991756 6214692 0 0 3674112 16390 4294967295 0 0 17 0 0 0 0 0 0

Here tcomm corresponds to 'nscd'

Now: ist this a bug of ps that when exe is encountered should follow /proc/PID/exe or is it a kernel problem and 'exe' in tcomm field is wrong?
Comment 2 Albert Cahalan 2009-06-30 15:10:05 EDT
It's possible that nscd called prctl to change the name to exe.
Use strace to find out.

If not, this appears to be a kernel bug.
Comment 3 Matteo Corti 2009-07-07 01:41:08 EDT
Ok figured out, it is an nscd problem. nscd does:

  execv ("/proc/self/exe", argv);

which changes the name to exe

This does not occur on Fedora as there nscd tries to read the symlink and use the real name:

  /* Try to exec the real nscd program so the process name (as reported
     in /proc/PID/status) will be 'nscd', but fall back to /proc/self/exe
     if readlink fails */
  ssize_t n = readlink ("/proc/self/exe", pathbuf, sizeof (pathbuf) - 1);
  if (n == -1)
    execv ("/proc/self/exe", argv);
  else
    {
      pathbuf[n] = '\0';
      execv (pathbuf, argv);
    }

Thanks
Comment 4 Subhendu Ghosh 2009-10-23 12:44:14 EDT
Thanks for the update.
Moving to glibc component as nscd is part of glibc

Note You need to log in before you can comment on or make changes to this bug.