From: ts Date: 2004-09-01T23:58:01+09:00 Subject: Re: ruby-dev summary 24054-24170 >>>>> "D" == Daniel Berger 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