[Crash-utility] Re: Patch to include -f option to display commadline args with ps command of crash.

Dave Anderson anderson at redhat.com
Mon Jan 7 15:58:30 UTC 2008


Hariharan S Reddy wrote:
> Hi Dave,
> 
> I am here with submitting the patch to incorporate -f option to carsh ps
> command. Which will display as same as ps command with command line
> arguments.


...and which basically duplicates the current capability of the "ps -a" option,
which does its best to gather the full command line along with the task's
environment variables.

The problem is that it depends upon accessing user-space memory which may
not be available, i.e., either swapped out or configured out of the dumpfile 
entirely.  That makes the output really ugly -- for example on the live
system that I'm running on:

crash> ps -f
    PID    PPID  CPU   TASK    ST  %MEM     VSZ    RSS  COMM
       0      0   0  c066d3c0  RU   0.0       0      0  [swapper]
       0      1   1  c148e550  RU   0.0       0      0  [swapper]
       1      0   1  c148eaa0  IN   0.1    2040    564  init [5]
       2      1   0  c148e000  IN   0.0       0      0  [migration/0]
       3      1   0  c14a0aa0  IN   0.0       0      0  [ksoftirqd/0]
       4      1   0  c14a0550  IN   0.0       0      0  [watchdog/0]
       5      1   1  c14a0000  IN   0.0       0      0  [migration/1]
       6      1   1  c14adaa0  IN   0.0       0      0  [ksoftirqd/1]
       7      1   1  c14ad550  IN   0.0       0      0  [watchdog/1]
       8      1   0  c14ad000  IN   0.0       0      0  [events/0]
       9      1   1  dff63aa0  IN   0.0       0      0  [events/1]
      10      1   1  dff63550  IN   0.0       0      0  [khelper]
      11      1   0  dff63000  IN   0.0       0      0  [kthread]
      15     11   0  dff31aa0  IN   0.0       0      0  [kblockd/0]
      16     11   1  dff31550  IN   0.0       0      0  [kblockd/1]
      17     11   1  dff31000  IN   0.0       0      0  [kacpid]
      96     11   0  dff4b550  IN   0.0       0      0  [cqueue/0]
      97     11   1  dff4b000  IN   0.0       0      0  [cqueue/1]
     100     11   0  dff09550  IN   0.0       0      0  [khubd]
     102     11   0  dff13550  IN   0.0       0      0  [kseriod]
     163     11   0  dfe0a550  IN   0.0       0      0  [pdflush]
     164     11   1  dfe0a000  IN   0.0       0      0  [pdflush]
     165     11   0  dfe0daa0  IN   0.0       0      0  [kswapd0]
     166     11   0  dfe0d550  IN   0.0       0      0  [aio/0]
     167     11   1  dfe0d000  IN   0.0       0      0  [aio/1]
     331     11   0  dfe02aa0  IN   0.0       0      0  [kpsmoused]
     362     11   0  dfeb8000  IN   0.0       0      0  [ata/0]
     363     11   1  dfeb8550  IN   0.0       0      0  [ata/1]
     364     11   0  dfeb8aa0  IN   0.0       0      0  [ata_aux]
     380     11   0  dfea4550  IN   0.0       0      0  [ksnapd]
     383     11   0  dfbf1550  IN   0.0       0      0  [kjournald]
     416     11   1  dfe53aa0  IN   0.0       0      0  [kauditd]
     450      1   1  dff03000  IN   0.1    2944    404  /sbin/udevd -d
     896     11   0  df2ae000  IN   0.0       0      0  [kedac]
    1558     11   0  dde7faa0  IN   0.0       0      0  [kmpathd/0]
    1559     11   1  ddccd000  IN   0.0       0      0  [kmpathd/1]
    1583     11   0  de2f9000  IN   0.0       0      0  [kjournald]
    1970      1   0  dfbfbaa0  IN   0.1    2288    528  /sbin/dhclient -1 -q -lf 
/var/lib/dhclient/dhclient-eth0.l
eases -pf /var/run/dhclient-eth0.pid eth0
    2022      1   0  dd42daa0  IN   0.1   12076    552  ps: cannot access user 
stack address: bfc30ec5

    2023      1   0  dddfe000  IN   0.1   12076    552  ps: cannot access user 
stack address: bfc30ec5

    2024   2022   0  ddfc8000  IN   0.4   10096   2096  python /sbin/audispd
    2039      1   1  ddd52000  IN   0.1   10080    372  ps: cannot access user 
stack address: bfb0eeff

    2050      1   1  de788000  IN   0.1    1700    532  ps: cannot access user 
