tdihp tdihp - 15 days ago 5
Linux Question

tracking all child process spawned by a root process

I'm inspecting a certain make system that runs compilers. I want to track all child processes ever spawned by such a "root" process.

I'm aware there's the

command and as I'm a Python user, the
package. But I'm not sure if I'll miss some short lived processes between the calls.

I think what I really want is something like
in Python), but instead of tracking directory, it tracks all child process activity.

Is there such a system call, or preferably, package of Python, that does this?

Thanks in advance.


sttace can provide that info. But you may have to parse the output to get just the info you are interested in.

strace -f -e trace=process <executable>

That will trace all child processes of <executable> and will trace only the process related syscalls (essentially wait, fork, clone and exec).