Commit Graph

255 Commits

Author SHA1 Message Date
Glen Barber
e01a93b63c Add devd and routed back to the runtime package instead
of their individual packages based on MK_foo evaluation.

There is no intent to split inet/inet6 or other similar
combinations for package creation, since they are created
during build time.

Noticed/prodded by:	lidl
Sponsored by:	The FreeBSD Foundation
2016-02-10 04:00:01 +00:00
Glen Barber
7de1daeb93 Create packages for atm, ccdconfig, devd, ipf, ipfw,
iscsi, natd, nandfs, pf, quotacheck, and routed.

Add ping6 and rtsol to the runtime package.

Sponsored by:	The FreeBSD Foundation
2016-02-09 19:30:31 +00:00
Glen Barber
43faedc133 First pass to fix the 'tests' packages.
Sponsored by:	The FreeBSD Foundation
2016-02-02 22:26:49 +00:00
Alan Somers
d9ca81dabe Increase devd's client socket buffer size to 256KB. This is not as large as
it looks, because we'll hit the sockbuf's mbuf limit long before hitting its
data limit. A 256KB data limit allows creating a ZFS pool on about 450
drives without overflowing the client socket buffers.

MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D4476
2015-12-09 18:55:25 +00:00
Eitan Adler
463a577b27 Fix a ton of speelling errors
arc lint is helpful

Reviewed By: allanjude, wblock, #manpages, chris@bsdjunk.com
Differential Revision: https://reviews.freebsd.org/D3337
2015-10-21 05:37:09 +00:00
Enji Cooper
b2d48be1bc Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and
netbsd-tests.test.mk (r289151)

- Eliminate explicit OBJTOP/SRCTOP setting
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

MFC after: 2 weeks
Sponsored by: EMC / Isilon Storage Divison
2015-10-12 08:16:03 +00:00
Edward Tomasz Napierala
4a2a044965 Document suspend/resume notification in devd.conf(5).
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-07-18 12:24:54 +00:00
Edward Tomasz Napierala
cdff99588e Add CARP events description to devd.conf(5).
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2015-07-18 12:17:59 +00:00
Simon J. Gerraty
2ef6d5a7b9 new depends 2015-06-16 23:37:19 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Edward Tomasz Napierala
28616c3cc1 Document RCTL events in devd.conf(5).
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-05-13 12:02:51 +00:00
Edward Tomasz Napierala
01de1a0650 Add devd(8) notifications for creation and destruction of GEOM devices.
Differential Revision:	https://reviews.freebsd.org/D1211
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-01-14 11:15:57 +00:00
Baptiste Daroussin
13eb765f2d Convert sbin/ to LIBADD
Reduce overlinking
2014-11-25 11:23:12 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Alan Somers
81ade99c2c Misc fixes suggested by Coverity.
sbin/devd/tests/client_test.c
	* In the event that popen fails, don't dereference its return value.
	* Fix array overwrite in the stream and seqpacket tests.
	* Close sockets at the end of successful ATF tests.

Reported by:	Coverity scan
CID:		1232019, 1232020, 1232029, 1232030
MFC after:	1 week
Sponsored by:	Spectra Logic
2014-08-20 17:04:49 +00:00
Bjoern A. Zeeb
d8e198e6b4 Remove bogus ; at the end of the if condition in order to unbreak gcc builds
after r270004.

MFC after:	4 days
X-MFX with:	r270004
2014-08-15 10:01:33 +00:00
Alan Somers
cdfa64aaeb Convert devd's client socket to type SOCK_SEQPACKET.
This change consists of two merges from projects/zfsd/head along with the
addition of an ATF test case for the new functionality.

sbin/devd/tests/Makefile
sbin/devd/tests/client_test.c
	Add ATF test cases for reading events from both devd socket types.

r266519:
sbin/devd/devd.8
sbin/devd/devd.cc
	Create a new socket, of type SOCK_SEQPACKET, for communicating with
	clients. SOCK_SEQPACKET sockets preserve record boundaries,
	simplying code in the client. The old SOCK_STREAM socket is retained
	for backwards-compatibility with existing clients.

