Reference for proper handling of PID file



Howdy all,

Where can I find a well-respected reference that details the proper
handling of PID files on Unix?

I know about the concept of a PID file (a locking protocol for
programs as well as a PID API for the process holding the lock), and
some of the various issues that need to be resolved: how to actually
lock the file, platform incompatibilities, handling stale locks, when
exactly to acquire and release the lock, and so forth. These have many
solutions, each with their own merits and downsides.

The FHS briefly mentions PID files but without the above issues
<URL:http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA>.

What I can't find is a good reference on expected or “good citizen”
behaviour for how a program that uses PID files should handle them well.

Where can I find a respected, most-authoritative reference (ideally on
the level of W. Richard Stevens, or as close as possible) for this
small topic?

--
\ “Pinky, are you pondering what I'm pondering?” “Well, I think |
`\ so (hiccup), but Kevin Costner with an English accent?” —_Pinky |
_o__) and The Brain_ |
Ben Finney
.



Relevant Pages

  • Reference for proper handling of PID file
    ... Where can I find a well-respected reference that details the proper ... handling of PID files on Unix? ... how to actually lock the file, ... behaviour for handling PID files. ...
    (comp.unix.programmer)
  • Re: Reference for proper handling of PID file
    ... There is no general standard for PID files. ... knowing how best to check the lock. ... be stale. ...
    (comp.unix.questions)
  • Re: Reference for proper handling of PID file
    ... There is no general standard for PID files. ... knowing how best to check the lock. ... be stale. ...
    (comp.unix.questions)
  • Re: fopen question
    ... the acquisition of a lock. ... The other will be lost when the program closes it. ... FreeBSD uses the following code to reliably lock pid files and the like: ... but it's relies on flock, which is neither Cnor POSIX. ...
    (comp.std.c)
  • Re: Reference for proper handling of PID file
    ... Where can I find a well-respected reference that details the proper ... handling of PID files on Unix? ...
    (comp.unix.questions)