I use Network Kernel Extension to filter sockets. I want to monitor the actual UI of that process when a particular connection comes in.
However, the pid of the process that created the socket is different from the pid of the process that shows the actual UI.
For Safari, the pid of the process that created the socket is WebKit.Networking.xpc,
The process that shows the UI is Safari.app, and the process responsible for each tab is WebKit.WebContent.xpc.
However, the ppid for all these processes is all 1.
I can not find an association between these processes.
I want to know the pid of WebKit.WebContent.xpc that is responsible for the UI when the socket is created and the connection is made in WebKit.Networking.xpc.
But I can not find the association between the two processes.
Is there a way to get this information through system programming? Does the API or command line tool exist?
Activity Monitor knows the hierarchy of Safari(family) and classifies them into a group.
How can I know that information?
Like Safari, xfreerdp, a program for Windows remote access, is different from the process pid responsible for the network and the process responsible for the UI(XQuartz.app).
However, since there is no association between the two processes, it is difficult to find the pid of the process responsible for the UI.
I want to know how to find this information programmatically.
Thank you for any information.
Activity Monitor knows the hierarchy of Safari(family) and classifies them into a group. How can I know that information?
Unfortunately you can’t. I researched this a while back as part of a DTS incident (s. 600057819). The system has a ‘responsibility’ mechanism that it uses to track these relationships, and there’s no public API for that facility.
If you’d like to see this made public in the future, I encourage you to file an enhancement request describing your requirements. It’s likely that your bug will get dup’d to another bug (r. 14860959) but it’s still worthwhile filing your own bug beacuse it allows you to express your needs in your own terms, and allows macOS engineering to gauge the level of demand.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"