Deleted Added
full compact
flopen.3 (169446) flopen.3 (169447)
1.\"-
2.\" Copyright (c) 2007 Dag-Erling Co�dan Sm�rgrav
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
1.\"-
2.\" Copyright (c) 2007 Dag-Erling Co�dan Sm�rgrav
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright

--- 9 unchanged lines hidden (view full) ---

18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.\" $FreeBSD: head/lib/libutil/flopen.3 169446 2007-05-10 14:43:31Z des $
26.\" $FreeBSD: head/lib/libutil/flopen.3 169447 2007-05-10 14:52:57Z des $
27.\"
28.Dd May 10, 2007
29.Dt FLOPEN 3
30.Os
31.Sh NAME
32.Nm flopen
33.Nd "Reliably open and lock a file"
34.Sh LIBRARY

--- 20 unchanged lines hidden (view full) ---

55except that
56.Fn flopen
57will attempt to detect and handle races that may occur between opening
58/ creating the file and locking it.
59Thus, it is well suited for opening lock files, PID files, spool
60files, mailboxes and other kinds of files which are used for
61synchronization between processes.
62.Pp
27.\"
28.Dd May 10, 2007
29.Dt FLOPEN 3
30.Os
31.Sh NAME
32.Nm flopen
33.Nd "Reliably open and lock a file"
34.Sh LIBRARY

--- 20 unchanged lines hidden (view full) ---

55except that
56.Fn flopen
57will attempt to detect and handle races that may occur between opening
58/ creating the file and locking it.
59Thus, it is well suited for opening lock files, PID files, spool
60files, mailboxes and other kinds of files which are used for
61synchronization between processes.
62.Pp
63If
64.Va flags
65includes
66.Dv O_NONBLOCK
67and the file is already locked,
68.Fn flopen
69will fail and set
70.Va errno
71to
72.Dv EWOULDBLOCK .
73.Pp
63As with
64.Fn flopen ,
65the additional
66.Va mode
67argument is required if
68.Va flags
69includes
70.Dv O_CREAT .
74As with
75.Fn flopen ,
76the additional
77.Va mode
78argument is required if
79.Va flags
80includes
81.Dv O_CREAT .
82.Sh RETURN VALUES
83If successful,
84.Fn flopen
85returns a valid file descriptor.
86Otherwise, it returns -1, and sets
87.Va errno
88as described in
89.Xr flock 2
90and
91.Xr open 2 .
71.Sh SEE ALSO
92.Sh SEE ALSO
93.Xr errno 2 ,
72.Xr flock 2 ,
73.Xr open 2
74.Sh AUTHORS
75.An -nosplit
76The
77.Nm
78function and this manual page were written by
79.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .
94.Xr flock 2 ,
95.Xr open 2
96.Sh AUTHORS
97.An -nosplit
98The
99.Nm
100function and this manual page were written by
101.An Dag-Erling Sm\(/orgrav Aq des@FreeBSD.org .