r269993:
sbin/devd/devd.8
	Fix grammar bug.

CR:		https://reviews.freebsd.org/rS266519
MFC after:	5 days
Sponsored by:	Spectra Logic
2014-08-14 22:33:56 +00:00
Alan Somers
d931b81aeb sbin/devd/devd.8
Fix grammar bug.

Reported by:	ian
Sponsored by:	Spectra Logic Corporation
2014-08-14 18:39:13 +00:00
Alan Somers
9102691e9c sbin/devd/devd.8
sbin/devd/devd.cc
	Create a new socket, of type SOCK_SEQPACKET, for communicating with
	clients.  SOCK_SEQPACKET sockets preserve record boundaries,
	simplying code in the client.  The old SOCK_STREAM socket is
	retained for backwards-compatibility with existing clients.

Sponsored by:	Spectra Logic
2014-05-21 23:04:47 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Dimitry Andric
fedda9c678 Revert r263694, and apply a better fix to squelch unnecessary warnings
from clang about possible keywords being treated as identifiers for the
remainder of the translation unit (a.k.a. -Wkeyword-compat), when using
libstdc++ in combination with -Wsystem-headers.  This will not only fix
devd, but any C++ program using libstdc++.

MFC after:	3 days
X-MFC-With:	r263694
2014-03-26 19:31:33 +00:00
Mateusz Guzik
ee38f2e004 Update userspace users of hw.bus.devctl_disable.
This fixes breakage resulting from r263754.

Reported by:	AN <andy@neu.net>
Reviewed by:	imp
Pointy hat to:	me
2014-03-26 02:25:40 +00:00
Dimitry Andric
89963e04a2 Apply a temporary band-aid for building devd with clang 3.4, libstdc++
and -Wsystem-headers enabled (which is the default for any non-zero
WARNS level, crazily enough!).  This is primarily meant to be MFC'd as
soon as possible.

MFC after:	3 days
2014-03-24 20:30:39 +00:00
Alan Somers
6a2ae0eb16 sbin/devd/devd.8
sbin/devd/devd.cc
	Add a -q flag to devd that will suppress syslog logging at
	LOG_NOTICE or below.

Requested by:	ian@ and imp@
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corporation
2014-03-07 23:30:48 +00:00
Alan Somers
f0038a8e98 sbin/devd/devd.cc
Promoting the SIGINFO handler's log message from LOG_INFO to
	LOG_NOTICE, and promoting the "Processing event ..." message from
	LOG_DEBUG to LOG_INFO.  Setting the logfile to LOG_NOTICE with this
	change will have the same result as setting it to LOG_INFO without
	this change.  Setting it to LOG_INFO with this change will include
	the useful "Processing event ..." messages that were previously at
	LOG_DEBUG, without including useless messages like "Pushing table".

	The intent of this change is that one can log "Processing event ..."
	without logging "Pushing table" and related messages that are sent
	for every event.  The number of lines actually logged is reduced by
	about 75% by making this change and setting syslog to LOG_INFO vs
	setting syslog to LOG_DEBUG.

etc/syslog.conf
	Changing the recommended loglevel to notice instead of info.

Sponsored by:	Spectra Logic Corp
MFC after:	4 weeks
2013-12-13 22:58:57 +00:00
Alan Somers
b026eddfea sbin/devd/devd.cc
Increase the size of devd's client socket's send buffer from the
	default (8k) to 128k.  This prevents clients from getting
	POLLHUPped during event storms.  For example, during zpool creation,
	the kernel emits a resource.fs.zfs.statechange event for every vdev
	in the pool.  A 128k buffer is large enough to hold the statechange
	events for a pool with nearly 800 drives.

Reviewed by:	ian, imp
Approved by:	ken (mentor)
Sponsored by:	Spectra Logic Corp
MFC after:	4 weeks
2013-12-13 21:49:41 +00:00
Andriy Gapon
1bb0777e41 devd: lower priority of action execution logging to info
Reviewed by:	asomers
2013-11-07 16:24:31 +00:00
Andriy Gapon
2e024bc22f devd: fix a typo in a comment
Reviewed by:	asomers
2013-11-07 16:22:04 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Alan Somers
3449b15aa2 Correct the printf format specifier for total_events.
Add __printflike argument checking for devdlog().

