[OT] remove process or file [was Re: [plug] funny process name]

Cameron Patrick cameron at patrick.wattle.id.au
Tue Sep 30 17:55:02 WST 2003


On Tue, Sep 30, 2003 at 04:14:46PM +0800, James Devenish wrote:
| it is highly unlikely that any POSIX-compliant kernel will actually
| pass such a signal to any process (at least not as part of "kill",
| though I have not read the spec).

You are correct, at least in the case of Linux.  A test program:

#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <unistd.h>

void handle_signal(int sig)
{
        printf("boo! signal %d\n", sig);
}

int main()
{
        signal(0, &handle_signal);
        signal(1, &handle_signal);
        kill(getpid(), 0);
        kill(getpid(), 1);
        return 0;
}

Output:
	boo! signal 1

But it does test for process existence:

$ kill -0 12345
bash: kill: (12345) - No such process

Cheers,

Cameron.

_______________________________________________
plug mailing list
plug at plug.linux.org.au
http://mail.plug.linux.org.au/cgi-bin/mailman/listinfo/plug


More information about the plug mailing list