libite
Functions | Variables
pidfile.c File Reference
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <errno.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
Include dependency graph for pidfile.c:

Functions

int pidfile (const char *basename)
 Create or update mtime of process PID file. More...
 

Variables

const char * __pidfile_path = _PATH_VARRUN
 
const char * __pidfile_name = NULL
 
char * __progname
 

Detailed Description

Author
NetBSD Foundation Inc.
Date
1999

Function Documentation

◆ pidfile()

int pidfile ( const char *  basename)

Create or update mtime of process PID file.

Parameters
basenameProgram name, or NULL, may start with '/'

This function is intended to be used by UNIX daemons to save the PID of the main process responsible for handling signals. If basename is NULL the implicit __progname variable from the C-library is used. The basename may also start with '/', in which case it is interpreted as the absolute path to the PID file.

Returns
POSIX OK(0) on success, otherwise non-zero on error.