1.\" $OpenBSD: lockspool.1,v 1.11 2010/09/03 11:35:08 jmc Exp $ 2.\" 3.\" Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: September 3 2010 $ 18.Dt LOCKSPOOL 1 19.Os 20.Sh NAME 21.Nm lockspool 22.Nd lock user's system mailbox 23.Sh SYNOPSIS 24.Nm lockspool 25.Op Ar username 26.Sh DESCRIPTION 27.Nm 28is useful for a client mail program to attain proper locking. 29.Nm 30obtains a 31.Pa username.lock 32for the calling user and retains it until stdin is closed or a signal like 33.Dv SIGINT , 34.Dv SIGTERM , 35or 36.Dv SIGHUP 37is received. 38Additionally, the superuser may specify the name of a user in order 39to lock a different mailbox. 40.Pp 41If 42.Nm 43is able to create the lock file, 44.Dq 1 45is written to stdout, otherwise 46.Dq 0 47is written and an error message is written to stderr. 48.Nm 49will try up to 10 times to get the lock (sleeping 50for a short period in between tries). 51.Pp 52Typical usage is for a user mail agent (such as 53.Xr mail 1 ) 54to open a pipe to 55.Nm 56when it needs to lock the user's mail spool. 57Closing the pipe will cause 58.Nm 59to release the lock. 60.Sh FILES 61.Bl -tag -width /var/mail/username.lock -compact 62.It Pa /var/mail/username.lock 63user's mail lock file 64.El 65.Sh EXIT STATUS 66The 67.Nm 68utility exits 0 on success, and 1 if an error occurs. 69.Sh SEE ALSO 70.Xr mail 1 , 71.Xr mail.local 8 , 72.Xr sendmail 8 73.Sh HISTORY 74The 75.Nm 76program appeared in 77.Ox 2.4 . 78