xref: /freebsd/libexec/rc/rc.d/devd (revision 6549718b70f0e660a15685369afb4f9caf2215ce)
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
17devd_offcmd=devd_off
18start_precmd=find_pidfile
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_off()
31{
32	# If devd is disabled, turn it off in the kernel to avoid unnecessary
33	# memory usage.
34	if ! checkyesno ${rcvar}; then
35	    $SYSCTL hw.bus.devctl_queue=0
36	fi
37}
38
39load_rc_config $name
40
41# doesn't make sense to run in a svcj: executing potential privileged operations
42devd_svcj="NO"
43
44run_rc_command "$1"
45