summaryrefslogtreecommitdiffstats
path: root/sbin/devd/devd.cc
Commit message (Collapse)AuthorAgeFilesLines
* MFC r292020asomers2016-01-111-6/+17
| | | | | | | 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 r289677:bdrewery2016-01-071-1/+1
| | | | Fix a ton of speelling errors
* MFC devd-related changesasomers2014-08-201-29/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r270004 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. r270019 (from bz) 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
* MFC r263758:mjg2014-03-311-4/+4
| | | | | | Update userspace users of hw.bus.devctl_disable. This switches the code to use hw.bus.devctl_queue instead.
* MFC r262914asomers2014-03-281-12/+16
| | | | | | | sbin/devd/devd.8 sbin/devd/devd.cc Add a -q flag to devd that will suppress syslog logging at LOG_NOTICE or below.
* MFC 259339asomers2014-01-101-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. MFC 259362 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.
* Correct the printf format specifier for total_events.asomers2013-07-081-2/+3
| | | | | | | Add __printflike argument checking for devdlog(). Reported by: pjd Approved by: gibbs (co-mentor)
* Explicitly include <cstdarg> to fix compilation with libc++. It is implicitlyasomers2013-07-021-0/+1
| | | | | | | included by libstdc++. Reported By: Oliver Hartmann Approved by: gibbs (co-mentor, implicit)
* style(9) fixes, including the removal of page break characters. No functionalasomers2013-07-011-19/+19
| | | | | | changes. Approved by: gibbs (co-mentor)
* Add a SIGINFO handler to devd. It will send useful statistics to syslog orasomers2013-07-011-0/+19
| | | | | | | | stderr as appropriate. Currently, the only statistic printed is the number of events received. Reviewed by: eadler Approved by: gibbs (co-mentor)
* Add syslog(3) support to devd(8).asomers2013-07-011-32/+58
| | | | | | | | | | | | | | | | | | | | | 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)
* Prefer using the C++ version of the standard headers. These place theeadler2013-05-021-6/+7
| | | | | | | | 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.
* devd: Correct typo in comment.eadler2013-03-041-1/+1
| | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Approved by: cperciva (mentor)
* devd: Use simpler dst += *x instead of str.append(x, 1).eadler2013-03-041-6/+6
| | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Approved by: cperciva (mentor)
* devd: Use string::empty() instea of string::length() == 0.eadler2013-03-041-1/+1
| | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Approved by: cperciva (mentor)
* devd: Avoid unnecessary temporary objects (and simplify the code) when ↵eadler2013-03-041-3/+3
| | | | | | | handling std::string. Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Approved by: cperciva (mentor)
* devd: Simplify while (1) { if (x) break; } to while (!x) {}.eadler2013-03-041-3/+1
| | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Approved by: cperciva (mentor)
* devd: Remove call to _exit() from signal handler, which also sets a stop flag.eadler2013-03-041-1/+0
| | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Approved by: cperciva (mentor)
* devd: Use volatile sig_atomic_t for the flag set by a signal handler.eadler2013-03-041-2/+2
| | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Approved by: cperciva (mentor)
* Constify where possible.eadler2013-03-041-1/+1
| | | | Approved by: cperciva (mentor)
* Improve devd startup time, by tweaking some string handling routines that areian2013-01-301-23/+29
| | | | | | | | | | | | 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)
* Fix a descriptor leak in devd. Clients reading /var/run/devd.pipe can closeian2013-01-301-14/+88
| | | | | | | | | | | | | | | | | 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)
* Prefer the use of initalizer lists to ctor assignment.eadler2012-12-061-2/+1
| | | | | Approved by: cperciva MFC after: 2 weeks
* Avoid the creation of a temporary object by using the prefix operatoreadler2012-12-061-9/+9
| | | | | | | for non-primitive types. Approved by: cperciva MFC after: 2 weeks
* Constify where possibleeadler2012-12-061-4/+4
| | | | | Approved by: cperciva MFC after: 2 weeks
* Fix an old bug in devd, where it uses std::sort() to sort the variousdim2012-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | 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
* Use O_CLOEXEC for open instead of separate fcntl(2) call.pjd2012-09-221-3/+1
|
* Make devd build with libc++.dim2012-06-011-1/+1
| | | | MFC after: 3 days
* Fix build.glebius2012-01-061-1/+0
|
* - Add support for a "!" character in regex matching in devd(8). It invertshrs2011-10-261-3/+13
| | | | | | | | | 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
* Fix missing closedir()kevlo2010-11-211-0/+1
| | | | Reviewed by: imp
* Allow the kernel to generate more spacy things and still have devdimp2010-10-091-0/+8
| | | | | | | | cope. Skip multiple spaces in a few contexts. PR: 96854 Submitted by: Shin'ya Kumabuchi MFC after: 1 week
* - Avoid calling the copy constructor when it is not necessary.lulf2010-07-291-4/+3
|
* - Remove unused instance of string.lulf2010-07-291-1/+0
|
* Expand system into my_system, and add the necessary tidyness that weimp2010-06-291-2/+94
| | | | | | | | | | 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
* Send all debug to stderr.phk2008-12-141-2/+2
|
* Add -f option to program's usage(), fix manpage's SYNOPSIS.ru2006-09-171-1/+1
|
* o Yacc's lineno variable holds a total number of parsed lines.maxim2006-04-141-0/+1
| | | | | | | | 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
* Use pidfile(3).pjd2006-01-301-9/+30
| | | | OK'ed by: imp
* It was always intended that regular expression matching be caseimp2006-01-081-1/+1
| | | | insensitive. Make it so.
* Add a -f configfile option to devd(8), based on a patch submitted byjkoshy2005-11-241-2/+7
| | | | | | Wojciech A. Koszek. Submitted by: Wojciech A. Koszek <dunstan@freebsd.czest.pl>
* Reuse delete_and_clear() template helper.bland2005-11-141-5/+1
| | | | Approved by: imp
* Make devd WARNS=4 clean and bump WARNS accordingly. This will insurebrooks2005-10-191-2/+2
| | | | | | | that future variable shadowing bugs don't compile. Reviewed by: imp Compiled on: alpha i386 sparc64
* As pointed out on current@, we don't want to declare a variable in a scopeimp2005-10-191-1/+1
| | | | | | | | that just uses the variable and throws it away. This should fix the subsystem keyword wrt media-type. MFC After: 2 days
* media-type predicate is used in contexts where device-name is undefined.imp2005-10-041-1/+9
| | | | | | | 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.
* * Open permissions on /var/run/devd.pipe so that any user can read devd eventsmarcus2005-07-131-1/+3
| | | | | | | | | | 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
* Replace fch{mod,own} with straight ch{mod,own} as the former cannot be usedmarcus2005-07-131-2/+2
| | | | | | | on socket file descriptors. Reviewed by: secteam (cperciva) Approved by: imp
* Add the ability to match the on a media type of the device in question.imp2005-07-101-0/+74
| | | | | Submitted by: sam Approved by: re (scottl)
* Ignore sigpipe so we can properly detach clients to the pipe.imp2005-05-161-0/+2
| | | | Submitted by: Fredrik Lindberg
* Fix parsing of nomatch events.imp2005-04-181-3/+6
| | | | minor debug fix.
OpenPOWER on IntegriCloud