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