xref: /freebsd/libexec/rc/rc.d/devd (revision 61e21613)
1#!/bin/sh
2#
3#
4
5# PROVIDE: devd
6# REQUIRE: netif ldconfig
7# BEFORE: NETWORKING mountcritremote
8# KEYWORD: nojail shutdown
9
10. /etc/rc.subr
11
12name="devd"
13desc="Device state change daemon"
14rcvar="devd_enable"
15command="/sbin/${name}"
16
17start_precmd=${name}_prestart
18stop_precmd=find_pidfile
19
20find_pidfile()
21{
22	if get_pidfile_from_conf pid-file /etc/devd.conf; then
23		pidfile="$_pidfile_from_conf"
24	else
25		pidfile="/var/run/${name}.pid"
26	fi
27}
28
29devd_prestart()
30{
31	find_pidfile
32
33	# If devd is disabled, turn it off in the kernel to avoid unnecessary
34	# memory usage.
35	if ! checkyesno ${rcvar}; then
36	    $SYSCTL hw.bus.devctl_queue=0
37	fi
38}
39
40load_rc_config $name
41run_rc_command "$1"
42