ps showing [appname] for some things -- how to get whole thing?

Chad Leigh -- Shire.Net LLC chad at shire.net
Thu Mar 8 07:21:33 UTC 2007


On Mar 7, 2007, at 11:34 AM, Chuck Swiger wrote:

> On Mar 7, 2007, at 2:49 AM, Chad Leigh -- Shire.Net LLC wrote:
>> On my 6.1 system I have a script that launches some java programs  
>> [jdk142] and when I do a "ps -auxwww" I get the whole java command  
>> line that was used in launching.
>>
>> On my 6.2 system with jdk15 teh scame scripts launch the same java  
>> programs but I just get [java] in the ps output.  Nothing in the  
>> ps manpage jumped out at me.  I would like to be able to get the  
>> whole commandline when I do the ps
>
> From the manpage:
>
>      When printing using the command keyword, a process that has  
> exited and
>      has a parent that has not yet waited for the process (in other  
> words, a
>      zombie) is listed as ``<defunct>'', and a process which is  
> blocked while
>      trying to exit is listed as ``<exiting>''.  If the command  
> vector cannot
>      be located (usually because it has not been set, as is the  
> case of system
>      processes and/or kernel threads) the command name is printed  
> within
>      square brackets.  The ps utility makes an educated guess as to  
> the file
>      name and arguments given when the process was created by  
> examining memory
>      or the swap area.  The method is inherently somewhat  
> unreliable and in
>      any event a process is entitled to destroy this information,  
> so the names
>      cannot be depended on too much.  The ucomm (accounting)  
> keyword can, how-
>      ever, be depended on.
>
> In other words, the process is allowed to over-write the  
> environment (aka, the command line args & exported env variables)  
> and that will prevent ps from reliably returning that info.  All  
> you can be sure of it getting argv[0], which is used for accounting  
> in the ucomm variable....

It turns out the difference between my two installations is that with  
the jdk142 procfs is also mounted and ps shows the complete command.   
On the server with jdk15 procfs is not mounted and does not.  jdk15  
also has an issue if procfs is mounted such that the java command  
does not work.  But I am running inside a jail so I could mount  
procfs on the base server outside the jail and do ps there and test  
this.  These tests show that the procfs makes the difference.

Chad

---
Chad Leigh -- Shire.Net LLC
Your Web App and Email hosting provider
chad at shire.net





More information about the freebsd-questions mailing list