Is getpid supposed to return PID-1?
Is getpid supposed to return PID-1?
- Subject: Is getpid supposed to return PID-1?
- From: "Kevin Bohan" <email@hidden>
- Date: Tue, 13 Nov 2001 14:29:56 +0000
Hi,
I have a BSD question and I apologise if this is not the right list, as this
is not really my area. However I have a daemon that writes its PID to an
external file when it starts up and I have a script that looks for this
file, extracts the PID in order to provide a commandline interface that
allows the process to be killed.
However, when I call getpid to write the PID to the text file it always
seems to write a value that is 1 less than the PID shown when I use ps to
view the process in question. Also if I call kill on the value returned by
getpid it tells me that the process doesn't exist. It would seem that ps is
right an getpid is wrong.
I can obviously just add one to the value returned by getpid, but is this
safe/future-proof? Is this a known issue? What should I do?
Kirby
_________________________________________________________________
Get your FREE download of MSN Explorer at
http://explorer.msn.com/intl.asp