Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I have spent tone of time when was trying to do this. But no result. </p> <p>The best result that I was able to get is getting list of running application both active and background (actually list of running process):</p> <pre><code>-(void) listOfProcesses { int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0}; size_t miblen = 4; size_t size; sysctl(mib, miblen, NULL, &amp;size, NULL, 0); int st; struct kinfo_proc * process = NULL; struct kinfo_proc * newprocess = NULL; do { size += size / 10; newprocess = realloc(process, size); if (!newprocess){ if (process){ free(process); } } process = newprocess; st = sysctl(mib, miblen, process, &amp;size, NULL, 0); } while (st == -1 &amp;&amp; errno == ENOMEM); if (st == 0){ if (size % sizeof(struct kinfo_proc) == 0){ int nprocess = size / sizeof(struct kinfo_proc); if (nprocess){ for (int i = nprocess - 1; i &gt;= 0; i--){ NSLog(@"Pid: %d, Process name: %@",process[i].kp_proc.p_pid,process[i].kp_proc.p_comm); } free(process); } } } </code></pre> <p>}</p> <p>In this list there are several system process, but there is no problem to sort them.</p> <p>For mo information please see this manual:</p> <ul> <li><a href="http://developer.apple.com/library/ios/#documentation/System/Conceptual/ManPages_iPhoneOS/man5/manpages.5.html" rel="nofollow">http://developer.apple.com/library/ios/#documentation/System/Conceptual/ManPages_iPhoneOS/man5/manpages.5.html</a></li> </ul> <p>This is list of Unix System call. This may be helpful.</p> <p>Hope it helps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload