Next: , Up: posix lock-pid-files   [Index]


4.30.1 Introduction to PID files

A lock PID file is a textual file in ASCII encoding created at process start time and deleted at process exit time; it contains a string representing the PID number of the current process followed by a newline character.

The lock PID file is especially useful whenever a server is executed as daemon:

The lock PID file must be created after a server daemonisation process has completed: this way we correctly store the PID of the daemon process, rather than the PID of the starting process.

The lock PID file must be created after a process has changed its user and group IDs to drop special privileges: this way the file is created with appropriate owner and group.

All the operations performed by this library are logged; logging operations related to the lock PID file rely on a function handed as argument.