diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf index 8f5dc7a4f257..7f851ef0e306 100644 --- a/etc/defaults/rc.conf +++ b/etc/defaults/rc.conf @@ -29,6 +29,7 @@ apm_enable="NO" # Set to YES to enable APM BIOS functions (or NO). apmd_enable="NO" # Run apmd to handle APM event from userland. apmd_flags="" # Flags to apmd (if enabled). devd_enable="YES" # Run devd, to trigger programs on device tree changes. +devd_flags="" # Additional flags for devd(8). kldxref_enable="NO" # Build linker.hints files with kldxref(8). kldxref_clobber="NO" # Overwrite old linker.hints at boot. kldxref_module_path="" # Override kern.module_path. A ';'-delimited list. diff --git a/sbin/devd/devd.8 b/sbin/devd/devd.8 index a3056ebe4dc5..267e8240b326 100644 --- a/sbin/devd/devd.8 +++ b/sbin/devd/devd.8 @@ -33,7 +33,9 @@ .Nd "device state change daemon" .Sh SYNOPSIS .Nm -.Op Fl Ddn +.Op Fl Dd +.Op Fl f Ar file +.Op Fl n .Sh DESCRIPTION The .Nm @@ -41,11 +43,19 @@ daemon provides a way to have userland programs run when certain kernel events happen. .Pp The following options are accepted. -.Bl -tag -width indent +.Bl -tag -width indent-two .It Fl D Enable debugging messages. .It Fl d Run in the foreground instead of becoming a daemon. +.It Fl f Ar file +Use configuration file +.Ar file +instead of the default +.Pa /etc/devd.conf . +If option +.Fl f +is specified more than once, the last file specified is used. .It Fl n Do not process all pending events before becoming a daemon. Instead, call daemon right away. @@ -95,7 +105,9 @@ The utility reads .Pa /etc/devd.conf -and uses that file to drive the rest of the process. +or the alternate configuration file specified with a +.Fl f +option and uses that file to drive the rest of the process. While the format of this file is described in .Xr devd.conf 5 , some basics are covered here. @@ -118,6 +130,17 @@ receives are forwarded to the .Ux domain socket at .Pa /var/run/devd.pipe . +.Sh FILES +.Bl -tag -width ".Pa /var/run/devd.pipe" -compact +.It Pa /etc/devd.conf +The default +.Nm +configuration file. +.It Pa /var/run/devd.pipe +The socket used by +.Nm +to communicate with its clients. +.El .Sh SEE ALSO .Xr devctl 4 , .Xr devd.conf 5 diff --git a/sbin/devd/devd.cc b/sbin/devd/devd.cc index 3528736cb763..c7b4e432db74 100644 --- a/sbin/devd/devd.cc +++ b/sbin/devd/devd.cc @@ -83,6 +83,8 @@ int dflag; int nflag; int romeo_must_die = 0; +static const char *configfile = CF; + static void event_loop(void); static void usage(void); @@ -353,7 +355,7 @@ config::parse(void) { vector::const_iterator i; - parse_one_file(CF); + parse_one_file(configfile); for (i = _dir_list.begin(); i != _dir_list.end(); i++) parse_files_in_dir((*i).c_str()); sort_vector(_attach_list); @@ -908,7 +910,7 @@ main(int argc, char **argv) int ch; check_devd_enabled(); - while ((ch = getopt(argc, argv, "Ddn")) != -1) { + while ((ch = getopt(argc, argv, "Ddf:n")) != -1) { switch (ch) { case 'D': Dflag++; @@ -916,6 +918,9 @@ main(int argc, char **argv) case 'd': dflag++; break; + case 'f': + configfile = optarg; + break; case 'n': nflag++; break;