Reported by: pjd
Approved by: gibbs (co-mentor)
2013-07-08 21:10:30 +00:00
Alan Somers
967ecf4aed Explicitly include <cstdarg> to fix compilation with libc++. It is implicitly
included by libstdc++.

Reported By: Oliver Hartmann
Approved by: gibbs (co-mentor, implicit)
2013-07-02 14:48:39 +00:00
Alan Somers
0285e9b1cf style(9) fixes, including the removal of page break characters. No functional
changes.

Approved by:	gibbs (co-mentor)
2013-07-01 21:49:17 +00:00
Alan Somers
be685e0128 Add a SIGINFO handler to devd. It will send useful statistics to syslog or
stderr as appropriate.  Currently, the only statistic printed is the number of
events received.

Reviewed by:	eadler
Approved by:	gibbs (co-mentor)
2013-07-01 21:33:05 +00:00
Alan Somers
6d1014a32b Add syslog(3) support to devd(8).
sbin/devd/devd.cc
        All output will now go to syslog(3) if devd is daemonized, or stderr
        if it's running in the foreground.

sbin/devd/devd.8
        Remove the "-D" flag.  Filtering messages by priority now
	happens in the usual syslog way.  For performance reasons, a few
	extra-verbose debugging statements are now conditional on the "-d" (do
	not daemonize) flag.

etc/syslog.conf
etc/newsyslog.conf
        Direct messages from devd(8) to /var/log/devd.log, but leave it
        disabled by default

Reviewed by:	eadler
Approved by:	gibbs (co-mentor)
MFC after:	never (removed a command-line option from devd)
2013-07-01 21:20:17 +00:00
Jung-uk Kim
a7880d59c9 Improve compatibility with recent flex from flex.sourceforge.net. 2013-05-03 23:51:32 +00:00
Eitan Adler
d005340fe9 Prefer using the C++ version of the standard headers. These place the
names within the std namespace (and possibly within the global
namespace).

The main advantage is that the C++ versions can provide optimized
versions or simplified interfaces.
2013-05-02 17:02:50 +00:00
Alan Somers
0425e01683 According to devctl(4), clients must read events whole; they may not
piece them together from multiple reads().  It's as if /dev/devctl is
a datagram device instead of a stream device.  However, devd's
internal buffer was too small (1025 bytes) to read an entire
ereport.fs.zfs.checksum event (variable, up to ~1300 bytes).  This
commit enlarges the buffer to 8k.

Reviewed by:	imp
Approved by:	ken (mentor)
MFC after:	2 weeks
2013-04-26 19:49:37 +00:00
Simon J. Gerraty
69e6d7b75e sync from head 2013-04-12 20:48:55 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Eitan Adler
4cb9d1beca devd: Correct typo in comment.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:31 +00:00
Eitan Adler
7d9e9c60a0 devd: Use simpler dst += *x instead of str.append(x, 1).
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:29 +00:00
Eitan Adler
a6393aa163 devd: Use string::empty() instea of string::length() == 0.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:26 +00:00
Eitan Adler
1d9bf149ef devd: Remove unnecessary empty default constructors.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:24 +00:00
Eitan Adler
012148abc2 devd: Remove empty virtual destructor from class, which has noch subclasses.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:22 +00:00
Eitan Adler
5a3b1a3d7c devd: Avoid unnecessary temporary objects (and simplify the code) when handling std::string.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:19 +00:00
Eitan Adler
6d58c721c6 devd: Use the standard constructor of std::string instead of string("").
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:17 +00:00
Eitan Adler
67ae3bf165 devd: Simplify while (1) { if (x) break; } to while (!x) {}.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:15 +00:00
Eitan Adler
4efceb186c devd: Remove call to _exit() from signal handler, which also sets a stop flag.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:12 +00:00
Eitan Adler
fcdcaa8807 devd: Use volatile sig_atomic_t for the flag set by a signal handler.
Submitted by:	Christoph Mallon <christoph.mallon@gmx.de>
Approved by:	cperciva (mentor)
2013-03-04 02:21:08 +00:00
Eitan Adler
11fd1366bc Constify where possible.
Approved by:	cperciva (mentor)
2013-03-04 02:19:55 +00:00
Sergey Kandaurov
75dbe5f2b6 Reflect CARP media-type departure.
X-MFC after:	never
2013-02-21 21:35:09 +00:00
Sergey Kandaurov
fe9a760737 Separate items in the list of System values with .Pp to ease readability. 2013-02-21 20:45:19 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
Niclas Zeising
71c2381938 Bump .Dd for the change in r246121.
Approved by:	joel (mentor)
2013-02-05 14:29:37 +00:00
Ian Lepore
5dfc0f6c53 Improve devd startup time, by tweaking some string handling routines that are
heavily used when parsing config files.  Mostly these changes avoid making
temporary copies of the strings, and avoid doing byte at a time append
operations, on the most-used code path.

