On 03/13/2016 02:14 PM, Peter Scott wrote:
> On Sat, 12 Mar 2016 18:44:18 +0200, Lars Noodén wrote:
[snip]
>> What modification can prevent zombies yet allow multiple concurrent
>> clients to attach?
>
> You need the WNOHANG option on your wait() to make it nonblocking.
Thanks. I've been explori
On Sat, 12 Mar 2016 18:44:18 +0200, Lars Noodén wrote:
> The snippet below works to fork as a specific user, if run as root.
> However, it generates zombies. The functions wait() or waitpid() seem
> to be available to use to stop that, but if I insert either of them in
> the outer while loop, only
Thanks, David and Shlomi (and those that read),
I understand fork() and the style of writing better. Strange that the
defaults for 'use English' are not optimal.
The snippet below works to fork as a specific user, if run as root.
However, it generates zombies. The functions wait() or waitpid()
Hi Lars,
some comments on your code:
On Fri, 11 Mar 2016 20:22:34 +0200
Lars Noodén wrote:
> If I have the code below to fork a child process, how would the right
> way be to fork as a different user? I gather that fork() itself does
> not support that, so some other method must be used.
>
>
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256
Hello all.
AFAIK, you can't do that. When you fork everything is copied, including
the UID.
To achieve something similar, you need to launch another process (but
you'll need to be root to launch it as another user)
Regards,
David Santiago
On F
If I have the code below to fork a child process, how would the right
way be to fork as a different user? I gather that fork() itself does
not support that, so some other method must be used.
Regards,
Lars
-
#!/usr/bin/perl
use strict;
use warnings;
use English;# for $UID and such
my