process name from process id

Mike Hoffman mhoffman at infocenter.UUCP
Sat Jul 1 05:30:31 AEST 1989


in article <157 at cerc.wvu.wvnet.edu.edu>, kannan at cerc.wvu.wvnet.edu (R. Kannan) says:
< Xref: gould comp.unix.questions:12137 comp.unix.wizards:14115
< 
< The main objective is to get the program file name that resulted
< in the process.
< 
< some_unknown_function ( getpid () ) => should return the name of the program
< file that resulted int he calling process.

Forgive me if I'm being dense, but isn't argv[0] the name of the called
program??

If you use getpid() you must be looking for the identity of the program
currently running, not some arbitrary process, so why not just set
program_name = argv[0] ??

                    Michael J. Hoffman          
                    Manufacturing Engineering  
                    Encore Computer Corporation
UUCP: {uunet,codas!novavax,sun,pur-ee}!gould!mhoffman        Melbourne, Fl 32935
"My opinions are my own and are not to be employed with those of my confuser."



More information about the Comp.unix.questions mailing list