iOS Processes Info (pid, uid, cpu, mem, …)

六月ゝ 毕业季﹏ 提交于 2019-12-12 15:18:15

问题


I'm writing app like System Activity in Mac. I used modified darwin.h and darwin.c from this topic. But it seems that it shows correct info only for certain fields (and some time ago it showed all correct info but only for current process - this app), for everything else it shows correct only pid, process name, group/owner. Everything else like cpu/mem/disk usage is nulled. I think it may be something with sandbox or security. Tried to move application to /Applications and setting root/wheel 755 but it's not work, still zeroed values.

Here's my output : click

Code changed in darwin.c : click, written after a lot of commented printf lines

Also there is a free apps approved in AppStore like SystemInfo (com.lymbilesoft.systeminfoliteforiphone) that shows detailed info about disk and processes, so how do it work? Tried nm-ing it's binary but did not find something useful. Can someone please help me with it?


回答1:


I'm not sure if this is the only problem, but it certainly is possible that your app needs to run as root for this to work correctly.

However, simply installing the app in /Applications, doing chown root.wheel, and chmod 755 will not cause it to run as root. It will still run as user mobile.

In order to get the app to run as root, see this answer

I've used this technique successfully, and if you have a jailbroken phone, you can navigate to /Applications/Cydia.app and see that this launch script is how Cydia does this, too.




回答2:


I use ps aux from the Terminal/Command Line. That gives me all the stuff I need, regarding your concerns.



来源:https://stackoverflow.com/questions/13579775/ios-processes-info-pid-uid-cpu-mem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!