I would like to find out if a process is running. I DO NOT want to use any system(“”) commands. Is there any C based function that lets you know if a process is running?
I would like to provide the process name and want to know if it’s running.
Thanks,
Sure, use
kill(2):So just call
kill(pid, 0)on the process ID of the process that you want to check for and see if you get an error (ESRCH).