in reply to Killing wayward children

You could kill INT, $pid; which is like hitting Ctrl-C. If the child is already gone, the signal will not be delivered to an unrelated process with the same pid. That shouldn't be a problem, anyway, if you are handling SIGCHLD.

Update: Re diotalevi's question, kill fails with EPERM if the real or effective uid of the sender is not root or the same as that of the $pid addressed. See 'man 2 kill'. It is true that one of the user's own processes could reacquire the child pid. That is why the SIGCHLD handler should arrange to note the death of $pid, so the issue of misdelivery never comes up.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re^2: Killing wayward children
by diotalevi (Canon) on Nov 17, 2002 at 13:53 UTC

    Color me confused. So of the two parts, delivery and execution let me know where I'm off base. Does the INT not get sent to the non-child PID or is the INT somehow not honored by the non-child of the same pid? And how is this different from using kill(1) from the command line where it doesn't matter whether the process is a child or not. I did a quick read of kill from perlfunc and Signals from perlipc and I didn't see anything about INT not being sent to non-child processes. So what's the scoop here, how did you come up with that?

    Update: then I wasn't wrong. Unstated was the assumption that normal user control functions so you can only kill your own processes. It's just unlikely that a given user ends up with another process at the same UID, not actually prohibited some how.

    __SIG__ use B; printf "You are here %08x\n", unpack "L!", unpack "P4", pack "L!", B::svref_2object(sub{})->OUTSIDE;
Re: Re: Killing wayward children
by SpaceAce (Beadle) on Nov 17, 2002 at 12:48 UTC
    That sounds about like what I'm looking for. Thanks.

    SpaceAce
    s>>sp>;s>..|>\u$&ace>g;print;