Re: Bug in kill?

Arvind Sankar (arvinds@mit.edu)
Thu, 18 Mar 1999 23:03:08 -0500


On Thu, Mar 18, 1999 at 04:03:36PM -0800, rich-paul@rich-paul.net wrote:
> There seems to be a bug in kill ... or it's a documentation bug, I'm not
> sure which.
>
> As I undertstand it,
>
> kill(pid,0) should return 0 only if process #pid exists ... however, it
> seems to be returning 0 no matter what ... so one can't use it to test
> the existance of a process. :(
>
> This would be useful when starting a daemon, among other things ... read
> the .pid file, and if kill(pid,0) returns an ESRCH, then just delete the
> file, since the process is no longer running.
>
> Is my reading wrong?

no. your code might be. It certainly does return -1 and sets errno = ESRCH
here. (kernel 2.2.3, glibc2.1).

-- arvind

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/