*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->OpenBSD man pages -> pidfile (3)              
Title
Content
Arch
Section
 

PIDFILE(3)

Contents


NAME    [Toc]    [Back]

     pidfile - write a daemon pid file

SYNOPSIS    [Toc]    [Back]

     #include <util.h>

     int
     pidfile(const char *basename);

DESCRIPTION    [Toc]    [Back]

     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.

RETURN VALUES    [Toc]    [Back]

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

SEE ALSO    [Toc]    [Back]

      
      
     atexit(3)

HISTORY    [Toc]    [Back]

     The pidfile function call appeared in OpenBSD 3.0.

CAVEATS    [Toc]    [Back]

     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.

OpenBSD      3.6                           June      5,      1999
[ Back ]
 Similar pages
Name OS Title
AFreadmisc IRIX read from / write to / move logical read/write pointer for data in a miscellaneous chunk in an audio file
AFclosefile IRIX close an audio file, update file header if file was opened for write access.
sat_write_filehdr IRIX write audit file header, write close time to audit file header
AFsyncfile IRIX write out a consistent snapshot of an audio file without actually closing the file
efi_fsinit HP-UX write an EFI file system header on a device file
pwrite Tru64 Write to a file
writev HP-UX write on a file
write IRIX write on a file
writev Tru64 Write to a file
puts IRIX Write to a file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service