blob: bc6251e04158cba91f1f4f5cba52cfb3d1bb622d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
|