Re: question about mach ports and fork
Re: question about mach ports and fork
- Subject: Re: question about mach ports and fork
- From: Mike Smith <email@hidden>
- Date: Wed, 21 Jan 2004 23:49:49 -0800
On Jan 21, 2004, at 3:37 PM, Nathan T. Hjelm wrote:
about IOService, however. You can't just open a new IOKit service
connection in the child? This is sometimes impossible because the
parent was privileged and the child not (so I feel your pain).
I have tried to open a new connection to iokit with the child process
by
calling IOCreateMasterPort again but I get the same result as when I
didn't.
What do you mean by this?
In your forked child, you have to obtain the new master port, then
re-lookup
the device(s) you're interested in. You can't just get "a new master
port".
As a general rule, you shouldn't expect to be able to do anything much
useful after forking unlesss you're sticking to the basic BSD/POSIX
APIs;
as Jim's pointed out, most of the other frameworks depend on at-exec
initialisation that can't be successfully reproduced later.
If you know you haven't changed working directory, re-execing argv[0]
with a 'magic' argument is simple enough.
= Mike
_______________________________________________
darwin-kernel mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/darwin-kernel
Do not post admin requests to the list. They will be ignored.