diff options
author | ghelmer <ghelmer@FreeBSD.org> | 2012-01-10 19:53:25 +0000 |
---|---|---|
committer | ghelmer <ghelmer@FreeBSD.org> | 2012-01-10 19:53:25 +0000 |
commit | 9446d41409ef9748c6f20034374a472d777b7135 (patch) | |
tree | 4f74c9cb5ce5efb84ef61828351446984695db41 /lib/libutil/pidfile.3 | |
parent | f6e21fcb264de7e7e3df9d592037f2dd84bb4008 (diff) | |
download | FreeBSD-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.3')
-rw-r--r-- | lib/libutil/pidfile.3 | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/lib/libutil/pidfile.3 b/lib/libutil/pidfile.3 index c42b95b..7ab9857 100644 --- a/lib/libutil/pidfile.3 +++ b/lib/libutil/pidfile.3 @@ -46,6 +46,8 @@ .Fn pidfile_close "struct pidfh *pfh" .Ft int .Fn pidfile_remove "struct pidfh *pfh" +.Ft int +.Fn pidfile_fileno "struct pidfh *pfh" .Sh DESCRIPTION The .Nm pidfile @@ -92,6 +94,10 @@ to start a child process. The .Fn pidfile_remove function closes and removes a pidfile. +.Pp +The +.Fn pidfile_fileno +function returns the file descriptor for the open pid file. .Sh RETURN VALUES The .Fn pidfile_open @@ -105,15 +111,25 @@ If an error occurs, will be set. .Pp .Rv -std pidfile_write pidfile_close pidfile_remove +.Pp +The +.Fn pidfile_fileno +function returns the low-level file descriptor. +It returns -1 and sets +.Va errno +if a NULL +.Vt pidfh +is specified, or if the pidfile is no longer open. .Sh EXAMPLES The following example shows in which order these functions should be used. Note that it is safe to pass .Dv NULL to .Fn pidfile_write , -.Fn pidfile_remove -and +.Fn pidfile_remove , .Fn pidfile_close +and +.Fn pidfile_fileno functions. .Bd -literal struct pidfh *pfh; @@ -244,6 +260,16 @@ and system calls and the .Xr flopen 3 library function. +.Pp +The +.Fn pidfile_fileno +function will fail if: +.Bl -tag -width Er +.It Bq Er EDOOFUS +Improper function use. +Probably called not from the process which used +.Fn pidfile_open . +.El .Sh SEE ALSO .Xr open 2 , .Xr daemon 3 , |