summaryrefslogtreecommitdiffstats
path: root/sbin/devd
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2003-04-21 04:30:12 +0000
committerimp <imp@FreeBSD.org>2003-04-21 04:30:12 +0000
commit6968b9e7d3cf2019a7ba3a73692c1c9d15989fe1 (patch)
tree481da90693d79b983d632916f0d5fbdb7de370ca /sbin/devd
parent7b2d1b3027d1955bcd7071794030c715c6157afa (diff)
downloadFreeBSD-src-6968b9e7d3cf2019a7ba3a73692c1c9d15989fe1.zip
FreeBSD-src-6968b9e7d3cf2019a7ba3a73692c1c9d15989fe1.tar.gz
Put an anti-foot-shooting measure in place. Set hw.bus.devctl_disable
to 0 when we startup. Print a warning in this case. This allows people that are playing with devd by hand to have something happen. Otherwise, it appears that devd isn't working because /dev/devctl is disabled and producing no events. Suggested by: peter on irc a long time ago.
Diffstat (limited to 'sbin/devd')
-rw-r--r--sbin/devd/devd.cc19
1 files changed, 19 insertions, 0 deletions
diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc
index 9a0ea0e..bc598fe 100644
--- a/sbin/devd/devd.cc
+++ b/sbin/devd/devd.cc
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/types.h>
+#include <sys/sysctl.h>
#include <ctype.h>
#include <dirent.h>
@@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$");
#include "devd.h"
#define CF "/etc/devd.conf"
+#define SYSCTL "hw.bus.devctl_disable"
using namespace std;
@@ -783,6 +785,22 @@ usage()
exit(1);
}
+static void
+check_devd_enabled()
+{
+ int val = 0;
+ size_t len;
+
+ len = sizeof(val);
+ if (sysctlbyname(SYSCTL, &val, &len, NULL, NULL) != 0)
+ errx(1, "devctl sysctl missing from kernel!");
+ if (val) {
+ warnx("Setting " SYSCTL " to 0");
+ val = 0;
+ sysctlbyname(SYSCTL, NULL, NULL, &val, sizeof(val));
+ }
+}
+
/*
* main
*/
@@ -791,6 +809,7 @@ main(int argc, char **argv)
{
int ch;
+ check_devd_enabled();
while ((ch = getopt(argc, argv, "d")) != -1) {
switch (ch) {
case 'd':
OpenPOWER on IntegriCloud