On a 1.2 GHz ARM processor this reduces the time to parse the config files
from 13 to 6 seconds.

Reviewed by:	imp
Approved by:	cognet (mentor)
2013-01-30 23:37:35 +00:00
Ian Lepore
e1334f935f Fix a descriptor leak in devd. Clients reading /var/run/devd.pipe can close
their socket connection any time, and devd only notices that when it gets an
error trying to write an event to the client.  On a system with no device
change activity, clients could connect and disappear repeatedly without devd
noticing, leading to an ever-growing list of open socket descriptors in devd.

Now devd uses poll(2) looking for POLLHUP on all existing clients every time
a new client connection is established, and also periodically (once a minute)
to proactively find zombie clients and reap the socket descriptors.  It also
now has a connection limit, configurable with a new -l <num> command line arg.
When the maximum number of connections is reached it stops accepting new
connections until some current clients drop off.

Reviewed by:	imp
Approved by:	cognet (mentor)
2013-01-30 15:21:18 +00:00
Eitan Adler
c3fa0037ba Prefer the use of initalizer lists to ctor assignment.
Approved by:	cperciva
MFC after:	2 weeks
2012-12-06 01:25:21 +00:00
Eitan Adler
edee691dcf Avoid the creation of a temporary object by using the prefix operator
for non-primitive types.

Approved by:	cperciva
MFC after:	2 weeks
2012-12-06 01:25:17 +00:00
Eitan Adler
ef370346d6 Constify where possible
Approved by:	cperciva
MFC after:	2 weeks
2012-12-06 01:25:14 +00:00
Dimitry Andric
0c04d1850f Fix an old bug in devd, where it uses std::sort() to sort the various
lists it reads from its configuration files on the priority field.

Because some items in the lists have the same priority, and std::sort()
is not stable, the exact order in which the items are enumerated does
not have to correspond to the order they appear in the configuration
files.

Apparently this was never noticed with libstdc++, but with libc++ it
could cause the "uhid" entry from /etc/devd/usb.conf to be used instead
of the "ums" entry (which is earlier in the file).  This caused the
problem described in the PR: the USB mouse module was never loaded, and
the other actions (such as starting moused) were not executed.

To fix the problem, make devd use std:stable_sort() instead.

Reported by:	Jan Beich <jbeich@tormail.org>
PR:		bin/172958
MFC after:	2 weeks
2012-12-05 20:50:40 +00:00
Simon J. Gerraty
7cd2dcf076 Updated/new Makefile.depend 2012-11-08 21:24:17 +00:00
Simon J. Gerraty
23090366f7 Sync from head 2012-11-04 02:52:03 +00:00
Andriy Gapon
fcc6af50f0 document acpi_cpu devd notification about _CST change
Based on prodding and a submission by Lars Engels <lars.engels@0x20.net>.

