aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zed/zed_log.c
Commit message (Collapse)AuthorAgeFilesLines
* Add missing includes to zed_log.cRichard Yao2017-04-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 4.9.4 complains about implicit function declarations when building against musl on Gentoo. zed_log.c: In function ‘zed_log_pipe_open’: zed_log.c:69:7: warning: implicit declaration of function ‘getpid’ (int)getpid()); ^ zed_log.c:71:2: warning: implicit declaration of function ‘pipe’ if (pipe(_ctx.pipe_fd) < 0) ^ zed_log.c: In function ‘zed_log_pipe_close_reads’: zed_log.c:90:2: warning: implicit declaration of function ‘close’ if (close(_ctx.pipe_fd[0]) < 0) ^ zed_log.c: In function ‘zed_log_pipe_wait’: zed_log.c:141:3: warning: implicit declaration of function ‘read’ n = read(_ctx.pipe_fd[0], &c, sizeof (c)); The [-Wimplicit-function-declaration] at the end of each warning has been removed to meet comment style requirements. The man pages say to include <sys/types.h> and <unistd.h>. Doing that silences the warnings. Reviewed-by: loli10K <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: George Melikov <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #5993
* Use cstyle -cpP in `make cstyle` checkBrian Behlendorf2016-12-121-8/+8
| | | | | | | | | | | | | | | | | | | | | | | Enable picky cstyle checks and resolve the new warnings. The vast majority of the changes needed were to handle minor issues with whitespace formatting. This patch contains no functional changes. Non-whitespace changes are as follows: * 8 times ; to { } in for/while loop * fix missing ; in cmd/zed/agents/zfs_diagnosis.c * comment (confim -> confirm) * change endline , to ; in cmd/zpool/zpool_main.c * a number of /* BEGIN CSTYLED */ /* END CSTYLED */ blocks * /* CSTYLED */ markers * change == 0 to ! * ulong to unsigned long in module/zfs/dsl_scan.c * rearrangement of module_param lines in module/zfs/metaslab.c * add { } block around statement after for_each_online_node Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Håkan Johansson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #5465
* Update ZED copyright boilerplateChris Dunlap2015-05-111-21/+9
| | | | | | | | | | | | | | | | | | | | | | This commit updates the copyright boilerplate within the ZED subtree. The instructions for appending a contributor copyright line have been removed. Manually maintaining copyright notices in this manner is error-prone, imprecise at a file-scope granularity, and oftentimes inaccurate. These lines can become a pernicious source of merge conflicts. A commit log is better suited to maintaining this information. Consequently, a line has been added to the boilerplate to refer to the git commit log for authoritative copyright attribution. To account for the scenario where a file may become separated from the codebase and commit history (i.e., it is copied somewhere else), a line has been added to identify the file's origin. http://softwarefreedom.org/resources/2012/ManagingCopyrightInformation.html Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #3384
* Remove reverse indentation from zed comments.Chris Dunlap2014-09-221-9/+13
| | | | | | | | | Remove all occurrences of reverse indentation from zed comments for consistency within the project code base. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2695
* Cleanup zed loggingChris Dunlap2014-09-021-53/+49
| | | | | | | | | | | | | | This is a set of minor cleanup changes related to zed logging: - Remove the program identity prefix from messages written to stderr since systemd already prepends this output with the program name. - Replace the copy of the program identity string with a ptr reference. - Replace "pid" with "PID" for consistency in comments & strings. - Rename the zed_log.c struct _ctx component "level" to "priority". - Add the LOG_PID option for messages written to syslog. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2252
* Fix race condition with zed pidfile creationChris Dunlap2014-09-021-0/+95
| | | | | | | | | | | | | | | | | | | When the zed is started as a forking daemon (by default), a race-condition exists where the parent process can terminate before the pidfile has been created by the grandchild process. When invoked as a Type=forking systemd service, this can result in the following: systemd[1]: Starting ZFS Event Daemon (zed)... systemd[1]: PID file /var/run/zed.pid not readable (yet?) after start. This commit adds a daemonize pipe to allow the grandchild process to signal the parent process that initialization is complete (and the pidfile has been created). The parent process will wait for this notification before exiting. Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2252
* Initial implementation of zed (ZFS Event Daemon)Chris Dunlap2014-04-021-0/+171
zed monitors ZFS events. When a zevent is posted, zed will run any scripts that have been enabled for the corresponding zevent class. Multiple scripts may be invoked for a given zevent. The zevent nvpairs are passed to the scripts as environment variables. Events are processed synchronously by the single thread, and there is no maximum timeout for script execution. Consequently, a misbehaving script can delay (or forever block) the processing of subsequent zevents. Plans are to address this in future commits. Initial scripts have been developed to log events to syslog and send email in response to checksum/data/io errors and resilver.finish/scrub.finish events. By default, email will only be sent if the ZED_EMAIL variable is configured in zed.rc (which is serving as a config file of sorts until a proper configuration file is implemented). Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2