I'm wondering how Activity Monitor
relates these two process if the child (Safari Web Content) doesn't have the ppid
of the main one (Safari). pstree
, which uses the ppid
to organize the tree, shows no relation between them.
Here's another example, caffeinate
was launched from a shell script inside BetterTouchTool
using nohup
, and again pstree
doesn't show any relation.
Actually what I need is to send a kill
signal to "childs" like Safari Web Content
using shell script
or C
api knowing only the "Safari" pid
. And I think this might help.
Best Answer
The Safari "child" processes are actually children of the init system (
launchd
which has PID1
) which explains whypstree
or other such unix tools cannot make use of the usual parent pid (or process group) relation:Instead you will need to use an Apple API; the
launchctl
utility indicates that the "domain" or "ASID" may be relevant:But let's post this info before testing what something like
launchctl kill ...
does.(Also note the above is from Mac OS X 10.11.6, the interfaces may have been changed by Apple since then.)