iOS进程信息(pid,uid,cpu,mem等) [英] iOS Processes Info (pid, uid, cpu, mem, ...)

查看:232
本文介绍了iOS进程信息(pid,uid,cpu,mem等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写Mac中类似System Activity的应用程序.我使用了上的经过修改的darwin.h和darwin.c主题. 但是似乎它只显示某些字段的正确信息(一段时间前,它显示所有正确的信息,但仅显示当前进程-此应用程序),对于其他所有内容,它仅显示正确的pid,进程名称,组/所有者.其他所有东西(如cpu/mem/disk用法)都为空.我认为这可能与沙箱或安全性有关.试图将应用程序移至/Applications并设置root/wheel 755,但它不起作用,仍将值清零.

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.

这是我的输出:单击

在darwin.c中更改了代码:单击,在许多带注释的printf行之后编写了

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

此外,AppStore中还批准了免费的应用程序,例如SystemInfo(com.lymbilesoft.systeminfoliteforiphone),其中显示了有关磁盘和进程的详细信息,那么它如何工作?尝试过nm-ing它是二进制的,但没有发现有用的东西. 有人可以帮我吗?

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?

推荐答案

我不确定这是否是 only 问题,但是您的应用肯定有可能需要以使其正常工作.

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.

但是,只需将应用程序安装在/Applications中,执行chown root.wheelchmod 755不会导致它像root一样运行.它仍将以用户mobile的身份运行.

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.

为了使该应用以root的身份运行,请查看此答案

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

我已经成功使用了此技术,如果您有一部越狱的手机,则可以导航至/Applications/Cydia.app并查看此启动脚本也是Cydia的操作方式.

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.

这篇关于iOS进程信息(pid,uid,cpu,mem等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