stack address: bf877f11

    2053      1   0  de1ba000  IN   0.1    1656    388  klogd -x
    2065      1   1  df1ef000  IN   0.1    2412    332  irqbalance
    2081      1   0  de15b000  IN   0.1    2136    440  mcstransd
    2094      1   0  dfe64550  IN   0.1    1788    572  portmap
    2107      1   1  ddb6aaa0  RU   1.1   41628   5576  ps: cannot access user 
stack address: bff97ee0

    2128      1   1  dfebd000  IN   0.1    1940    712  ps: cannot access user 
stack address: bf8b4f10

    2165      1   1  dddfeaa0  IN   0.1    5400    380  ps: cannot access user 
stack address: bfd6ef05

    2184      1   1  dddfe550  IN   0.2   13216   1300  dbus-daemon --system
    2185      1   0  dfea4aa0  IN   0.2   13216   1300  dbus-daemon --system
    2223      1   0  ddb0aaa0  IN   0.2   53728    940  pcscd
    2238      1   1  de1ba550  IN   0.2   53728    940  pcscd
    2255      1   1  dfbf5550  IN   0.1    1888    344  ps: cannot access user 
stack address: bfa6ff07

    2274      1   1  ddaf4550  IN   1.1   41628   5576  ps: cannot access user 
stack address: bff97ee0

    2275      1   1  dd79baa0  IN   1.1   41628   5576  ps: cannot access user 
stack address: bff97ee0

    2281      1   0  dfbf1aa0  IN   0.1   24376    380  ps: cannot access user 
stack address: bfea7f19

    2282      1   1  dd629550  IN   0.1   24376    380  ps: cannot access user 
stack address: bfea7f19

    2284      1   0  ddb6a550  IN   0.1   24376    380  ps: cannot access user 
stack address: bfea7f19

    2305      1   0  de1baaa0  IN   0.2   18948   1296  automount
    2306      1   0  dd9ad550  IN   0.2   18948   1296  automount
    2307      1   1  dece8000  IN   0.2   18948   1296  automount
    2310      1   0  ddb6a000  IN   0.2   18948   1296  automount
    2313      1   0  df2ae550  IN   0.2   18948   1296  automount
    2314      1   1  de75d550  IN   0.2   18948   1296  automount
    2315      1   0  dfebdaa0  IN   0.2   18948   1296  automount
    2316      1   0  df2aeaa0  IN   0.2   18948   1296  automount
    2327      1   0  de07b000  IN   0.1    1652    424  ps: cannot access user 
stack address: bf806f0a

    2338      1   0  de21d550  IN   0.1    5068    300  ps: cannot access user 
stack address: bf94af1a

    2343      1   1  dfbf5000  IN   0.2   13192   1224  ps: cannot access user 
stack address: bfd07efe

    2358      1   1  dff09000  IN   0.1    6148    576  ps: cannot access user 
stack address: bfc57f0d

    2369      1   1  dd79b550  IN   0.3    9880   1628  ps: cannot access user 
stack address: bfd7df14

    2383      1   0  ddaf4000  IN   0.8    4448   4448  ntpd -u ntp:ntp -p 
/var/run/ntpd.pid -g
    2404      1   1  df1efaa0  IN   0.2    9032    968  sendmail: accepting connecti
    2413      1   1  dfbf5aa0  IN   0.1    8084    724  ps: cannot access user 
stack address: bf990ee8

    2425      1   1  dff13aa0  IN   0.1    1876    276  ps: cannot access user 
stack address: bf9fbefe

    2436      1   0  de21d000  IN   0.1    5240    708  crond
    2467      1   0  de07baa0  IN   0.2    4044    960  xfs -droppriv -daemon
    2488      1   0  dd414000  IN   0.1    2220    340  ps: cannot access user 
stack address: bfc30f10
...

Not to mention that it violates the 80-column output that I try to
enforce with most commands.

Dave



