summaryrefslogtreecommitdiff
path: root/sys/man/1/lock
diff options
context:
space:
mode:
authorTaru Karttunen <taruti@taruti.net>2011-03-30 16:49:47 +0300
committerTaru Karttunen <taruti@taruti.net>2011-03-30 16:49:47 +0300
commitb41b9034225ab3e49980d9de55c141011b6383b0 (patch)
tree891014b4c2e803e01ac7a1fd2b60819fbc5a6e73 /sys/man/1/lock
parentc558a99e0be506a9abdf677f0ca4490644e05fc1 (diff)
Import sources from 2011-03-30 iso image - sys/man
Diffstat (limited to 'sys/man/1/lock')
-rwxr-xr-xsys/man/1/lock61
1 files changed, 61 insertions, 0 deletions
diff --git a/sys/man/1/lock b/sys/man/1/lock
new file mode 100755
index 000000000..bc6251e04
--- /dev/null
+++ b/sys/man/1/lock
@@ -0,0 +1,61 @@
+.TH LOCK 1
+.SH NAME
+lock \- run a command under lock
+.SH SYNOPSIS
+.B lock
+[
+.B -w
+]
+.I lockfile
+[
+.I command
+[
+.I argument
+\&...
+] ]
+.SH DESCRIPTION
+.I Lock
+runs
+.I command
+(default
+.LR rc )
+with
+.I arguments
+while holding
+.I lockfile
+open and (over)writing at least one byte each minute
+to keep the exclusive-access lock alive.
+If
+.I lockfile
+doesn't already have the exclusive-access bit set in
+its mode,
+the exclusive-access bits are set in its mode and
+.BR qid.type .
+.PP
+Under
+.BR -w ,
+.I lock
+waits for exclusive access to
+.I lockfile
+instead of just trying once.
+.PP
+.I Lock
+sets
+.B /env/prompt
+to contain the name of the lock file.
+.SH EXAMPLES
+Build a
+.IR replica (1)
+database while preventing collisions with other occurrences.
+.IP
+.EX
+cd /sys/lib/dist
+lock scan.lock replica/scan $dist/sources.replica
+.EE
+.SH SOURCE
+.B /sys/src/cmd/lock.c
+.SH SEE ALSO
+.IR intro (5),
+.IR stat (5)
+.\" .SH DIAGNOSTICS
+.\" .SH BUGS