A few years ago, we wrote an application that should control the use of resources by several processes. This was during the time of the snow leopard. The ps command line command had more than enough of what we needed, so we got a copy of the source code for ps and found out what functions they called and why, and then used the similar calls used in ps for the basis of our project, but ours was written in Objective-C, not C. It was not a copy of ps , we just based code modeling on how ps got the core of information. This worked great from Snow Leopard to Yosemite.
Enter El Capitan mode without root. What works does not work anymore. We initially blew it off because we watched the beta versions of El Capitan, and even the ps itself showed similar behavior. Over time, ps started working under El Capitan, but not our code.
When we launch our application, it can provide general information, such as the name of the process and pid for all processes, but on any processes that the user does not actually βuseβ for use in memory and CPU, and zeros for his reports. It seems that they are reporting this appropriately about the processes that the user owns / starts.
Looking at the log files, an unbridled error is of the following type:
System Policy: deny (1) man-priv-task-port
The above appears on El Capitan 10.11.2. Previous versions of the OS indicated problems with the fact that task_for_pid "not resolved" or something like that (I do not have old log files available right now).
Looking at the new ps source code, I believe that the following .plist file is now included with the developer. This was not in code from years ago:
http://www.opensource.apple.com/source/adv_cmds/adv_cmds-163/ps/entitlements.plist
Here is a link to the El Capitan ps code for those interested:
http://www.opensource.apple.com/source/adv_cmds/adv_cmds-163/ps/
My question is quite simple, what do I need to do so that the system allows us to use task_for_pid() again, or, maybe even better, the best way to get this information from the kernel without running into problems without root mode, FYI, if rootless is disabled, that's it in our current application works fine. In appearance of this plist file, it looks like they sign it and provide access to the function, but is this an "apple" tutorial?
FWIW our source code was compiled using gcc with the old-fashioned make file.