summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-02-11 01:38:05 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-02-11 01:38:05 +0000
commit48a5bb7a26de6c3bea32d18c3e476dd2cedbcfd3 (patch)
treefbed694d378457ac473e5ba93eca47470723f173
parent55bc8fead207fcb2aafe414ce84073f147ebce39 (diff)
downloadbcnm-48a5bb7a26de6c3bea32d18c3e476dd2cedbcfd3.tar.xz
Add bcnm-waitif doc
-rw-r--r--doc/bcnm-waitif.html87
-rw-r--r--doc/index.html1
2 files changed, 88 insertions, 0 deletions
diff --git a/doc/bcnm-waitif.html b/doc/bcnm-waitif.html
new file mode 100644
index 0000000..ac95397
--- /dev/null
+++ b/doc/bcnm-waitif.html
@@ -0,0 +1,87 @@
+<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>bcnm: the bcnm-waitif program</title>
+ <meta name="Description" content="bcnm: the bcnm-waitif program" />
+ <meta name="Keywords" content="bcnm waitif interface state up running flag notification netlink" />
+ <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
+ </head>
+<body>
+
+<p>
+<a href="index.html">s6</a><br />
+<a href="//skarnet.org/software/">Software</a><br />
+<a href="//skarnet.org/">skarnet.org</a>
+</p>
+
+<h1> The <tt>bcnm-waitif</tt> program </h1>
+
+<p>
+<tt>bcnm-waitif</tt> waits until a set of network interfaces are in the desired state,
+or a timeout occurs. Then it exits. It is typically used to avoid race conditions
+in a service startup sequence.
+</p>
+
+<h2> Interface </h2>
+
+<pre>
+ bcnm-waitif [ -u | -d ] [ -t <em>timeout</em> ] [ -k <em>kbufsize</em> ] <em>mask</em> <em>interface...</em>
+</pre>
+
+<ul>
+ <li> <tt>bcnm-waitif</tt> reads the state of all the interfaces specified by
+name as the <em>interface...</em> arguments. </li>
+ <li> If all the listed interfaces match the state defined in <em>mask</em>,
+it exits 0. </li>
+ <li> Else, it waits for network interface state changes, and performs the
+check again. </li>
+ <li> It loops until all the listed interfaces are in the desired state,
+or a timeout (if defined) occurs. </li>
+</ul>
+
+<h2> <em>mask</em> meaning </h2>
+
+<p>
+ <em>mask</em> is an unsigned integer representing a bitmask for the
+flags to be tested. If several bits are given, the wanted state is the
+conjunction of these flags: the condition will be true if <em>all</em>
+those checks pass.
+</p>
+
+<ul>
+ <li> 1: the interface exists (the kernel knows about it) </li>
+ <li> 2: the interface is UP (the administrator has activated it) </li>
+ <li> 4: the interface is RUNNING (functional, not unplugged) </li>
+</ul>
+
+<h2> Options </h2>
+
+<ul>
+ <li> <tt>-u</tt>&nbsp;: up. <tt>bcnm-waitif</tt> will wait until all
+the states defined in <em>mask</em> are reached by all the interfaces
+in <em>interface...</em>. This is the default. </li>
+ <li> <tt>-d</tt>&nbsp;: down. <tt>bcnm-waitif</tt> will wait until
+<em>none</em> of the states defined in <em>mask</em> is true. </li>
+ <li> <tt>-t&nbsp;<em>timeout</em></tt>&nbsp;: if the desired state
+still has not been reached after <em>timeout</em> milliseconds,
+<tt>bcnm-waitif</tt> will exit 99 with an error message. The default
+is 0, meaning there is no timeout and the program can wait forever. </li>
+ <li> <tt>-k&nbsp;<em>kbufsize</em></tt>&nbsp;: use <em>kbufsize</em>
+bytes for the netlink socket buffer. Too small a buffer risks losing
+state change events and reporting incorrect results. Too large a buffer
+wastes memory. Default is 131072, which is probably on the large side. </li>
+</ul>
+
+<h2> Exit codes </h2>
+
+<ul>
+ <li> 0: success </li>
+ <li> 99: timed out </li>
+ <li> 100: wrong usage </li>
+ <li> 111: system call failed </li>
+</ul>
+
+</body>
+</html>
diff --git a/doc/index.html b/doc/index.html
index bfc9f6b..24904a7 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -91,6 +91,7 @@ the previous versions of bcnm and the current one. </li>
</p>
<ul>
+ <li> <a href="bcnm-waitif.html">The <tt>bcnm-waitif</tt> program</a> </li>
</ul>
<h3> Libraries </h3>