mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-10-17 11:05:07 +02:00
Add pidfile functions
Taken from FreeBSD. Remove MAXPATHLEN from ‘struct pidfh’ and allocate pf_path dynamically, as some systems do not have such limits. Use dev_t instead of __dev_t. Replace EDOOFUS with EINVAL.
This commit is contained in:
@@ -42,12 +42,24 @@
|
||||
#include <features.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* for pidfile.c */
|
||||
struct pidfh {
|
||||
int pf_fd;
|
||||
char *pf_path;
|
||||
dev_t pf_dev;
|
||||
ino_t pf_ino;
|
||||
};
|
||||
|
||||
__BEGIN_DECLS
|
||||
int humanize_number(char *buf, size_t len, int64_t bytes,
|
||||
const char *suffix, int scale, int flags);
|
||||
|
||||
int flopen(const char *_path, int _flags, ...);
|
||||
|
||||
struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr);
|
||||
int pidfile_write(struct pidfh *pfh);
|
||||
int pidfile_close(struct pidfh *pfh);
|
||||
int pidfile_remove(struct pidfh *pfh);
|
||||
__END_DECLS
|
||||
|
||||
/* humanize_number(3) */
|
||||
|
Reference in New Issue
Block a user