问题描述
我正在使用越狱应用程式,并且想要传送 SIGKILL
讯息至可能在使用者装置上执行的特定应用程式(当然是他们的允许) 。
I'm working on a jailbreak app, and want to send SIGKILL
messages to specific apps that may be running on a user's device (with their permission, of course).
Google对我来说没有什么。是否有plist或数组来跟踪正在运行的进程?
Google is not turning up anything for me. Is there a plist or array that keeps track of running processes?
感谢您可以给予的任何帮助,您真棒!
Thanks for any help you all can give, you're wonderful!
推荐答案
创建sysctl API并检索kinfo_proc结构。此结构具有有关正在运行的进程的信息。您可以在循环中运行它,直到获取有关所有进程的信息。这是一个代码片段 - 扩展它以获取所有进程的信息
Make a sysctl API and retrieve the kinfo_proc structure http://fxr.watson.org/fxr/source/sys/kinfo.h?v=DFBSD. This struct has information about running processes.You can run it in a loop until to get info about all processes. Here is a code snippet- extend it to get info of all processes
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_ALL;
mib[3] = 0;
ret = sysctl(mib, 4, NULL, &size, NULL, 0);
procs = malloc(size);
ret = sysctl(mib, 4, procs, &size, NULL, 0); /* procs is struct kinfo_proc.*/
这篇关于返回iOS中运行的后台应用/进程的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!