IRC channel logs

2025-08-20.log

back to list of logs

<jfred>Been trying to figure out if there's a way in Guile to spawn a new process with a file descriptor already present in its fd table. I.e... I know you can send fds over an existing unix socket, but if you're the parent process, is there a way to bestow an initial socket fd upon a child process you're creating without having to use the filesystem?
<jfred>It seems possible to do with `primitive-fork` although it also seems like I'd have to be very very careful with that, haha
<jfred>`spawn` (the non-goblins one) seems to have a safer API but doesn't seem like it can do it
<jfred>(yes this is in the context of potentially doing shenanigans with shepherd and the unix socket server)
<jfred>oh, shepherd's `exec-command` takes an `extra-ports` param... hmmm
<jfred>Okay yeah I think it should be possible to have a Shepherd service (+ Guix service) for the unix domain socket server that can accept a socket FD via a Shepherd action, and then a custom Shepherd start procedure that creates a socket pair, gives one end of it to the new process via a well-known FD, and gives the other end to the intro server
<jfred>I *think*
<jfred>would avoid the need for the filesystem here too https://codeberg.org/spritely/goblins/src/branch/main/examples/unix-domain-socket-server.scm#L24
<jfred>anyway, lunch break's over, no more hax for me until later ^^;
<cwebber><3