summaryrefslogtreecommitdiff
path: root/src/shutdownd
Commit message (Collapse)AuthorAgeFilesLines
* include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen2015-02-121-1/+1
| | | | | | include-what-you-use automatically does this and it makes finding unnecessary harder to spot. The only content of poll.h is a include of sys/poll.h so should be harmless.
* Revert "tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC"Lennart Poettering2015-02-121-1/+1
| | | | | | | This reverts commit d6d810fbf8071f8510450dbacd1d083f37603656. It's apparently not OK to pass MSG_CMSG_CLOEXEC to recvmsg() of raw sockets.
* tree-wide: Always use recvmsg with MSG_CMSG_CLOEXECCristian Rodríguez2015-02-101-1/+1
|
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-9/+9
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: yet more log_*_errno + return simplificationsMichal Schmidt2014-11-281-8/+4
| | | | | | | | | | | | | Using: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/(if\s*\([^\n]+\))\s*{\n(\s*)(log_[a-z_]*_errno\(\s*([->a-zA-Z_]+)\s*,[^;]+);\s*return\s+\g4;\s+}/\1\n\2return \3;/msg; print;' $f done And a couple of manual whitespace fixups.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-4/+4
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-281-4/+4
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* shutdownd: clean up initialization of structThomas Hindoe Paaboel Andersen2014-09-271-2/+2
| | | | | | No functional change. We just don't assign the value twice. Found by coverity. Fixes: CID#1237616 and #1237617
* notify: send STOPPING=1 from our daemonsLennart Poettering2014-08-211-0/+1
|
* Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek2014-07-311-2/+2
| | | | | | In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
* Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek2014-05-151-2/+2
| | | | No functional change expected :)
* util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering2014-03-181-2/+1
| | | | | | | | | | | | | | | safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
* utmp-wtmp: allow overriding username on wallSebastian Thorarensen2014-03-141-1/+1
| | | | | | | utmp_wall() now takes an optional argument 'username_override' which allows the caller to override the username shown on wall messages. journald will use this to inform users that its wall messages comes from 'systemd-journald'.
* shutdownd: modernizationsZbigniew Jędrzejewski-Szmek2014-03-041-17/+9
|
* Update some message formatsZbigniew Jędrzejewski-Szmek2014-02-051-2/+2
| | | | | | | | Use PID_FMT/USEC_FMT/... in more places. Also update logind error messages to print the full path to a file that failed. This should make debugging easier for people who do not know off the top of their head where logind stores it state.
* Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek2013-05-021-1/+1
| | | | | | | | I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
* Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek2013-04-051-23/+18
| | | | | | | | | | | | | | | | | | | | | | | Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
* util: rename write_one_line_file() to write_string_file()Lennart Poettering2013-04-031-1/+1
| | | | | You can write much more than just one line with this call (and we frequently do), so let's correct the naming.
* shutdownd: shut up bogus gcc warningZbigniew Jędrzejewski-Szmek2013-03-211-13/+10
| | | | | | | | | | This one is fake. But let's kill it, avoiding two condition checks in the process. src/shutdownd/shutdownd.c: In function 'when_wall': src/shutdownd/shutdownd.c:182:44: warning: 'sub' may be used uninitialized in this function [-Wmaybe-uninitialized] return elapse > sub ? elapse - sub : 1; ^
* honor SELinux labels, when creating and writing config filesHarald Hoyer2013-02-141-0/+1
| | | | | | | Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
* shutdown: allow to specify broadcast message when cancelling shutdownMichal Sekletar2012-08-061-0/+4
| | | | makes shutdown behaviour more compatible
* log.h: new log_oom() -> int -ENOMEM, use itShawn Landden2012-07-261-4/+2
| | | | | | also a number of minor fixups and bug fixes: spelling, oom errors that didn't print errors, not properly forwarding error codes, few more consistency issues, et cetera
* use "Out of memory." consistantly (or with "\n")Shawn Landden2012-07-251-1/+1
| | | | | | | | glibc/glib both use "out of memory" consistantly so maybe we should consider that instead of this. Eliminates one string out of a number of binaries. Also fixes extra newline in udev/scsi_id
* mkdir: append _label to all mkdir() calls that explicitly set the selinux ↵Kay Sievers2012-05-311-1/+1
| | | | context
* build-sys: add stub makefiles to all subdirs to ease development with emacsLennart Poettering2012-04-131-0/+1
|
* move all tools to subdirsKay Sievers2012-04-121-0/+476