Get process name w/o using argv[0] in C function?

Joel Jones jjones at casca.cs.uiuc.edu
Fri Aug 3 23:51:21 AEST 1990


One reason one may not be able to use a global is
if the function that needs the process name
may be a library that is linked in.  One way of
accomplishing the goal (though inefficient) is
to do a getpid(2), and then do a popen(3) with
an argument of "ps -p pid ..."

  Joel Jones
  jjones at uiuc.edu
--
Joel Jones     As the advertisment for an exhibition on Leonardo da Vinci said,
jones at uiuc.edu "They called him a genius, a botanist, a demon, a philosopher, a
                practical joker, an eccentric, and a visionary.  No wonder he 
                was such a great engineer."



More information about the Comp.unix.questions mailing list