The documentation for kill says that if I use a signal of 0, no signal
is sent but the pid is still checked for validity.
To me this means that kill should return -1 and errno should contain
ESRCH if the pid does not exist when kill( pid, 0 ) is used.
This does not occur! kill returns 0 and errno is not set.
Any ideas?
Thanks
Gregor
I reply to myself 
Just to clear up what I’m trying to do. I want to ensure that a process
I started is still running without resorting to sending it ‘are you ok’
messages.
Gregor
Gregor Brandt wrote:
The documentation for kill says that if I use a signal of 0, no signal
is sent but the pid is still checked for validity.
To me this means that kill should return -1 and errno should contain
ESRCH if the pid does not exist when kill( pid, 0 ) is used.
This does not occur! kill returns 0 and errno is not set.
Any ideas?
Thanks
Gregor
Again to myself :-\
kill() does not return -1 even if I try to send a real signal to a
non-existent pid.
Gregor
Gregor Brandt wrote:
I reply to myself > 
Just to clear up what I’m trying to do. I want to ensure that a process
I started is still running without resorting to sending it ‘are you ok’
messages.
Gregor
Gregor Brandt wrote:
The documentation for kill says that if I use a signal of 0, no signal
is sent but the pid is still checked for validity.
To me this means that kill should return -1 and errno should contain
ESRCH if the pid does not exist when kill( pid, 0 ) is used.
This does not occur! kill returns 0 and errno is not set.
Any ideas?
Thanks
Gregor
Ok, I finally figured it out.
The problem was that I was spawning the process with the NO_WAIT flag.
This flag allows the parent proc to get a return value from the child.
What the docs don’t say is that the child hangs around waiting to return
that value! So the pid would never be bad, it would simply be
(unavailable). Using the NO_WAITO flag in spawn did the job perfectly.
Thanks to Eric Johnson for answering privately and showing that it
should work!
Gregor
Gregor Brandt wrote:
Again to myself :-\
kill() does not return -1 even if I try to send a real signal to a
non-existent pid.
Gregor
Gregor Brandt wrote:
I reply to myself > 
Just to clear up what I’m trying to do. I want to ensure that a
process I started is still running without resorting to sending it
‘are you ok’ messages.
Gregor
Gregor Brandt wrote:
The documentation for kill says that if I use a signal of 0, no
signal is sent but the pid is still checked for validity.
To me this means that kill should return -1 and errno should contain
ESRCH if the pid does not exist when kill( pid, 0 ) is used.
This does not occur! kill returns 0 and errno is not set.
Any ideas?
Thanks
Gregor