summaryrefslogtreecommitdiff
path: root/doc/libs6/s6lockd.html
blob: 9fcb05573c39a38301e0199bab09b0cfd1da2003 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6: the s6lockd internal program</title>
    <meta name="Description" content="s6: the s6lockd internal program" />
    <meta name="Keywords" content="s6 s6lockd lockd asynchronous timed lock daemon" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">libs6</a><br />
<a href="../">s6</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>s6lockd</tt> program </h1>

<p>
<tt>s6lockd</tt> is the s6lock daemon. It is a program that manages
a set of lock files in a given directory, and associated timeouts.
</p>

<h2> Interface </h2>

<p>
  s6lockd does not fork, does not background itself automatically,
and does not use syslog. It is not meant to be run directly by the
user: it will be spawned by the
<a href="s6lock.html">s6lock client library</a>.
</p>

<p>
 There are 2 ways to use s6lockd:
</p>

<ol>
 <li> Use the <tt>s6lock_startf()</tt> library call.
A <tt>s6lockd</tt> child will then be spawned from your
calling process, and automatically reaped when you call
<tt>s6lock_end()</tt>. It requires care with applications that
trap SIGCHLD. It also requires care with lock file permissions:
a s6lockd instance might not be able
to open a lock file created by a former instance run by another
client with different permissions. </li>
 <li> Use the <tt>s6lock_start()</tt> library call, together with a
<a href="../localservice.html">s6lockd service</a>.
For once, <em>this is the recommended setup</em>: s6lockd creates empty
lock files, and having all s6lockd instances run under the same user
simplifies permissions management considerably. </li>
</ol>

<p>
When run as a service, s6lockd has no "standalone" mode: it is
designed to work with a Unix
domain superserver, like
<a href="../s6-ipcserver.html">s6-ipcserver</a>.
s6lockd follows the <a href="http://cr.yp.to/proto/ucspi.txt">UCSPI</a>
interface, it can be directly executed from the superserver.
</p>

<h2> Notes </h2>

<ul>
 <li> Unix does not natively provide a way to stop blocking on a lock
acquisition after a timeout. To emulate such behaviour, s6lockd actually
spawns a <a href="s6lockd-helper.html">s6lockd-helper</a> child per
requested lock. </li>
</ul>

</body>
</html>