• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: sharing file descriptors to an NSTask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sharing file descriptors to an NSTask


  • Subject: Re: sharing file descriptors to an NSTask
  • From: Dave Keck <email@hidden>
  • Date: Wed, 1 Sep 2010 01:33:02 -0400

Indeed NSTask closes open descriptors in the child. I could have sworn
this was documented somewhere, but I can't seem to find the relevant
text at the moment.

To get around this behavior (and other NSTask bugs and shortcomings),
I chose to write my own NSTask equivalent. Alternatively, you could
use sendmsg() and friends to share the descriptor with the child over
a Unix domain socket, but depending on what type of descriptor you'd
be sharing, that might defeat the purpose.

Off topic 1: The last I checked, the open-source Cocoa clones
(GNUstep, Cocotron) emulate this descriptor-closing functionality of
NSTask, which reinforces my belief that this was documented
somewhere...

Off topic 2: It's strange behavior in the first place, since AFAIK,
there's no efficient way of closing open descriptors short of for(i =
3; i < getdtablesize(); i++) close(i);
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: sharing file descriptors to an NSTask
      • From: Michael Ash <email@hidden>
References: 
 >sharing file descriptors to an NSTask (From: Scott Ribe <email@hidden>)

  • Prev by Date: Re: where are the CALayer struts and springs on iPhone?
  • Next by Date: Re: sharing file descriptors to an NSTask
  • Previous by thread: sharing file descriptors to an NSTask
  • Next by thread: Re: sharing file descriptors to an NSTask
  • Index(es):
    • Date
    • Thread