Doubt about processes in language c

Asked

Viewed 84 times

0

I would like to know of some library in c, that can serve me to create a program that sees the running processes... system("ps"), I would like to see if a program is running and if it is not, then run it.

Oh and windows. h does not fit, I will use in Linux.

  • C is not the most suitable for such, are you sure even that it needs to be in C? Of all the luck, I believe that it must have some /dev/... with the processes that are running. Just open for reading this "file"

  • Tah beauty was worth

1 answer

1

Directories /proc/n (where n is a number) contain information about the running processes.

Assuming a process with pid 1234, the file /proc/1234/cmdline is a text file that contains the command line that originated the process.

  • Gee, thanks. I knew about proc but I’d never seen the cmdline. It helped me a lot

Browser other questions tagged

You are not signed in. Login or sign up in order to post.