FAQ
How does the standard library cluster module pass a newly-opened file
descriptor from a parent process to a child process in a way that
allows the child process to accept(2) and not get EBADF?

I made it to src/tcp_wrap.cc and from there into libuv and then got lost.

I only care about Linux. Does it use the CLONE_FILES flag to
clone(2)? (I don't think it does because I can't find it in the source
code but this seems to me like the only sane way to accomplish this.)

I would greatly appreciate any explanation anyone can provide. Thanks,

Richard

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Search Discussions

  • Ben Noordhuis at Nov 28, 2012 at 8:13 pm

    On Wed, Nov 28, 2012 at 8:57 PM, Richard Crowley wrote:
    How does the standard library cluster module pass a newly-opened file
    descriptor from a parent process to a child process in a way that
    allows the child process to accept(2) and not get EBADF?

    I made it to src/tcp_wrap.cc and from there into libuv and then got lost.

    I only care about Linux. Does it use the CLONE_FILES flag to
    clone(2)? (I don't think it does because I can't find it in the source
    code but this seems to me like the only sane way to accomplish this.)
    The child process inherits one end of an socketpair(AF_UNIX) tuple and
    sendmsg() with CMSG_DATA() is used to send over file descriptors. The
    meat of the code is in uv__write() in src/unix/stream.c.

    By the way, if you have more libuv specific questions, there's a libuv
    mailing list: http://groups.google.com/group/libuv

    --
    Job Board: http://jobs.nodejs.org/
    Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    You received this message because you are subscribed to the Google
    Groups "nodejs" group.
    To post to this group, send email to nodejs@googlegroups.com
    To unsubscribe from this group, send email to
    nodejs+unsubscribe@googlegroups.com
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupnodejs @
categoriesnodejs
postedNov 28, '12 at 8:00p
activeNov 28, '12 at 8:13p
posts2
users2
websitenodejs.org
irc#node.js

2 users in discussion

Ben Noordhuis: 1 post Richard Crowley: 1 post

People

Translate

site design / logo © 2022 Grokbase