1.\" 2.\" Copyright (c) 1996 Brian Somers <brian@awfulhak.demon.co.uk> 3.\" 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: --- 9 unchanged lines hidden (view full) --- 18.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, 19.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25.\" |
26.\" $FreeBSD: head/lib/libutil/uucplock.3 131504 2004-07-02 23:52:20Z ru $ |
27.\" " 28.Dd March 30, 1997 29.Os 30.Dt UUCPLOCK 3 31.Sh NAME 32.Nm uu_lock , 33.Nm uu_unlock , 34.Nm uu_lockerr --- 87 unchanged lines hidden (view full) --- 122is passed to 123.Fn uu_lockerr , 124an empty string is returned. 125Otherwise, a string specifying 126the reason for failure is returned. 127.Fn uu_lockerr 128uses the current value of 129.Va errno |
130to determine the exact error. 131Care should be made not to allow |
132.Va errno 133to be changed between calls to 134.Fn uu_lock 135and 136.Fn uu_lockerr . 137.Pp 138.Fn uu_lock_txfr 139may return any of the following values: 140.Pp 141.Dv UU_LOCK_OK : |
142The transfer was successful. 143The specified process now holds the device |
144lock. 145.Pp 146.Dv UU_LOCK_OWNER_ERR : 147The current process does not already own a lock on the specified device. 148.Pp 149.Dv UU_LOCK_WRITE_ERR : 150The new process id could not be written to the lock file via a call to 151.Xr write 2 . 152.Sh ERRORS 153If 154.Fn uu_lock 155returns one of the error values above, the global value 156.Va errno |
157can be used to determine the cause. 158Refer to the respective manual pages |
159for further details. 160.Pp 161.Fn uu_unlock 162will set the global variable 163.Va errno 164to reflect the reason that the lock file could not be removed. 165Refer to the description of 166.Xr unlink 2 --- 5 unchanged lines hidden (view full) --- 172.Xr write 2 173.Sh BUGS 174It is possible that a stale lock is not recognised as such if a new 175processes is assigned the same processes id as the program that left 176the stale lock. 177.Pp 178The calling process must have write permissions to the 179.Pa /var/spool/lock |
180directory. 181There is no mechanism in place to ensure that the |
182permissions of this directory are the same as those of the 183serial devices that might be locked. |