MFC after:	5 days
2012-10-20 09:40:34 +00:00
Pawel Jakub Dawidek
901610f4b8 Use O_CLOEXEC for open instead of separate fcntl(2) call. 2012-09-22 12:42:51 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Dimitry Andric
5d586d29dd Make devd build with libc++.
MFC after:	3 days
2012-06-01 06:56:35 +00:00
Baptiste Daroussin
5e2a209a27 Fix world after byacc import:
- old yacc(1) use to magicially append stdlib.h, while new one don't
- new yacc(1) do declare yyparse by itself, fix redundant declaration of
  'yyparse'

Approved by:	des (mentor)
2012-05-22 16:33:10 +00:00
Gleb Smirnoff
48df024e0f Fix build. 2012-01-06 15:01:05 +00:00
Maxim Konovalov
47483045bc o Sort .Xrs. 2011-12-19 05:09:08 +00:00
Dimitry Andric
b884d5e84a In sbin/devd/devd.h, 'event_proc' and 'eps' are declared as structs. In
devd.hh, there are redeclared as classes.  Fix the inconsistency.

MFC after:	1 week
2011-12-17 01:54:51 +00:00
Gleb Smirnoff
d50b2720a9 Xref re_format(7) in devd.conf(5), not in devd(8).
Pointy hat to:	glebius
2011-12-16 10:21:01 +00:00
Gleb Smirnoff
eecc3092a1 Xref re_format(7). 2011-12-16 10:14:41 +00:00
Hiroki Sato
0321b694c7 - Add support for a "!" character in regex matching in devd(8). It inverts
the logic (true/false) of the matching.

- Add "!usbus[0-9]+" to IFNET ATTACH notification handler in the default
  devd.conf to prevent rc.d/netif from running when usbus[0-9]+ is attached.

Reviewed by:	imp
2011-10-26 02:11:28 +00:00
Bruce M Simpson
e1e3c30189 Typo. For USB devices, 'serial' should be 'sernum'.
See sys/dev/usb/usb_device.c for what devctl_notify() gets.
2011-05-10 02:34:11 +00:00
Rebecca Cran
09c7c81c16 Don't generate input() since it's not used. 2010-11-22 12:33:48 +00:00
Kevin Lo
5983e89162 Fix missing closedir()
Reviewed by:	imp
2010-11-21 04:02:37 +00:00
Warner Losh
9b6cb52091 Allow the kernel to generate more spacy things and still have devd
cope.  Skip multiple spaces in a few contexts.

PR:		96854
Submitted by:	Shin'ya Kumabuchi
MFC after:	1 week
2010-10-09 07:29:13 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Joel Dahl
c2025a7660 Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
2010-08-16 15:18:30 +00:00
Ulf Lilleengen
5bf0842244 - Avoid calling the copy constructor when it is not necessary. 2010-07-29 16:06:40 +00:00
Ulf Lilleengen
a75716fc2d - Remove unused instance of string. 2010-07-29 16:01:10 +00:00
Warner Losh
b8f92ce4de Expand system into my_system, and add the necessary tidyness that we
need.  Close the pidfile.  Then close all descriptors >= 3 to avoid
information leakage to children.

This solves the problem of not being able to restart devd when you
have, for example, a dhclient forked to configure your network...

MFC after:	3 days
2010-06-29 03:52:12 +00:00
Andrew Thompson
139e9ad4d6 Document the new USB notification types. 2010-04-22 20:46:39 +00:00
Ulrich Spörlein
2b6974bf61 Bump WARNS where possible.
Checked by:	make universe
Approved by:	ed (co-mentor)
2010-02-15 14:07:40 +00:00
Maxim Konovalov
01cd0a978f o Spell. Sort .Xrs. 2009-03-08 18:02:30 +00:00
Konstantin Belousov
2e1705590c Document several notifications, among them are DEVFS, update to ifneti,
coretemp and kern.

The asmc(4) and zfs(5) are still not documented.

