diff options
author | ghelmer <ghelmer@FreeBSD.org> | 2012-01-12 22:49:36 +0000 |
---|---|---|
committer | ghelmer <ghelmer@FreeBSD.org> | 2012-01-12 22:49:36 +0000 |
commit | 7e48086a86bd27a66ffcd516748a3099662fdefe (patch) | |
tree | a131a6a05d5b1afd59f8121114498f38af9cf35f /lib | |
parent | ca439f51f0cc3f36f77c8dfbaeff704b689caecc (diff) | |
download | FreeBSD-src-7e48086a86bd27a66ffcd516748a3099662fdefe.zip FreeBSD-src-7e48086a86bd27a66ffcd516748a3099662fdefe.tar.gz |
Move struct pidfh definition into pidfile.c, and leave a forward declaration
for pidfh in libutil.h in its place.
This allows us to hide the contents of the pidfh structure, and also
allowed removal of the "#ifdef _SYS_PARAM_H" guard from around the
pidfile_* function prototypes.
Suggested by pjd.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libutil/libutil.h | 18 | ||||
-rw-r--r-- | lib/libutil/pidfile.c | 7 |
2 files changed, 13 insertions, 12 deletions
diff --git a/lib/libutil/libutil.h b/lib/libutil/libutil.h index af29d33..8cd21e5 100644 --- a/lib/libutil/libutil.h +++ b/lib/libutil/libutil.h @@ -48,6 +48,11 @@ typedef __gid_t gid_t; #define _GID_T_DECLARED #endif +#ifndef _MODE_T_DECLARED +typedef __mode_t mode_t; +#define _MODE_T_DECLARED +#endif + #ifndef _PID_T_DECLARED typedef __pid_t pid_t; #define _PID_T_DECLARED @@ -73,21 +78,12 @@ 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 in_addr; struct kinfo_file; struct kinfo_proc; struct kinfo_vmentry; +struct pidfh; struct sockaddr; struct termios; struct winsize; @@ -174,14 +170,12 @@ struct group int gr_tmp(int _mdf); #endif -#ifdef _SYS_PARAM_H_ int pidfile_close(struct pidfh *_pfh); int pidfile_fileno(const struct pidfh *_pfh); struct pidfh * pidfile_open(const char *_path, mode_t _mode, pid_t *_pidptr); int pidfile_remove(struct pidfh *_pfh); int pidfile_write(struct pidfh *_pfh); -#endif #ifdef _UFS_UFS_QUOTA_H_ struct fstab; diff --git a/lib/libutil/pidfile.c b/lib/libutil/pidfile.c index 60f81fd..bca0315 100644 --- a/lib/libutil/pidfile.c +++ b/lib/libutil/pidfile.c @@ -41,6 +41,13 @@ __FBSDID("$FreeBSD$"); #include <errno.h> #include <libutil.h> +struct pidfh { + int pf_fd; + char pf_path[MAXPATHLEN + 1]; + dev_t pf_dev; + ino_t pf_ino; +}; + static int _pidfile_remove(struct pidfh *pfh, int freeit); static int |