Add a -f configfile option to devd(8), based on a patch submitted by

Wojciech A. Koszek.

Submitted by:	Wojciech A. Koszek <dunstan@freebsd.czest.pl>
This commit is contained in:
Joseph Koshy 2005-11-24 14:39:41 +00:00
parent 8bec746911
commit 8334958a7f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152770
3 changed files with 34 additions and 5 deletions

View File

@ -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.

View File

@ -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

View File

@ -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<string>::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;