----- I am submitting this for someone who did not know about this list (they are joining )---TIA---rhc
Subject: C question
The problem is this: within the Oracle space, on Tru64 we check for processes using the ps command.
Sometimes, it misses processes, tells us they are not there when in fact they are.
We have coded around this by trying it more than once with a delay if we get a missing process.
So we were looking for other ways to get process information, and we wound up looking at the /proc filesystem.
So I cobbled together a small program from pieces I found here and there. It prints the pid, and two fields from the procfs.h prpsinfo structure, pr_fname and pr_psargs.
V4.x ---> This compiles and runs fine on a v4 machine.
V5.x -->it compiles and runs on a v5 machine, but does not display all the information expected in the psargs field
IE on a v4 machine the output looks like:
# ./getcmdline/getcmdline98
1 init /sbin/init -a
9 kloadsrv /sbin/kloadsrv
27 vold /sbin/vold
70 update /sbin/update
195 syslogd /usr/sbin/syslogd
199 binlogd /usr/sbin/binlogd
384 portmap /usr/sbin/portmap
389 mountd /usr/sbin/mountd -i
391 nfsd /usr/sbin/nfsd -t8 -u8
393 nfsiod /usr/sbin/nfsiod 7
396 rpc.statd /usr/sbin/rpc.statd
398 rpc.lockd /usr/sbin/rpc.lockd
480 xntpd /usr/sbin/xntpd -g -c /etc/ntp.conf
485 sendmail sendmail: accepting connections on
5309 emacs /freeware/bin/emacs -g 80x32 -fg gold -bg firebrick -cr lightblue getcmdline.c
6160 ksh -ksh
6462 doit_on.exp expect -- bin/tnet decedidb_odr_dr
6558 telnetd telnetd
9470 more more /var/upgrade_guide.txt
13467 sh sh -c DB_RPT_HOME=/usr/users/db_rpts;export DB_RPT_HOME;/usr/users/db_rpt/bin
13484 doit_on.exp expect -- /usr/users/db_rpt/bin/doit_on ne_o_prod /usr/users/db_rpt/doitcmds
18276 doit_on.exp expect -- /usr/users/db_rpt/bin/doit_on _prod /usr/users/db_rpt/doitcmd
22870 getcmdline98 /usr/users/tomas/getcmdline/getcmdline98
On a v5 machine the output looks like:
xxddbs_expect_doit : ./getcmdline98
524288 kernel idle
524289 init /sbin/init
524290 kproc_creator_da
524291 icssvr_nomem_dae
524292 icssvr_throttle_
524293 icssvr_daemon_fr
524294 icssvr_daemon_fr
524295 icssvr_nanny
524296 icscli_throttle_
524297 icssvr_daemon_fr
524298 icssvr_daemon_fr
524299 icssvr_daemon_fr
524300 icssvr_daemon_fr
524301 icssvr_daemon_fr
524302 CFS daemon
524303 icssvr_daemon_pe
524304 icssvr_daemon_pe
524305 icssvr_daemon_pe
524307 kloadsrv /sbin/kloadsrv
524309 hotswapd /sbin/hotswapd
524387 esmd /usr/sbin/esmd
524398 update /sbin/update
524514 evmd /usr/sbin/evmd
524587 evmlogger /usr/sbin/evmlogger
524588 evmchmgr /usr/sbin/evmchmgr
524754 niffd /usr/sbin/niffd
524788 syslogd /usr/sbin/syslogd
524792 binlogd /usr/sbin/binlogd
529620 icssvr_daemon_pe
529621 icssvr_daemon_pe
529622 icssvr_daemon_pe
529623 icssvr_daemon_fr
529625 icssvr_daemon_pe
529627 icssvr_daemon_fr
529628 icssvr_daemon_fr
529629 icssvr_daemon_fr
529630 icssvr_daemon_fr
529643 icssvr_daemon_pe
620931 telnetd telnetd
620932 csh -csh
620952 csh -csh
621291 getcmdline98 ./getcmdline98
562469 saposcol /usr/sap/XXD/SYS/exe/run/saposcol
563789 icssvr_daemon_pe
563844 tnslsnr /oracle/XXD/817_64/bin/tnslsnr
563850 oracle ora_pmon_XXD
563852 oracle ora_dbw0_XXD
563854 oracle ora_lgwr_XXD
563856 oracle ora_ckpt_XXD
563858 oracle ora_smon_XXD
563860 oracle ora_reco_XXD
563862 oracle ora_arc0_XXD
563917 perl5.6.0 perl
563921 perl5.6.0 perl
563925 perl5.6.0 perl
564339 sapstart /usr/sap/XXD/SYS/exe/run/sapstart
564348 msg_server ms.sapXXD_DVEBMGS01
564349 disp+work dw.sapXXD_DVEBMGS01
564350 rslgcoll co.sapXXD_DVEBMGS01
564371 disp+work dw.sapXXD_DVEBMGS01
564372 disp+work dw.sapXXD_DVEBMGS01
564373 disp+work dw.sapXXD_DVEBMGS01
564382 oracle oracleXXD
564384 oracle oracleXXD
564386 oracle oracleXXD
564388 oracle oracleXXD
C Code: sent as attachment
Received on Thu Apr 04 2002 - 04:54:58 NZST