> On Fri, Mar 05, 2021 at 04:02:16AM -0500, Jeff King wrote: > > > I don't know offhand if this [bind in a child] trick actually works. ... On Fri, Mar 5, 2021 at 1:29 AM Jeff King <peff@xxxxxxxx> wrote: > I was curious, but this does indeed work: [working example snipped] Yes, it definitely works. The bind() call, on a Unix domain socket, creates a file system entity linked to the underlying socket instance. The file descriptors, in whatever processes have them, provide read/write/send/recv/etc linkage to the underlying socket instance (and also a refcount or other GC protection: with the ability to send sockets over sockets, simple refcounts stop working and we need real GC in the kernel...). Of course, once all the file descriptor references are gone, the socket (eventually, depending on GC) evaporates. The file system entity does not count for keeping the underlying socket alive. At this point the file system entity is "dead". Unfortunately there's no way to test and clean out the dead entity atomically. The whole thing is kind of a mess. Chris