Thread (43 messages) flat view 43 messages, 5 authors, 2016-06-15

Re: [PATCH v3 14/14] daemon: only use posix features on posix systems

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:49:45

On Sun, Oct 10, 2010 at 13:20, Erik Faye-Lund [off-list ref] 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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help