On Wed, Sep 1, 2010 at 4:20 AM, Dave Keck <davek...@gmail.com> wrote:
>> descriptors are open. On OS X, you could read the contents of /dev/fd/
>> to accomplish the same thing. It appears that NSTask uses the uglier
>> getdbtablesize() loop though.
>
> Neat, I wasn't aware of /dev/fd. Are the necessary APIs
> async-signal-safe so they can be used between fork()/exec()?

Good question. I couldn't find a way to list the contents of that
directory using only safe APIs. You'd have to do it by execing a small
helper and then reading its output, which is terrible, or by execing a
small helper that can both close all open descriptors AND then exec
the thing you really want to exec. Unless there's some way to list the
contents of a directory that I couldn't find.

> Apparently getdbtablesize() isn't even documented as being so; in the
> strictest sense then, I guess you'd have to use you'd have to use
> INT_MAX. Hah.

I'm going to guess that the set of async signal safe calls is somewhat
larger than documented.... Should probably file a bug against NSTask
just in case, though. :)

Mike
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to