From ce3bd4ec8a03142f3ecc95eb1937ff23fad6e4ff Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Wed, 6 Jan 2016 13:31:32 +0100 Subject: [PATCH] README: Update documentation for pidfile() fn Signed-off-by: Joachim Nilsson --- README.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6336d07..8d175a9 100644 --- a/README.md +++ b/README.md @@ -176,20 +176,24 @@ Generic Functions - `pidfile(basename)` - Write a daemon pid file. Creates a pidfile in `_PATH_VARRUN` using - either `basename` or, if `basename` is `NULL`, `__progname`. The - file name has the form `/var/run/basename.pid`. + Create a daemon PID file in `_PATH_VARRUN` using either `basename` or, + if `basename` is `NULL`, `__progname`. The file name has the form + `/var/run/basename.pid`. - Use this function to create a pid file for your daemon when it is + Use this function to create a PID file for your daemon when it is ready to receive signals. A client application may poll for the existence of this file, so make sure to have your signal handlers properly setup before calling this function. - + The pidfile is removed when the program exits, using an `atexit()` handler. However, depending on how the program terminates the file may still exist even though the program is no longer running. This is only a problem for clients. + Calling this function multiple times updates the mtime of the file. + Only one `atexit()` handler is created, regardless of the amount of + times the function is called. + See below for link to OpenBSD man page. - `pidfile_read(pidfile)`