[sane-devel] RE: (Big?) Problem with fork() in OSX
Phil Barrett
phil at cambridgeanimation.com
Wed Dec 18 14:39:47 GMT 2002
> If the file descriptors aren't dup'ed, that should be fixed on MacOS
> and not SANE. That's one of the basic Unix functions and if it doesn't
> work, it's just not Unix.
>
> However, bugs in fork would harm a lot of other applications so I
> wonder if this is the real reason.
There are no bugs in fork() or with file descriptors (or at least, none
relevant to the current discussion). The problem is that Mac OS X IO access
is not (and indeed cannot be) made through file descriptors. The Darwin IO
libraries are another breed completely.
See
http://developer.apple.com/techpubs/macosx/Darwin/IOKit/DeviceInterfaces/SCS
IArchitectureModel/SAMDocPage.html
The problem is that after you call (*taskinferface->ObtainExclusiveAccess)()
a fork()ed thread is then denied access because the first thread has
exclusive access.
Phil
More information about the sane-devel
mailing list