Update pidfile() documentation

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-01-08 15:16:00 +01:00
1 parent 3555af6a6a
commit 9105e8d3d8
1 file changed
+13 -11
+13 -11
View File
@@ -231,11 +231,13 @@ Generic Functions
with the `dst` name. On successful operation the source is removed with the `dst` name. On successful operation the source is removed
and the function returns POSIX OK (0). and the function returns POSIX OK (0).
- `pidfile(basename)` - `pidfile(name)`
Create a daemon PID file in `_PATH_VARRUN` using either `basename` or, Create a daemon PID file using either the `name` as a full path, if
if `basename` is `NULL`, `__progname`. The resulting file name is `name` starts with `/`, or in `_PATH_VARRUN` using `name` as the
available to the user as a read-only pointer: basename of the application. If `name` is `NULL`, then `__progname`
is used as the basename. The resulting file name is available to the
user as a read-only pointer:
extern char *__pidfile_name; extern char *__pidfile_name;
@@ -246,14 +248,14 @@ Generic Functions
The PID file is removed when the program exits, using an `atexit()` The PID file is removed when the program exits, using an `atexit()`
handler. However, depending on how the program terminates the file handler. However, depending on how the program terminates the file
may still exist even though the program is no longer running. This may still exist even though the program is no longer running.
is only a problem for clients.
Calling this function multiple times updates the mtime of the file. Calling this function multiple times updates the mtime of the file.
Only one `atexit()` handler is created, regardless of the amount of Only one `atexit()` handler is created, regardless of the amount of
times the function is called. times the function is called. If the file is removed, subsequent
calls to this function will recreate the file.
See below for link to OpenBSD man page. See below for a link to OpenBSD man page.
- `pidfile_read(pidfile)` - `pidfile_read(pidfile)`
@@ -324,9 +326,9 @@ The following are popular functions and highly useful macros from the
http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/pidfile.3 http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/pidfile.3
**Note:** this version of `pidfile()` has been extended to handle it **Note:** the version of `pidfile()` in -lite has been extended to
being called multiple times, i.e. to not create multiple `atexit()` handle it being called multiple times, i.e. to not create multiple
handlers, and also to export a few internal paths: `atexit()` handlers, and also to export a few internal paths:
- `__pidfile_path`: prefix path, default `_PATH_VARRUN`. Notice the - `__pidfile_path`: prefix path, default `_PATH_VARRUN`. Notice the
trailing slash requirement if you want to override it! trailing slash requirement if you want to override it!