lockf.3 (129369) | lockf.3 (131504) |
---|---|
1.\" $NetBSD: lockf.3,v 1.2 1998/02/05 18:47:28 perry Exp $ 2.\" 3.\" Copyright (c) 1997 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Klaus Klein and S.P. Zeidler. 8.\" --- 20 unchanged lines hidden (view full) --- 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" | 1.\" $NetBSD: lockf.3,v 1.2 1998/02/05 18:47:28 perry Exp $ 2.\" 3.\" Copyright (c) 1997 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" This code is derived from software contributed to The NetBSD Foundation 7.\" by Klaus Klein and S.P. Zeidler. 8.\" --- 20 unchanged lines hidden (view full) --- 29.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35.\" POSSIBILITY OF SUCH DAMAGE. 36.\" |
37.\" $FreeBSD: head/lib/libc/gen/lockf.3 129369 2004-05-17 23:09:10Z yar $ | 37.\" $FreeBSD: head/lib/libc/gen/lockf.3 131504 2004-07-02 23:52:20Z ru $ |
38.\" 39.Dd December 19, 1997 40.Dt LOCKF 3 41.Os 42.Sh NAME 43.Nm lockf 44.Nd record locking on files 45.Sh LIBRARY --- 51 unchanged lines hidden (view full) --- 97.Pp 98The 99.Fa size 100argument is the number of contiguous bytes to be locked or 101unlocked. 102The section to be locked or unlocked starts at the current 103offset in the file and extends forward for a positive size or backward 104for a negative size (the preceding bytes up to but not including the | 38.\" 39.Dd December 19, 1997 40.Dt LOCKF 3 41.Os 42.Sh NAME 43.Nm lockf 44.Nd record locking on files 45.Sh LIBRARY --- 51 unchanged lines hidden (view full) --- 97.Pp 98The 99.Fa size 100argument is the number of contiguous bytes to be locked or 101unlocked. 102The section to be locked or unlocked starts at the current 103offset in the file and extends forward for a positive size or backward 104for a negative size (the preceding bytes up to but not including the |
105current offset). However, it is not permitted to lock a section that | 105current offset). 106However, it is not permitted to lock a section that |
106starts or extends before the beginning of the file. 107If 108.Fa size 109is 0, the section from the current offset through the largest possible 110file offset is locked (that is, from the current offset through the 111present or any future end-of-file). 112.Pp 113The sections locked with --- 23 unchanged lines hidden (view full) --- 137file descriptor for the file. 138.Pp 139.Dv F_ULOCK 140requests release (wholly or in part) one or more locked sections 141controlled by the process. 142Locked sections will be unlocked starting 143at the current file offset through 144.Fa size | 107starts or extends before the beginning of the file. 108If 109.Fa size 110is 0, the section from the current offset through the largest possible 111file offset is locked (that is, from the current offset through the 112present or any future end-of-file). 113.Pp 114The sections locked with --- 23 unchanged lines hidden (view full) --- 138file descriptor for the file. 139.Pp 140.Dv F_ULOCK 141requests release (wholly or in part) one or more locked sections 142controlled by the process. 143Locked sections will be unlocked starting 144at the current file offset through 145.Fa size |
145bytes or to the end of file if size is 0. When all of a locked section | 146bytes or to the end of file if size is 0. 147When all of a locked section |
146is not released (that is, when the beginning or end of the area to be 147unlocked falls within a locked section), the remaining portions of 148that section are still locked by the process. 149Releasing the center 150portion of a locked section will cause the remaining locked beginning 151and end portions to become two separate locked sections. 152If the 153request would cause the number of locks in the system to exceed a 154system-imposed limit, the request will fail. 155.Pp 156An 157.Dv F_ULOCK 158request in which size is non-zero and the offset of the last byte of 159the requested section is the maximum value for an object of type 160off_t, when the process has an existing lock in which size is 0 and 161which includes the last byte of the requested section, will be treated 162as a request to unlock from the start of the requested section with a | 148is not released (that is, when the beginning or end of the area to be 149unlocked falls within a locked section), the remaining portions of 150that section are still locked by the process. 151Releasing the center 152portion of a locked section will cause the remaining locked beginning 153and end portions to become two separate locked sections. 154If the 155request would cause the number of locks in the system to exceed a 156system-imposed limit, the request will fail. 157.Pp 158An 159.Dv F_ULOCK 160request in which size is non-zero and the offset of the last byte of 161the requested section is the maximum value for an object of type 162off_t, when the process has an existing lock in which size is 0 and 163which includes the last byte of the requested section, will be treated 164as a request to unlock from the start of the requested section with a |
163size equal to 0. Otherwise an | 165size equal to 0. 166Otherwise an |
164.Dv F_ULOCK 165request will attempt to unlock only the requested section. 166.Pp 167A potential for deadlock occurs if a process controlling a locked 168region is put to sleep by attempting to lock the locked region of | 167.Dv F_ULOCK 168request will attempt to unlock only the requested section. 169.Pp 170A potential for deadlock occurs if a process controlling a locked 171region is put to sleep by attempting to lock the locked region of |
169another process. This implementation detects that sleeping until a | 172another process. 173This implementation detects that sleeping until a |
170locked region is unlocked would cause a deadlock and fails with an 171.Er EDEADLK 172error. 173.Pp 174The 175.Fn lockf , 176.Xr fcntl 2 , 177and --- 92 unchanged lines hidden --- | 174locked region is unlocked would cause a deadlock and fails with an 175.Er EDEADLK 176error. 177.Pp 178The 179.Fn lockf , 180.Xr fcntl 2 , 181and --- 92 unchanged lines hidden --- |