Based on the patch by Roland Smith <rsmith xs4all nl>.
MFC after:	1 week
2009-03-08 14:28:40 +00:00
Poul-Henning Kamp
0f3311c56f Send all debug to stderr. 2008-12-14 11:48:51 +00:00
Poul-Henning Kamp
877ed37a0d Clarify that configuration files must be named '*.conf' 2008-12-14 11:47:39 +00:00
Warner Losh
d6aed19dfb No need to be gratuitously style(9) non-compliant here, even though
C++ lets me get away with it.
2008-03-21 20:38:28 +00:00
Warner Losh
ec4a9b7ce1 Minor initialization change to not trigger bogus gcc warning about
passing literal strings to the constructors of string.
2007-12-21 01:00:04 +00:00
John Birrell
9538bab38b Reduce the WARNS level across the board due to a warning that occurs
on at least arm and sparc64. i386/pc98, ia64 and amd64 are all OK.
2007-11-19 00:19:01 +00:00
Ruslan Ermilov
f8553712c4 Fix the description of "media-type". 2006-10-24 20:20:41 +00:00
Ruslan Ermilov
ebd1e4e6b8 Revise the markup, sort sections, fix some grammar bugs.
Not fixed: the description of media-type is completely bogus.
2006-10-21 17:15:11 +00:00
John-Mark Gurney
e0c10c6e08 flesh out the devd.conf man page... Mostly from the PR, but did a couple
gramatical tweaks along w/ sorting the list, and adding that serial is
available for USB....

PR:		85097
Submitted by:	Fredrik Lindberg
MFC after:	1 week
2006-10-07 21:15:40 +00:00
Ruslan Ermilov
5ef35a9854 Add -f option to program's usage(), fix manpage's SYNOPSIS. 2006-09-17 22:49:26 +00:00
Maxim Konovalov
4a3050fc46 o Yacc's lineno variable holds a total number of parsed lines.
Reset it to 1 for each devd config file so if the parser finds
a syntax error devd(8) will report a correct line number.

Submitted by:	Niki Denev
MFC after:	2 weeks
2006-04-14 07:20:42 +00:00
Pawel Jakub Dawidek
1a0cc6b19e Use pidfile(3).
OK'ed by:	imp
2006-01-30 22:50:13 +00:00
Warner Losh
9cb4a7bd64 It was always intended that regular expression matching be case
insensitive.  Make it so.
2006-01-08 05:18:36 +00:00
Joseph Koshy
80615950df Rev 1.15 should have incremented the date on this manual page. 2005-12-19 02:55:44 +00:00
Joseph Koshy
8334958a7f 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>
2005-11-24 14:39:41 +00:00
Alexander Nedotsukov
13f8bb7143 Reuse delete_and_clear() template helper.
Approved by:	imp
2005-11-14 02:01:10 +00:00
Brooks Davis
94d2d4eb04 Make devd WARNS=4 clean and bump WARNS accordingly. This will insure
that future variable shadowing bugs don't compile.

Reviewed by:	imp
Compiled on:	alpha i386 sparc64
2005-10-19 21:21:22 +00:00
Warner Losh
de02eec866 As pointed out on current@, we don't want to declare a variable in a scope
that just uses the variable and throws it away.

This should fix the subsystem keyword wrt media-type.

MFC After: 2 days
2005-10-19 18:10:34 +00:00
Warner Losh
09c47e76fb media-type predicate is used in contexts where device-name is undefined.
In those contexted, use subsystem instead.

# This causes dhclient to run again when I plug in my ethernet cable to
# my fxp card in my laptop.
2005-10-04 22:22:51 +00:00
Joe Marcus Clarke
e60fa01486 * Open permissions on /var/run/devd.pipe so that any user can read devd events
from this socket
* Enable non-blocking I/O on devd.pipe to keep clients from wedging devd.
  If a write(2) on devd.pipe would block, the client in question will be
  removed [1]

Requested by:	rwatson [1]
Approved by:	imp
2005-07-13 17:28:11 +00:00
Joe Marcus Clarke
8381892977 Replace fch{mod,own} with straight ch{mod,own} as the former cannot be used
on socket file descriptors.

