![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| command line arguments | skooly5 | Shell Programming and Scripting | 1 | 04-07-2008 04:49 AM |
| i want to list all command line arguments except | naree | Shell Programming and Scripting | 3 | 03-31-2008 12:11 PM |
| arguments in command line | rrs | UNIX for Dummies Questions & Answers | 6 | 07-28-2006 07:44 AM |
| command line arguments | bankpro | High Level Programming | 3 | 02-02-2006 11:12 AM |
| Command Line Arguments | roba909 | UNIX for Dummies Questions & Answers | 7 | 01-19-2006 01:46 PM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Retrieving command line arguments of a particular PID
hi
The "ps" command shows the command line arguments of running processes: $ /bin/ps -o pid,args -e .... 26031 pico /tmp/crontab2KaG1Y 596 /usr/lib/sendmail -bd -q15m 9955 xterm -n 1 -sb -sl 800 -g 80+70+70 2627 /usr/sbin/snmpd -Lsd -Lf /dev/null -p /var/run/snmpd -a 1691 .... I need to write a C program to get the command line arguments of a particular process id, but do not want to rely on: system("/bin/ps -o pid,args -e"); --or-- popen("/bin/ps -o pid,args -e", "r"); On Solaris, the command line arguments of a running process are stored at: /proc/<pid>/psinfo On Linux, the command line arguments of a running process are stored at: /proc/<pid>/cmdline These two files are not text files, so I'm not sure how to read the contents. Where can I find example C code to read the contents of the "psinfo" and "cmdline" files? Thanks --Andrew |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|