|
#1
| |||
| |||
| command args missing in 'ps' output
I've found the output of 'ps' does not always contain all the command-line arguments that were passed to a given process. Specifically, if any of the arguments has the form "-xxx=yyy", that argument and all arguments that follow it are missing from the 'ps' output. The missing information screws up a script I'm using that pipes 'ps' to 'grep' and 'sed'. Presumably this script works in the Linux world, because that's where it was written. Is this a deliberate difference between BSD and Linux versions of 'ps', or is it just wacky like it seems to me? (Note: giving 'ps' the -ww option does not help. This is not about widening the output. It seems that information actually is missing from whatever data structure Unix uses to list processes.) Below is a code example that I submitted to Apple. I thought maybe folks here would know the answer offhand and could answer more quickly. --Andy ========== In one Terminal window, compile and run the enclosed C program as follows: <pre> % cc dud.c<br> % ./a.out foo bar -x=y blah frog</pre>In another Terminal window, do a 'ps': <pre> % ps -ax | grep a.out</pre> You'll get something like this: <pre> 386 p3 R+ 0:05.60 a.out foo bar</pre> Here's the C program (dud.c): Code: #include <stdio.h>
int main(int argc, char** argv)
{
int i;
printf("%d args were given\n", argc);
for (i = 0; i < argc; i++)
{
printf("arg[%d]: [%s]\n", i, argv[i]);
}
while (1)
{
// Do nothing forever -- use ^C to kill.
}
}
Last edited by snoozer; September 29th, 2001 at 12:08 PM. |
|
#2
| |||
| |||
|
FYI, this is definitely an Apple-specific problem; my OpenBSD machine shows all args just fine. May definitely be a ps bug.
|
|
#3
| ||||
| ||||
|
Heh, I wouldn't doubt it. I had a look at the source code they're using - it even has a variable named FIX_ME Bad thing is, it wasn't even defined in the ps source anywhere! |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| No sound output in OS X | Jeremy Lee | Mac OS X System & Mac Software | 0 | October 4th, 2002 07:31 AM |
| missing commands and other disasters | jakez | Unix & X11 | 4 | September 16th, 2002 10:25 AM |
| missing commands and other disasters | jakez | Unix & X11 | 0 | September 13th, 2002 12:50 AM |
| HW graphic acceleration was missing... | ddma | Apple News, Rumors & Discussion | 10 | April 21st, 2002 10:04 AM |
| UNIX related things... (tr, cut, awk, and permissions) | simX | Apple News, Rumors & Discussion | 5 | December 19th, 2001 03:33 AM |