Reviewed by:	secteam (cperciva)
Approved by:	imp
2005-07-13 17:10:47 +00:00
Warner Losh
cd70782b39 Add the ability to match the on a media type of the device in question.
Submitted by: sam
Approved by: re (scottl)
2005-07-10 03:37:15 +00:00
Warner Losh
f32a7686ec Ignore sigpipe so we can properly detach clients to the pipe.
Submitted by: Fredrik Lindberg
2005-05-16 20:51:46 +00:00
Warner Losh
528d3f7955 Fix parsing of nomatch events.
minor debug fix.
2005-04-18 02:54:07 +00:00
Ruslan Ermilov
8d646af581 Sync program's usage() with manpage's SYNOPSIS. 2005-02-10 09:19:34 +00:00
Ruslan Ermilov
214144704b Scheduled mdoc(7) sweep. 2005-01-10 16:17:34 +00:00
Ruslan Ermilov
83c7ade90a NOSHARED -> NO_SHARED 2004-12-21 09:59:45 +00:00
Ceri Davies
e33bdcedbc Clarify that devd will only parse files whose names end in .conf.
Prompted by

PR:		docs/73668
Submitted by:	Dan Pelleg
MFC After:	3 days
2004-11-28 17:44:22 +00:00
Ruslan Ermilov
2410103c1d mdoc(7) fixes. 2004-07-07 19:57:16 +00:00
Warner Losh
251bedd15b Create a unix domain socket and write to it all the events that come
in over the socket.
2004-07-01 07:24:18 +00:00
Warner Losh
842ccec57e Parse the ! lines that will soon be coming from the kernel. These are
a generalized notification mechanism for subsystems wishing to report
events.

Revieded by: njl

# The kernel side seems like it might be causing panics for me, but should
# be forthcoming shortly.
2003-10-24 22:02:29 +00:00
Ralf S. Engelschall
ffd1bc0626 fix typo: s/Instaed/Instead/ 2003-09-26 12:24:16 +00:00
Gordon Tetlow
9a4e73fe5e At imp's request, force devd to be statically compiled. This avoids the
need for libstdc++ in /lib, and the generated binary is actually smaller
statically linked than dynamically + sizeof(libstdc++). Additionally,
devd doesn't use get*by*() which is one of the main motivations for
dynamically linking your root partition anyway.
2003-08-17 08:40:49 +00:00
Warner Losh
fc3a3ee720 Simplistic C comment re is wrong, use more correct one 2003-07-23 23:50:25 +00:00
Warner Losh
f30595058e Remove old workaround 2003-07-23 23:50:00 +00:00
Warner Losh
fd6a8f23ef Drop the pid file after we call the final daemon call. w/o -n would
give the wrong pid.

Submitted by: ru and Lukas Ertl
PR: 54113
2003-07-05 00:43:50 +00:00
Ruslan Ermilov
d5986fac3a mdoc(7) fixes: Expand contraction. 2003-05-17 22:21:27 +00:00
Warner Losh
18e8d6d786 Allow zero or more actions in an action list, rather than requiring
one or more actions in the list.  This makes constructs like:

attach 10 {
//	echo "Driver $device_name attached"
};

to be accepted by the parser.  It will be treated as if the user had
entered:

// attach 10 {
//	echo "Driver $device_name attached"
// };

(eg totally ignored).

Approved by: re@ (rwatson)
2003-05-15 02:23:32 +00:00
Warner Losh
79f92e2597 sysctlbyname takes a size_t as its 5th argument, not a pointer.
However, since NULL was used, and this is C++, this error went
undetected until g++ 3.3 somehow managed to whine about it.

Reported by: obrien
2003-05-02 17:38:08 +00:00
Warner Losh
6aeeca8edf Create a new C++ header file called devd.hh which has all the class
definitions in it.  Begin to document the classes that we use, and how
they interrelate (using comments that I can use with doxygen to
automatically generate docs with).
2003-04-26 20:59:04 +00:00
Warner Losh
66ff6821dd Update to use is_id_char() in the last patch. I should have done this
before the last commit.
2003-04-26 20:25:40 +00:00
Warner Losh
6cabd675ee Make better use of the string type when parsing things. This switches
expand one from using a fixed buffer to using a string which
dynamically allocates these things.

