From 2934fb395b69cf33f1f34bbdeb315fc97255cf08 Mon Sep 17 00:00:00 2001 From: Pawel Jakub Dawidek Date: Wed, 24 Aug 2005 17:21:38 +0000 Subject: [PATCH] Add a family of functions for reliable pidfiles handling. Idea from: jmg Discussed on: arch@ --- libutil/libutil.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libutil/libutil.h b/libutil/libutil.h index 3042d0f..961fa1b 100644 --- a/libutil/libutil.h +++ b/libutil/libutil.h @@ -49,6 +49,16 @@ typedef struct _property { char *value; } *properties; +#ifdef _SYS_PARAM_H_ +/* for pidfile.c */ +struct pidfh { + int pf_fd; + char pf_path[MAXPATHLEN + 1]; + __dev_t pf_dev; + ino_t pf_ino; +}; +#endif + /* Avoid pulling in all the include files for no need */ struct termios; struct winsize; @@ -102,6 +112,13 @@ struct passwd *pw_scan(const char *_line, int _flags); const char *pw_tempname(void); int pw_tmp(int _mfd); #endif + +#ifdef _SYS_PARAM_H_ +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); +#endif __END_DECLS #define UU_LOCK_INUSE (1) -- 2.47.1