> 
> Sample output of normal ps in crash
> crash> ps
> PID    PPID  CPU       TASK        ST  %MEM     VSZ    RSS  COMM
>       0      0   0       33a4c8       RU   0.0       0      0  [swapper]
>       0      1   1       f85a718      RU   0.0       0      0  [swapper]
>    2357      1   0       e8575c8      IN   0.1   11320    344  dbus-daemon
>    2358      1   1       ede30f0      IN   0.1   11320    344  dbus-daemon
>    2394      1   0       e87aa18      IN   0.2   75280    496  automount
>    2395      1   0       eea2718      IN   0.2   75280    496  automount
>    2396      1   1       fa4d7c8      IN   0.2   75280    496  automount
>    2399      1   0       eec6ff0      IN   0.2   75280    496  automount
>    2402      1   1       ee3b7c8      IN   0.2   75280    496  automount
>    2415      1   0       e9a6818      IN   0.0    7200     44  sshd
>    2425      1   0       eea0a18      IN   0.5   94944   1396
> setroubleshootd
>    2426      1   1       ede2340      IN   0.5   94944   1396
> setroubleshootd
>    2427      1   0       ee06140      IN   0.0   64452     28  cupsd
>    2446      1   0       fa336c8      IN   0.2   10464    476  sendmail
>    2456      1   0       ee3b0f0      IN   0.2    9320    416  sendmail
>    2468      1   0       ee5f5c8      IN   0.1   58628    188  crond
>    2491      1   1       ef417c8      IN   0.0    4516     80  xfs
>    2513      1   0       e8fe340      IN   0.1    2548    200  atd
>    2525      1   1       e982340      IN   2.7   87636   7112  yum-updatesd
> 
> Sample output of ps -f in crash
> crash> ps -f
>  PID    PPID  CPU       TASK        ST  %MEM     VSZ    RSS  COMM
>       0      0   0       33a4c8       RU   0.0       0      0  [swapper]
>       0      1   1       f85a718      RU   0.0       0      0  [swapper]
>     1914      2   0       ee054c8      IN   0.0       0      0  [kjournald]
>    2210      1   1       fab4040      IN   0.1   10300    280  auditd
>    2211      1   0       e8ff7c8      IN   0.1   10300    280  auditd
>    2212   2210   1       eea34c8      IN   0.4   65244    992  python
> /sbin/audispd
>    2213      2   1       ee5cdf0      IN   0.0       0      0  [kauditd]
>    2227      1   0       e878ff0      IN   0.0   15544     84
> /usr/sbin/restorecond
>    2237      1   1       fa26140      IN   0.1    1976    188  syslogd -m 0
>    2240      1   1       eec55c8      IN   0.0    1908     16  klogd -x
>    2255      1   0       ef434c8      IN   0.1    2468    248  mcstransd
>    2267      1   0       f980818      IN   0.0    2088     12  portmap
>    2282      1   1       e854718      IN   0.5   94944   1396
> /usr/bin/python -E /usr/sbin/setroubleshootd
>    2302      1   0       e9e90f0      IN   0.0    2096     16  rpc.statd
>    2332      2   0       f96e718      IN   0.0       0      0  [rpciod/0]
>    2333      2   1       ee5e818      IN   0.0       0      0  [rpciod/1]
>    2340      1   1       ef40340      IN   0.0    6256     52  rpc.idmapd
>    2357      1   0       e8575c8      IN   0.1   11320    344  dbus-daemon
> --system
>    2358      1   1       ede30f0      IN   0.1   11320    344  dbus-daemon
> --system
>    2394      1   0       e87aa18      IN   0.2   75280    496  automount
>    2395      1   0       eea2718      IN   0.2   75280    496  automount
>    2396      1   1       fa4d7c8      IN   0.2   75280    496  automount
>    2399      1   1       eec6ff0      IN   0.2   75280    496  automount
>    2402      1   1       ee3b7c8      IN   0.2   75280    496  automount
>    2415      1   0       e9a6818      IN   0.0    7200     44
> /usr/sbin/sshd
>    2425      1   0       eea0a18      IN   0.5   94944   1396
> /usr/bin/python -E /usr/sbin/setroubleshootd
>    2426      1   1       ede2340      IN   0.5   94944   1396
> /usr/bin/python -E /usr/sbin/setroubleshootd
>    2427      1   0       ee06140      IN   0.0   64452     28  cupsd
>    2446      1   0       fa336c8      IN   0.2   10464    476  sendmail:
> accepting connecti
>    2456      1   0       ee3b0f0      IN   0.2    9320    416  sendmail:
> Queue runner at 01:00:00 for /var/spo
>    2468      1   0       ee5f5c8      IN   0.1   58628    188  crond
>    2491      1   1       ef417c8      IN   0.0    4516     80  xfs
> -droppriv -daemon
>    2513      1   0       e8fe340      IN   0.1    2548    200
> /usr/sbin/atd
>    2525      1   1       e982340      IN   2.7   87636   7112
> /usr/bin/python /usr/sbin/yum-updatesd
> 
> COMM will be with command line arguments.
> 
> Patch : (See attached file: crash-ps-f-opt.patch)
> 
> Regards
>                                                                             
>  Hariharan T.S.                                                             
>  System Software Engineer,                                                  
>  zSeries - Red Hat Enterprise Linux,                                        
>  India Software Lab - IBM Systems & Technology Group,                       
>  Embassy Golf Links Business Park, Bangalore, INDIA                         
>  Direct +91-80-4177-7545                                                    
>  e-mail: hariharan.ts at in.ibm.com                                            
>  India Software Lab                                                         
>                                                                             




More information about the Crash-utility mailing list