Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Retrieving process information without using ps



On Aug 2, 2006, at 3:46 PM, Greg Parker wrote:

Terry Lambert writes:
On Aug 2, 2006, at 1:01 PM, Greg Parker wrote:
Terry Lambert wrote:
(1) fork

(2) obtain the task port in the child, prior to execve (the child has
self rights)


(3) send the port from the child to the parent process (the parent
can
then use the port)

How does this part work? I can't figure out how to get a communication
channel from the child to the parent that can transfer a port right.

You have to send it in a Mach message; specifically, access rights to a port are granted to a task by sending a "send right" or "receive right" message to the task you want to be able to use the port;

Yes, I understand that. But how does the child send a Mach message
to the parent? How does it get a send right for a port for which the parent
owns the receive right? As far as I can tell, the child doesn't have the
parent's task port, nor any other port the parent had before fork().

You create a bootstrap port (see launchd source code, bootstrap.c).

See also:

<http://ftp.wayne.edu/pub/gnu/Manuals/machinfo/html_node/mach_20.html#SEC19 >

For how port rights get Exchanged (I only gave you the 50,000 foot view previously).

-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden
References: 
 >Re: Retrieving process information without using ps (From: Terry Lambert <email@hidden>)
 >Re: Retrieving process information without using ps (From: Greg Parker <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.