blob: 25ddd4885260752d381cc71403a5da001fc79464 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
#ifndef __PIDFILE_H
#define __PIDFILE_H
#include "port/limits.h" /* for PATH_MAX */
#include "port/stdbool.h" /* for bool */
#include "errors.h"
#include <sys/types.h> /* for pid_t */
struct pidfile_t {
char filename[PATH_MAX]; /**< the filename */
int fd; /**< file descriptor */
bool locked; /**< is the pidfile locked? */
bool running; /**< is another process locking too? */
};
void pidfile_init( struct pidfile_t *pidfile );
void pidfile_set_from_daemon_name( struct pidfile_t *pidfile, const char *daemon );
void pidfile_set_from_filename( struct pidfile_t *pidfile, const char *filename );
bool is_daemon_running( struct pidfile_t *pidfile, pid_t *pid, error_t *error );
error_t pidfile_create( struct pidfile_t *pidfile );
error_t pidfile_release( struct pidfile_t *pidfile );
error_t pidfile_remove( struct pidfile_t *pidfile );
#endif /* ifndef __PIDFILE_H */
|