summaryrefslogtreecommitdiffstats
path: root/sbin/devd
Commit message (Collapse)AuthorAgeFilesLines
* MFC r320165-r320166asomers2017-07-312-1/+3
| | | | | | | | | | | | | | | | r320165: devd(8): Remove pidfile on shutdown Sponsored by: Spectra Logic Corp r320166: Require devd to be running for its ATF tests to run The ATF tests communicate with the system's running devd PR: 220169 Reported by: gjb Sponsored by: Spectra Logic Corp
* MFC r311572, r311895, r311928, r311985, r312395, r312417asomers2017-02-281-5/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r311572: Fix file descriptor leaks in cmp(1) Also, add a few test cases Reported by: Coverity CID: 271624 275338 Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9074 r311895: Fix memory leaks during "tail -r" of an irregular file * Rewrite r_buf to use standard tail queues instead of a hand-rolled circular linked list. Free dynamic allocations when done. * Remove an optimization for the case where the file is a multiple of 128KB in size and there is a scarcity of memory. * Add ATF tests for "tail -r" and its variants. Reported by: Valgrind Reviewed by: ngie MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9067 r311928: Fix build of usr.bin/tail with GCC Submitted by: pluknet Reported by: pluknet MFC after: 27 days X-MFC-with: 311895 Sponsored by: Spectra Logic Corp r311985: Fix uninitialized variable CIDs in route6d The variables in question are actually return arguments, but it's still good form to initialize them. Reported by: Coverity CID: 979679 979680 MFC after: 4 weeks Sponsored by: Spectra Logic Corp r312395: Fix several Coverity CIDs in devd CID 1362055, 1362054: File descriptor leaks during shutdown CID 1362013: Potential null-termination fail with long network device names CID 1362097: Uncaught exception during memory pressure CID 1362017, 1362016: Unchecked errors, possibly resulting in weird behavior if two devd instances start at the same time. CID 1362015: Unchecked error that will probably never fail Reported by: Coverity CID: 1362055 1362054 1362013 1362097 1362017 1362016 1362015 MFC after: 4 weeks Sponsored by: Spectra Logic Corp r312417: Fix build of devd with GCC 4.2 Reported by: olivier Pointy-hat-to: asomers MFC after: 27 days X-MFC-with: 312395 Sponsored by: Spectra Logic Corp
* MFC r289172,r290254:ngie2017-02-091-2/+0
| | | | | | | | | | | | | | | | r289172: 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 r290254: Remove unused variable (SRCDIR)
* MFC r306840:sevan2016-10-161-3/+3
| | | | | | | | | Sort SEE ALSO section sequentially. Highlighted by mandoc -Tlint PR: 212440 Approved by: imp Differential Revision: https://reviews.freebsd.org/D8192
* MFC r306727:sevan2016-10-161-2/+8
| | | | | | | | | Add history section for devd(8) Move sentence to a new line as advised by igor PR: 212439 Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D8104
* MFC r298420, r298439, r298644asomers2016-05-191-0/+2
| | | | | | | | | | | | | | | | | | | | | r298420 | asomers | 2016-04-21 10:43:15 -0600 (Thu, 21 Apr 2016) | 10 lines Notify userspace listeners when geom disk attributes have changed sys/geom/geom_disk.c: disk_attr_changed(): Generate a devctl event of type GEOM:<attr> for every call. r298439 | asomers | 2016-04-21 15:13:41 -0600 (Thu, 21 Apr 2016) | 10 lines DRY on buffer sizes. Update to r298420. sys/geom/geom_disk.c: In disk_attr_changed, don't repeat a buffer size. r298644 | asomers | 2016-04-26 08:48:58 -0600 (Tue, 26 Apr 2016) | 8 lines Add GEOM::physpath documentation to devd.conf(5)
* Merge r298008scottl2016-04-171-2/+20
| | | | | | Update the devd.conf man page to describe the new CAM/periph system/subsystem. Sponsored by: Netflix
* MFC 297838asomers2016-04-141-39/+27
| | | | | | | | | Fix an intermittent bug in sbin/devd/client_test.stream In case where the two events were being received in separate reads, the event buffer was being null-terminated at the wrong offset. Also, factored out some common code between the tests, and fixed a comment.
* MFC 270231asomers2016-04-081-3/+9
| | | | | | | | | 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.
* 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 r285674:trasz2015-08-021-0/+4
| | | | | | Document suspend/resume notification in devd.conf(5). Sponsored by: The FreeBSD Foundation
* MFC r285673:trasz2015-08-021-1/+21
| | | | | | Add CARP events description to devd.conf(5). Sponsored by: The FreeBSD Foundation
* MFC r282857:trasz2015-06-211-1/+23
| | | | | | Document RCTL events in devd.conf(5). Sponsored by: The FreeBSD Foundation
* MFC r277170:trasz2015-05-151-1/+28
| | | | | | Add devd(8) notifications for creation and destruction of GEOM devices. Sponsored by: The FreeBSD Foundation
* MFC devd-related changesasomers2014-08-205-38/+276
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 r263774:dim2014-03-291-1/+0
| | | | | | | | 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 r262914asomers2014-03-282-13/+19
| | | | | | | 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 r263694:dim2014-03-271-0/+1
| | | | | | | 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 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-012-36/+60
| | | | | | | | | | | | | | | | | | | | | 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)
* Improve compatibility with recent flex from flex.sourceforge.net.jkim2013-05-031-2/+3
|
* 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.
* According to devctl(4), clients must read events whole; they may notasomers2013-04-261-1/+1
| | | | | | | | | | | | 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
* 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: Remove unnecessary empty default constructors.eadler2013-03-041-2/+0
| | | | | Submitted by: Christoph Mallon <christoph.mallon@gmx.de> Approved by: cperciva (mentor)
* devd: Remove empty virtual destructor from class, which has noch subclasses.eadler2013-03-041-1/+0
| | | | | 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: Use the standard constructor of std::string instead of string("").eadler2013-03-041-1/+1
| | | | | 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-042-2/+2
| | | | Approved by: cperciva (mentor)
* Reflect CARP media-type departure.pluknet2013-02-211-3/+2
| | | | X-MFC after: never
* Separate items in the list of System values with .Pp to ease readability.pluknet2013-02-211-0/+4
|
* Bump .Dd for the change in r246121.zeising2013-02-051-1/+1
| | | | Approved by: joel (mentor)
* Improve devd startup time, by tweaking some string handling routines that areian2013-01-302-25/+32
| | | | | | | | | | | | 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-302-14/+95
| | | | | | | | | | | | | | | | | 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-062-3/+2
| | | | | 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-062-7/+7
| | | | | 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
* document acpi_cpu devd notification about _CST changeavg2012-10-201-0/+2
| | | | | | Based on prodding and a submission by Lars Engels <lars.engels@0x20.net>. MFC after: 5 days
OpenPOWER on IntegriCloud