pidfile - write a daemon pid file
System Utilities Library (libutil, -lutil)
#include <util.h>
void
pidfile(const char *basename);
pidfile() writes a file containing the process ID of the program to the
/var/run directory. The file name has the form /var/run/basename.pid.
If the basename argument is NULL, pidfile will determine the program name
and use that instead.
The pid file can be used as a quick reference if the process needs to be
sent a signal. When the program exits, the pid file will be removed
automatically, unless the program receives a fatal signal.
Note that only the first invocation of pidfile causes a pid file to be
written; subsequent invocations have no effect unless a new basename is
supplied.
atexit(3)
The pidfile function call appeared in NetBSD 1.5.
BSD June 5, 1999 BSD
[ Back ] |