News for hackers. Stuff that matters.
Re:File Descriptor Transfer over Unix Domain Sockets by thamer on Monday November 02, 2020 @03:39PM (#24972992)
See `ngx_write_channel` in `ngx_channel.c`[1]:

    cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int));
    cmsg.cm.cmsg_level = SOL_SOCKET;
    cmsg.cm.cmsg_type = SCM_RIGHTS;
    
    [...]
    
    ngx_memcpy(CMSG_DATA(&cmsg.cm), &ch->fd, sizeof(int));
    
    [...]
    
    n = sendmsg(s, &msg, 0);

edit: This article[2] also explains the way the master process sends commands to its workers.

[1] https://github.com/nginx/nginx/blob/2a81e0556611188a1b9b3e12...

[2] https://titanwolf.org/Network/Articles/Article?AID=6fb184f9-...

Re:File Descriptor Transfer over Unix Domain Sockets by bogomipz on Monday November 02, 2020 @06:13PM (#24974576)
Ah thanks, this second link is really great analysis of that part of the code base. Cheers!