Thread: unix C api to get pid by passin a process name
i writin application in c++ in thread needs check whether process runnin or not ( based on need further work ).
there c api provided unix similar getpid takes process name , return me pid?
dont want make system call system( ps -a | grep <process name) since might slow application.
suggest.
to best of knowledge, there no c library function call can use query whether process running.
of course, can check using "ps -ef", , have output directed readable stream, using popen(). seems wanted avoid that.
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk unix C api to get pid by passin a process name
Ubuntu
Comments
Post a Comment