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: question about mach ports and fork



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.

References: 
 >question about mach ports and fork (From: "Nathan T. Hjelm" <email@hidden>)
 >Re: question about mach ports and fork (From: Jim Magee <email@hidden>)
 >Re: question about mach ports and fork (From: "Nathan T. Hjelm" <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.