Re: Is getpid supposed to return PID-1?
On Tuesday, November 13, 2001, at 06:29 AM, Kevin Bohan wrote: 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 You have a bug in your daemon. Care to post code for us to look at and find it? --Umesh -- Umesh Vaishampayan Apple Computer, Inc. Mac OS X Kernel Ph: (408) 974 0229
participants (1)
-
Umesh Vaishampayan