I have one main program that communicates with three other processes. When this main process begins, I would like to know if the other three are running, if they are, then continue, if not, spawn() them. Is there any way of knowing what processes are running (such as pidin but in my code), without writing to a common log-file with process id’s.
I’d also like this option for limiting the number of instances that a process can run.
For finding your process, every Number in /proc (or PROC_BASE) defines one process, all you have to do is check which is yours
read openqnx.com/index.php?name=P … 7478#37478
I would have all other three processes advertise a distinct name in the name space by either name_attach() or resmgr_attach() - plenty of sample conde in the programmer’s guide. In your main program, you try to open the name. If it exists - fine, you immediatly know that the process runs and above all you already have the connection to it, which you would need anyway. If the open() fails - you spawn it, wait a while for it to start up, and open the name (which should succeed if the process came up correctly)
Or look at the HAM facilities.