Command line information of another process

Hi to all you gurus,

I want to implement a ‘sin’-like process listing of running processes.
sin displays the process names along with the command line they were
started with, for example “Net.ether1000 -i7 -l2 -v” Currently I see no
way to obtain the command line information ("-i7 -l2 -v" in the above
example) of a process. How does sin get this information?

Is there an official way or does sin some tricky internals?

thanks

chris

Hi Chris,

Seeing as you addressed your posting to “gurus” I probably shouldn’t be
answering it, but anyway…

I have found that when it comes to trying to access information of this sort
knowledge seems to be pretty thin on the ground. I don’t know how to get
this information elegantly via a direct function call either (the _psinfo
struct does not appear to contain this data) and yet both “sin” and “ps”
obviously get it from somewhere.

I have a workaround for you but I would only suggest using it if you’re
desperate as it’s a little ugly.

  1. Create a temporary file.
  2. Using the “system( )” call, redirect or pipe the formatted ouptut of
    “sin” or “ps” into the temporary file.
  3. Read in the output from the temp. file and extract the necessary data.
    You can do this in any number of ways; a hand-coded parse routine, a simple
    lex generated scanner or whatever.

I said it wasn’t pretty but it can provide you with the info. you need.
Now , as you said earlier, can any real gurus tell us which rock this data
is hidden under??

Cheers,

Liam Power.

“chris” <sscanf@usa.net> schrieb im Newsbeitrag
news:3B138ADC.34988694@usa.net

Hi to all you gurus,

I want to implement a ‘sin’-like process listing of running processes.
sin displays the process names along with the command line they were
started with, for example “Net.ether1000 -i7 -l2 -v” Currently I see no
way to obtain the command line information ("-i7 -l2 -v" in the above
example) of a process. How does sin get this information?

Is there an official way or does sin some tricky internals?

thanks

chris