In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Jerry Levan) wrote:

> Regrettably sysctl does not give access to table info in the kernel.

Source code and commentary:

   http://developer.apple.com/qa/qa2001/qa1123.html

You can get a list of all BSD processes, which includes daemon processes, 
using the BSD sysctl  routine. Code for doing this is shown in Listing 1. 
When using this code you should note the following.

    * The returned kinfo_proc structures contain a huge amount of 
information about the process, including the process ID (in kp_proc.p_pid) 
and the process name (in kp_proc.p_comm).
    * As far as BSD is concerned all Classic applications run within a 
single process.
    * You do not need any special privileges to make this sysctl; any user 
can get a list of all processes on the system.
    * The UNIX Programming FAQ lists a number of alternative ways to do 
this. Of these, the only approach that works on Mac OS X is exec'ing the ps 
command line tool. exec'ing ps will require parsing the tool's output and 
will not use system resources as efficiently as Listing 1.

-- 
Chris Nandor                      [EMAIL PROTECTED]    http://pudge.net/
Open Source Development Network    [EMAIL PROTECTED]     http://osdn.com/

Reply via email to