summaryrefslogtreecommitdiffstats
path: root/etc/rc.d/devd
blob: 53532cc8698d0d2bb161b61ac43e6d53dbb9ebbf (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
#!/bin/sh
#
# $FreeBSD$
#

# PROVIDE: devd
# REQUIRE: netif ldconfig
# BEFORE: NETWORKING mountcritremote
# KEYWORD: nojail shutdown

. /etc/rc.subr

name="devd"
rcvar="devd_enable"
command="/sbin/${name}"

start_precmd=${name}_prestart
stop_precmd=find_pidfile

find_pidfile()
{
	if get_pidfile_from_conf pid-file /etc/devd.conf; then
		pidfile="$_pidfile_from_conf"
	else
		pidfile="/var/run/${name}.pid"
	fi
}

devd_prestart()
{
	find_pidfile

	# If devd is disabled, turn it off in the kernel to avoid unnecessary
	# memory usage.
	if ! checkyesno ${rcvar}; then
	    $SYSCTL hw.bus.devctl_queue=0
	fi
}

load_rc_config $name
run_rc_command "$1"
OpenPOWER on IntegriCloud