MirBSD manpage: pidfile(3)

PIDFILE(3)                 BSD Programmer's Manual                  PIDFILE(3)


     pidfile - write a daemon pid file


     #include <util.h>

     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 au-
     tomatically, unless the program receives a fatal signal.


     pidfile() returns 0 on success and -1 on failure.




     The pidfile function call appeared in OpenBSD 3.0.


     If pidfile() is called multiple times with different basename, only the
     last pidfile will be removed upon exit.

     pidfile() uses atexit() to ensure the pidfile is unlinked at program
     exit. However, programs that use the _exit() function (for example, in
     signal handlers) will not trigger this behaviour.

MirBSD #10-current               June 5, 1999                                1

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung