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.
This commit is contained in:
parent
02245e6120
commit
9c1808986c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=113787
@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/sysctl.h>
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
@ -58,6 +59,7 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include "devd.h"
|
#include "devd.h"
|
||||||
|
|
||||||
#define CF "/etc/devd.conf"
|
#define CF "/etc/devd.conf"
|
||||||
|
#define SYSCTL "hw.bus.devctl_disable"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -783,6 +785,22 @@ usage()
|
|||||||
exit(1);
|
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
|
* main
|
||||||
*/
|
*/
|
||||||
@ -791,6 +809,7 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int ch;
|
int ch;
|
||||||
|
|
||||||
|
check_devd_enabled();
|
||||||
while ((ch = getopt(argc, argv, "d")) != -1) {
|
while ((ch = getopt(argc, argv, "d")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'd':
|
case 'd':
|
||||||
|
Loading…
Reference in New Issue
Block a user