summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorajacoutot <ajacoutot@openbsd.org>2014-07-09 14:19:22 +0000
committerajacoutot <ajacoutot@openbsd.org>2014-07-09 14:19:22 +0000
commit91bfd947669fefc6f44fc8bd60ab8006033e9d5c (patch)
treee61d5255a93e3cd7140ea14c63a80461c71532a9
parentRewrite lockstatus() description to be more like rw_status() (diff)
downloadwireguard-openbsd-91bfd947669fefc6f44fc8bd60ab8006033e9d5c.tar.xz
wireguard-openbsd-91bfd947669fefc6f44fc8bd60ab8006033e9d5c.zip
Add a daemon_timeout variable for rc_wait().
It represents the maximum time in seconds to wait for the start, stop and reload actions to return. Defaults to "30". No default behavior is changed. ok beck@ sthen@ jasper@ giovanni@
-rw-r--r--etc/rc.d/rc.subr11
-rw-r--r--share/man/man8/rc.d.813
-rw-r--r--share/man/man8/rc.subr.813
3 files changed, 27 insertions, 10 deletions
diff --git a/etc/rc.d/rc.subr b/etc/rc.d/rc.subr
index b426e3871ca..b3b251557b3 100644
--- a/etc/rc.d/rc.subr
+++ b/etc/rc.d/rc.subr
@@ -1,6 +1,6 @@
-# $OpenBSD: rc.subr,v 1.71 2014/07/09 10:59:35 ajacoutot Exp $
+# $OpenBSD: rc.subr,v 1.72 2014/07/09 14:19:22 ajacoutot Exp $
#
-# Copyright (c) 2010, 2011 Antoine Jacoutot <ajacoutot@openbsd.org>
+# Copyright (c) 2010, 2011, 2014 Antoine Jacoutot <ajacoutot@openbsd.org>
# Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
# Copyright (c) 2010, 2011 Robert Nagy <robert@openbsd.org>
#
@@ -85,8 +85,8 @@ rc_exit() {
}
rc_wait() {
- local _i=0 _w=${2:-30}
- while [ $_i -lt $_w ]; do
+ local _i=0
+ while [ $_i -lt ${daemon_timeout} ]; do
case "$1" in
reload|start)
rc_do rc_check && return 0
@@ -203,16 +203,19 @@ _RC_RUNFILE=${_RC_RUNDIR}/${_name}
eval _rcflags=\${${_name}_flags}
eval _rcuser=\${${_name}_user}
+eval _rctimeout=\${${_name}_timeout}
getcap -f /etc/login.conf ${_name} 1>/dev/null 2>&1 && \
daemon_class=${_name}
[ -z "${daemon_class}" ] && daemon_class=daemon
[ -z "${daemon_user}" ] && daemon_user=root
+[ -z "${daemon_timeout}" ] && daemon_timeout=30
[ -n "${_RC_FORCE}" ] && [ X"${_rcflags}" = X"NO" ] && unset _rcflags
[ -n "${_rcflags}" ] && daemon_flags=${_rcflags}
[ -n "${_rcuser}" ] && daemon_user=${_rcuser}
+[ -n "${_rctimeout}" ] && daemon_timeout=${_rctimeout}
# sanitize
daemon_flags=$(printf ' %s' ${daemon_flags})
diff --git a/share/man/man8/rc.d.8 b/share/man/man8/rc.d.8
index bab8c8d11a0..9aa06727467 100644
--- a/share/man/man8/rc.d.8
+++ b/share/man/man8/rc.d.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rc.d.8,v 1.24 2013/09/29 13:17:43 jmc Exp $
+.\" $OpenBSD: rc.d.8,v 1.25 2014/07/09 14:19:22 ajacoutot Exp $
.\"
.\" Copyright (c) 2011 Robert Nagy, Antoine Jacoutot, Ingo Schwarze
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: September 29 2013 $
+.Dd $Mdocdate: July 9 2014 $
.Dt RC.D 8
.Os
.Sh NAME
@@ -98,7 +98,7 @@ Daemon control scripts use a fixed number of
variables when starting a daemon.
The following two can be overridden by site-specific values provided in
.Xr rc.conf.local 8 :
-.Bl -tag -width daemon_flags -offset indent
+.Bl -tag -width daemon_timeout -offset indent
.It Ar daemon Ns _flags
Additional arguments to call the daemon with.
These will be appended to any mandatory arguments already contained in the
@@ -113,6 +113,13 @@ it will prevent the daemon from starting even when listed in
.It Ar daemon Ns _user
User to run the daemon as, using
.Xr su 1 .
+.It Ar daemon Ns _timeout
+Maximum time in seconds to wait for the
+.Cm start ,
+.Cm stop
+and
+.Cm reload
+actions to return.
.El
.Pp
To obtain the actual variable names, replace
diff --git a/share/man/man8/rc.subr.8 b/share/man/man8/rc.subr.8
index 4df82f56185..cc490c2b9ea 100644
--- a/share/man/man8/rc.subr.8
+++ b/share/man/man8/rc.subr.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rc.subr.8,v 1.24 2014/03/26 00:15:47 schwarze Exp $
+.\" $OpenBSD: rc.subr.8,v 1.25 2014/07/09 14:19:22 ajacoutot Exp $
.\"
.\" Copyright (c) 2011 Robert Nagy, Antoine Jacoutot, Ingo Schwarze
.\" All rights reserved.
@@ -24,7 +24,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: March 26 2014 $
+.Dd $Mdocdate: July 9 2014 $
.Dt RC.SUBR 8
.Os
.Sh NAME
@@ -214,7 +214,7 @@ i.e. that it will reload its configuration.
.Sh ENVIRONMENT
.Ic rc_cmd
uses the following shell variables to control its behaviour.
-.Bl -tag -width "daemon_flags"
+.Bl -tag -width "daemon_timeout"
.It Va daemon
The path to the daemon, optionally followed by one or more
whitespace separated arguments.
@@ -232,6 +232,13 @@ Arguments to call the daemon with.
.It Va daemon_user
User to run the daemon as, using
.Xr su 1 .
+.It Ar daemon Ns _timeout
+Maximum time in seconds to wait for the
+.Cm start ,
+.Cm stop
+and
+.Cm reload
+actions to return.
.It Va daemon_class
Login class to run the daemon with, using
.Xr su 1 .