summaryrefslogtreecommitdiffstats
path: root/lib/libutil/pidfile.c
diff options
context:
space:
mode:
authorghelmer <ghelmer@FreeBSD.org>2012-01-10 19:53:25 +0000
committerghelmer <ghelmer@FreeBSD.org>2012-01-10 19:53:25 +0000
commit9446d41409ef9748c6f20034374a472d777b7135 (patch)
tree4f74c9cb5ce5efb84ef61828351446984695db41 /lib/libutil/pidfile.c
parentf6e21fcb264de7e7e3df9d592037f2dd84bb4008 (diff)
downloadFreeBSD-src-9446d41409ef9748c6f20034374a472d777b7135.zip
FreeBSD-src-9446d41409ef9748c6f20034374a472d777b7135.tar.gz
Add pidfile_fileno() to obtain the file descriptor for an open
pidfile.
Diffstat (limited to 'lib/libutil/pidfile.c')
-rw-r--r--lib/libutil/pidfile.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/libutil/pidfile.c b/lib/libutil/pidfile.c
index fcd504c..cf5acce 100644
--- a/lib/libutil/pidfile.c
+++ b/lib/libutil/pidfile.c
@@ -266,3 +266,13 @@ pidfile_remove(struct pidfh *pfh)
return (_pidfile_remove(pfh, 1));
}
+
+int
+pidfile_fileno(struct pidfh *pfh)
+{
+ if (pfh == NULL || pfh->pf_fd == -1) {
+ errno = EDOOFUS;
+ return (-1);
+ }
+ return (pfh->pf_fd);
+}
OpenPOWER on IntegriCloud