diff options
author | Guillem Jover <guillem@hadrons.org> | 2010-01-10 00:10:21 +0100 |
---|---|---|
committer | Guillem Jover <guillem@hadrons.org> | 2010-01-10 15:29:46 +0100 |
commit | 2a81893cc028b40f7832bf033821a1aacfaaea68 (patch) | |
tree | f23ebf906256ddb1e80204df55ff6db4fb991f28 /include | |
parent | 98a2479f0ba02a0c54ff360aa5745ff5a6939b2e (diff) | |
download | libbsd-2a81893cc028b40f7832bf033821a1aacfaaea68.tar.gz |
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.
Diffstat (limited to 'include')
-rw-r--r-- | include/libutil.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/libutil.h b/include/libutil.h index 298bbc3..21a22cd 100644 --- a/include/libutil.h +++ b/include/libutil.h @@ -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) */ |