lockf.3 (53040) | lockf.3 (57686) |
---|---|
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 53040 1999-11-09 00:28:34Z phantom $ | 37.\" $FreeBSD: head/lib/libc/gen/lockf.3 57686 2000-03-02 09:14:21Z sheldonh $ |
38.\" 39.Dd December 19, 1997 40.Dt LOCKF 3 41.Os NetBSD 1.4 42.Sh NAME 43.Nm lockf 44.Nd record locking on files 45.Sh SYNOPSIS --- 45 unchanged lines hidden (view full) --- 91.Dv F_TLOCK 92both lock a section of a file if the section is available; 93.Dv F_TEST 94detects if a lock by another process is present on the specified section. 95.Pp 96The 97.Fa size 98argument is the number of contiguous bytes to be locked or | 38.\" 39.Dd December 19, 1997 40.Dt LOCKF 3 41.Os NetBSD 1.4 42.Sh NAME 43.Nm lockf 44.Nd record locking on files 45.Sh SYNOPSIS --- 45 unchanged lines hidden (view full) --- 91.Dv F_TLOCK 92both lock a section of a file if the section is available; 93.Dv F_TEST 94detects if a lock by another process is present on the specified section. 95.Pp 96The 97.Fa size 98argument is the number of contiguous bytes to be locked or |
99unlocked. The section to be locked or unlocked starts at the current | 99unlocked. 100The section to be locked or unlocked starts at the current |
100offset in the file and extends forward for a positive size or backward 101for a negative size (the preceding bytes up to but not including the 102current offset). However, it is not permitted to lock a section that 103starts or extends before the beginning of the file. 104If 105.Fa size 106is 0, the section from the current offset through the largest possible 107file offset is locked (that is, from the current offset through the 108present or any future end-of-file). 109.Pp 110The sections locked with 111.Dv F_LOCK 112or 113.Dv F_TLOCK 114may, in whole or in part, contain or be contained by a previously | 101offset in the file and extends forward for a positive size or backward 102for a negative size (the preceding bytes up to but not including the 103current offset). However, it is not permitted to lock a section that 104starts or extends before the beginning of the file. 105If 106.Fa size 107is 0, the section from the current offset through the largest possible 108file offset is locked (that is, from the current offset through the 109present or any future end-of-file). 110.Pp 111The sections locked with 112.Dv F_LOCK 113or 114.Dv F_TLOCK 115may, in whole or in part, contain or be contained by a previously |
115locked section for the same process. When this occurs, or if adjacent | 116locked section for the same process. 117When this occurs, or if adjacent |
116locked sections would occur, the sections are combined into a single | 118locked sections would occur, the sections are combined into a single |
117locked section. If the request would cause the number of locks to | 119locked section. 120If the request would cause the number of locks to |
118exceed a system-imposed limit, the request will fail. 119.Pp 120.Dv F_LOCK 121and 122.Dv F_TLOCK 123requests differ only by the action taken if the section is not 124available. 125.Dv F_LOCK 126blocks the calling process until the section is available. 127.Dv F_TLOCK 128makes the function fail if the section is already locked by another 129process. 130.Pp 131File locks are released on first close by the locking process of any 132file descriptor for the file. 133.Pp 134.Dv F_ULOCK 135requests release (wholly or in part) one or more locked sections | 121exceed a system-imposed limit, the request will fail. 122.Pp 123.Dv F_LOCK 124and 125.Dv F_TLOCK 126requests differ only by the action taken if the section is not 127available. 128.Dv F_LOCK 129blocks the calling process until the section is available. 130.Dv F_TLOCK 131makes the function fail if the section is already locked by another 132process. 133.Pp 134File locks are released on first close by the locking process of any 135file descriptor for the file. 136.Pp 137.Dv F_ULOCK 138requests release (wholly or in part) one or more locked sections |
136controlled by the process. Locked sections will be unlocked starting | 139controlled by the process. 140Locked sections will be unlocked starting |
137at the current file offset through 138.Fa size 139bytes or to the end of file if size is 0. When all of a locked section 140is not released (that is, when the beginning or end of the area to be 141unlocked falls within a locked section), the remaining portions of | 141at the current file offset through 142.Fa size 143bytes or to the end of file if size is 0. When all of a locked section 144is not released (that is, when the beginning or end of the area to be 145unlocked falls within a locked section), the remaining portions of |
142that section are still locked by the process. Releasing the center | 146that section are still locked by the process. 147Releasing the center |
143portion of a locked section will cause the remaining locked beginning | 148portion of a locked section will cause the remaining locked beginning |
144and end portions to become two separate locked sections. If the | 149and end portions to become two separate locked sections. 150If the |
145request would cause the number of locks in the system to exceed a 146system-imposed limit, the request will fail. 147.Pp 148An 149.Dv F_ULOCK 150request in which size is non-zero and the offset of the last byte of 151the requested section is the maximum value for an object of type 152off_t, when the process has an existing lock in which size is 0 and --- 97 unchanged lines hidden --- | 151request would cause the number of locks in the system to exceed a 152system-imposed limit, the request will fail. 153.Pp 154An 155.Dv F_ULOCK 156request in which size is non-zero and the offset of the last byte of 157the requested section is the maximum value for an object of type 158off_t, when the process has an existing lock in which size is 0 and --- 97 unchanged lines hidden --- |