From: Ævar Arnfjörð Bjarmason Date: Sun, 10 Oct 2010 19:40:28 GMT Subject: Re: [PATCH v3 14/14] daemon: only use posix features on posix systems Message-ID: In-Reply-To: <1286716854-5744-15-git-send-email-kusmabite@gmail.com> On Sun, Oct 10, 2010 at 13:20, Erik Faye-Lund wrote: > Windows does not supply the POSIX-functions fork(), setuuid(), setgid(), > setsid() and initgroups(). Disable support for --user, --group and > --detach on platforms lacking _POSIX_VERSION. FWIW I checked if Perl's fork() emulation with threads on Windows could emulate this, but no: perl -E ' if (my $pid = fork()) { say "$$: child running as $pid" } else { sleep 1; say "$$: running in the background" }' On Unix that would detach the process from the terminal, but on Windows with threads the original process only returns after the child has finished. I didn't expect it to act differently, but I thought I'd note it here in case anyone had it in mind to implement --detach on Windows. > This might be a bit controversial; does anyone know of any systems that > implements fork(), setuuid(), setgid() and setsid() but does not define > _POSIX_VERSION? Perhaps we should have a separate makefile-switch instead? Even if it's defined it's more self-documenting to have our own HAVE_POSIX_GOODIES (or something like that) instead.