--- /dev/null	2013-09-14 18:48:47.000000000 +0100
+++ new/usr/src/man/man1/lockf.1	2013-09-14 18:48:47.931626086 +0100
@@ -0,0 +1,204 @@
+'\" t
+.\" Copyright (C) 2008 Paul Armstrong. All rights reserved.
+.\"
+.\"  Redistribution and use in source and binary forms, with or without
+.\"  modification, are permitted provided that the following conditions
+.\"  are met:
+.\"  1. Redistributions of source code must retain the above copyright
+.\"     notice, this list of conditions and the following disclaimer.
+.\"  2. Redistributions in binary form must reproduce the above copyright
+.\"     notice, this list of conditions and the following disclaimer in the
+.\"     documentation and/or other materials provided with the distribution.
+.\"
+.\"  THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\"  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\"  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\"  ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
+.\"  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\"  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\"  OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\"  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\"  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\"  OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\"  SUCH DAMAGE.
+
+.TH lockf 1 "2008 Apr 08" "SunOS 5.11" "User Commands"
+.SH NAME
+lockf \- create, test or destroy file locks
+.SH SYNOPSIS
+.LP
+.nf
+\fBlockf\fR [[\fI-l|-t|-w\fR] \fI-f /path/to/lock\fR\fB] | [\fR \fI-u pid\fR]
+.fi
+
+.SH DESCRIPTION
+.sp
+.LP
+The \fBlockf\fR utility creates a lock file and then attempts to lock it using
+lockf(3C) so it is NFS safe and then returns the pid of the lock handler
+process. \fBlockf\fR also checks periodically to ensure that the calling
+process still exists and exits if it does not.
+
+.SH OPTIONS
+.sp
+.LP
+The following options are supported:
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-f\fR file\fR
+.ad
+.RS 10n
+.rt  
+The file to be used for locking. If it exists already, you need to have write
+permissions to the file.  \fBlockf\fR chdir's to / so file \fImust\fR be fully
+pathed. The file will be removed when the lock is removed if it did not exist
+prior to being created by \fBlockf\fR and left otherwise.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-l\fR\fR
+.ad
+.RS 10n
+.rt  
+Lock the file specified with the \fB-f\fR argument. Fails if a lock already
+exists.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-t\fR\fR
+.ad
+.RS 10n
+.rt  
+Test for the existance of a lock on the file specified with \fB-f\fR.
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-u\fR pid\fR
+.ad
+.RS 10n
+.rt  
+Kill the lock process at \fBpid\fR (unlocks the file).
+.RE
+
+.sp
+.ne 2
+.mk
+.na
+\fB\fB-w\fR\fR
+.ad
+.RS 10n
+.rt  
+Lock the file specified with the \fB-f\fR argument. Waits if a lock already
+exists and returns when a lock is gained.
+.RE
+
+.bp
+
+.SH EXAMPLES
+
+.LP
+\fBExample 1:\fR Creating a lock file, entering the critical section and then
+removing the lock.
+.sp
+.LP
+
+.sp
+.in +2
+.nf
+LOCK_PID="`lockf -l -f ${LOCK_DIR}/lock_file`"
+if [ -z "${LOCK_PID}" ]; then
+  echo "Failed to create lock" >&2
+else
+  critical_section
+  lockf -u "${LOCK_PID}"
+fi
+
+.fi
+.in -2
+.sp
+
+.LP
+\fBExample 2:\fR Testing for a lock on a file
+.sp
+
+.sp
+.in +2
+.nf
+example% \fBlockf -t -f ${PWD}/lock_file\fR
+.fi
+.in -2
+.sp
+
+.LP
+\fBExample 3:\fR Waiting until a lock can be created
+.sp
+
+.sp
+.in +2
+.nf
+example% \fBlockf -w -f ${PWD}/lock_file\fR
+.fi
+.in -2
+.sp
+
+
+.SH ENVIRONMENT VARIABLES
+.sp
+.LP
+See \fBenviron\fR(5) for descriptions of the following environment variables
+that affect the execution of \fBrealpath\fR: \fBLANG\fR, \fBLC_ALL\fR,
+\fBLC_CTYPE\fR,  \fBLC_MESSAGES\fR,  and \fBNLSPATH\fR.
+.SH EXIT STATUS
+.sp
+.LP
+\fBlockf\fR returns 0 if a lock is successfully created, or in the case of a
+test if no lock exists. It returns 1 if an error occurs, or a lock file exists
+and either a lock or test is being attempted.
+.sp
+
+.SH ATTRIBUTES
+.sp
+.LP
+See \fBattributes\fR(5) for descriptions of the following attributes:
+.sp
+
+.sp
+.TS
+tab() box;
+cw(2.75i) |cw(2.75i) 
+lw(2.75i) |lw(2.75i) 
+.
+ATTRIBUTE TYPEATTRIBUTE VALUE
+_
+AvailabilitySUNWesu
+.TE
+
+.SH SEE ALSO
+.sp
+.LP
+\fBlockf\fR(3C), \fBattributes\fR(5), \fBenviron\fR(5)
+.SH NOTES
+.sp
+.LP
+\fBlockf\fR can not be called by init as the case of the parent being init is
+used to check if the original caller died during process start up.
+.sp
+.LP
+While you can use existing files, other processes calling \fBlockf\fR(3C) or
+\fBfcntl\fR(3C) may interfere with the proper operation of \fBlockf\fR(1).
+.sp
+.LP
+\fBlockf\fR will wait indefinitely when called with \fI-w\fR so you may
+consider using \fBalarm\fR(1) to kill it after some reasonable amount of time.
