ts <decoux / moulon.inra.fr> wrote in message news:<200409011457.i81Evs608529 / moulon.inra.fr>...
> >>>>> "D" == Daniel Berger <djberg96 / hotmail.com> writes:
> 
> D> For those operating systems (e.g. Solaris) that don't have the
> D> daemon() function, what about calling umask(0) and normalizing the
> D> PATH?
> 
>  source of *BSD
> 
> 
> int
> daemon(int nochdir, int noclose)
> {
>         int fd;
> 
>         switch (fork()) {
>         case -1:
>                 return (-1);
>         case 0:
>                 break;
>         default:
>                 _exit(0);
>         }
> 
>         if (setsid() == -1)
>                 return (-1);
> 
>         if (!nochdir)
>                 (void)chdir("/");
> 
>         if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
>                 (void)dup2(fd, STDIN_FILENO);
>                 (void)dup2(fd, STDOUT_FILENO);
>                 (void)dup2(fd, STDERR_FILENO);
>                 if (fd > 2)
>                         (void)close (fd);
>         }
>         return (0);
> }
> 
> 
> 
> Guy Decoux

So, are you saying that we don't need it, or that the daemon()
function is incomplete? ;)

I guess we just have to remember to do it on our own then.

Dan