Hi Simon, > Glibc has a 'daemon' function, which is from BSD, however it is not > documented in the glibc manual [1] and it is not in POSIX. > [1] http://sourceware.org/bugzilla/show_bug.cgi?id=12251
There are many more functions in glibc that are not documented in texinfo format. But it's documented in /usr/include/unistd.h; that's sufficient to rely on it. > Mike noticed that InetUtils is using it: > > http://thread.gmane.org/gmane.comp.gnu.inetutils.bugs/3040/focus=3041 > > This begs the question of whether using the 'daemon' interface is a good > idea or not. It appears to be a Unix classic. The portmapper, sshd, cvsd use it, certainly among others. I see nothing wrong with it. There's even a package that wraps a shell command 'daemonize' around it: git://github.com/bmc/daemonize.git > I see two approaches: > > 1) Regard the 'daemon' interface as broken, and let InetUtils call a > different function, e.g., 'daemonize', and implement it in InetUtils > (which already contains an implementation, so that is easy). > > 2) Consider the 'daemon' interface as working, and provide a gnulib > module for it so that it can be used interoperable. What other indications do you have that the interface is "broken"? The only problem I can see is that the typical implementations call fork() once or twice - and therefore there is a portability problem with respect to native Windows platforms (mingw). I think it's a good candidate for a gnulib module nevertheless. Bruno