Submitted by: green@ (against an earlier version of devd)
Ignored for too long by: imp
2003-04-26 19:44:45 +00:00
Warner Losh
812f53a7b5 Change default to be 'process all events before calling daemon.'
Also, put a small work around into devd to prevent a hang on boot this
would cause because select used to return 2 rather than 0 for no
evetnts due to a bug I fixed a few days ago in subr_bus.c.  I'll
remove this workaround May 7th.  You have until then to upgrade your
kernel if you want to run a new devd with an older kernel.
2003-04-25 02:13:42 +00:00
Warner Losh
01ee1d1668 Kill debug printf that crept in my last commit 2003-04-21 17:25:39 +00:00
Warner Losh
5a882d775d Implement a two new flags, and change the meaning of another one.
'd': now means don't do daemon().
'D': Debug
'n': Don't wait to process all pending events before calling daemon.

In the past, devd would call daemon immediately.  However, this causes
a race.  If anything in the boot process depends on configuring the
devices configured by devd, maybe they would be configured in time,
maybe not.  Now we don't call daemon until all pending events are
processed, unless -n is specified.

# -n is actually the default for a while due to the select(2) bug in devctl
# that I just fixed to give people a chance to upgrade.
2003-04-21 06:26:08 +00:00
Warner Losh
9c1808986c 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.
2003-04-21 04:30:12 +00:00
Warner Losh
b1ee04b18e o Skip white space between variables better. This makes
'a="b" c="d" at loc=1 on busN' properly set 'c' and process the rest of
  the stirng.  Before it would ignore everything after variable 'a'.
o Parse nomatch and other events differently.  They are more different
  than the code allowed for, so we weren't properly parsing nomatch
  events.  It appears this fixes some of the demand loading issues that
  I was having with devd.

Noticed by: Gary Palmer
2003-04-21 04:00:01 +00:00
Warner Losh
3f2660bee3 devd.conf already has the examples in the todo list 2003-04-21 03:29:53 +00:00
Ruslan Ermilov
887c67148e This can't obviously be cleaner than system headers. 2003-04-01 11:11:38 +00:00
Ruslan Ermilov
f1e65894d2 mdoc(7) police: Revision. 2003-03-03 11:51:30 +00:00
Warner Losh
baa3851626 The bugs section hasn't been true since before 5.0-R 2003-02-14 19:49:19 +00:00
Warner Losh
93c6603a41 devd bugs section is now OBE 2003-02-14 16:21:50 +00:00
Warner Losh
c3207b4d9a These are OBE. devd.conf now lives in /etc. 2003-01-09 04:11:19 +00:00
Warner Losh
9f9bcbde42 Terminate the usage message with \n.
Submitted by: joe
2003-01-06 16:46:25 +00:00
Warner Losh
8b823408c6 MFp4: make it work
o Expand variables correctly.
o Set variables for each event.
o rewrite event loop to execute the commands in the config file, rather
  than the hard wired generic command
o better(?) debug when running -d
o sort vectors of actions so that we just have to search for the first
  one to match rather than the best one that matches.
o better attempts to clear all resources used on 'restart'
o Remove now bogus comments

MFC After: 1 centiyear
2003-01-06 08:09:41 +00:00
Warner Losh
267e74adbd devd not devdd
submitted by: joe
2003-01-06 08:03:00 +00:00
Jens Schweikhardt
57bd0fc6e8 english(4) police. 2002-12-27 12:15:40 +00:00
Warner Losh
5102ef8416 Latest snapshot of devd. This one adds re-matching and string
expansion.
2002-12-18 07:08:01 +00:00
Warner Losh
3054f218eb MFp4 (imp_freebsd branch): snapshot of devd work:
o improve parsing and lexing
o create data structures based on the parsed file now.
o Still need to rewrite main loop and add regex (still uses hard coded
  devd-generic)
o minor man page updates.

# There should be one more commit before rc2

Approved by: re (blanket)
2002-12-07 08:04:36 +00:00
John Baldwin
b665be6839 Fixup FILES section to use proper width and to use a cross-reference to
devd(8).
2002-11-18 21:07:48 +00:00
John Baldwin
85fb48dae3 Remove leading ^ from example of match line in vendor-supplied rules since
the ^ is implicit at the beginning of the expressions.
2002-11-18 21:02:29 +00:00