So the API would be - the thing that starts the daemon opens an fd N, the daemon accepts an argument "--ready-fd=N", daemon writes something to fd N when ready or just closes it
Well it has to write something (and in the current version of the protocol it requires a newline) before closing, else there would be no telling the difference between readiness and death - which aren't quite the same thing :) But yes, that's the idea. Closing is even optional, but since the supervisor is allowed to stop reading as soon as it detects a newline, it makes no sense to keep the fd open after writing the newline.
and the thing checking whether daemon is ready sees fd activity and starts things depending on the daemon?
Yes. In the s6 model, the thing checking that the daemon is ready is the supervisor, and it reports readiness to anything that has subscribed (typically the service manager), which can then act accordingly. -- Laurent
