Hi Andrew, On Wed, May 01, 2019 at 09:45:05AM +0800, Andrew Heberle wrote: > > https://skarnet.org/software/s6/notifywhenup.html > > At this stage the FD written to and closed is hard coded as fd@3 as I > have reached the end of my C expertise getting this far... >
It's not a good idea to write directly to an arbitrary FD, because it could be used for something else, it should be defined somewhere, either in the configuration, the command line or an environement variable. Maybe s6 provides an environment variable with the FD number? >From what I'm seeing in this example https://wiki.gentoo.org/wiki/S6#s6readiness you probably need an argument to your -Wn option so you can pass the FD. > Although it seems like it's not something that many people are hanging > out for based on the responses to a previous email to the list, I > thought I'd send the patch through as-is anyway. I never heard of s6 before, so I can't say :-) > + /* if -Wn mode was requested then open fd 3, write an arbritrary > line and close the fd */ > + if (global.tune.options & GTUNE_USE_S6_NOTIFY) { > + FILE *notifyfd; > + notifyfd = fdopen(3, "w"); > + fprintf(notifyfd, "UP\n"); > + fclose(notifyfd); > + } If the FD is already open you could do directly a write() to this FD. Please add your option in the documentation (management.txt). Cheers, -- William Lallemand

