summaryrefslogtreecommitdiff
path: root/src/initctl
Commit message (Collapse)AuthorAgeFilesLines
* headers: remove unneeded includes from util.hZbigniew Jędrzejewski-Szmek2019-03-271-0/+2
| | | | | This means we need to include many more headers in various files that simply included util.h before, but it seems cleaner to do it this way.
* util: split out memcmp()/memset() related calls into memory-util.[ch]Lennart Poettering2019-03-131-2/+2
| | | | Just some source rearranging.
* initctl: shorten and update code a bitLennart Poettering2019-01-171-6/+2
|
* coccinelle: make use of SYNTHETIC_ERRNOZbigniew Jędrzejewski-Szmek2018-11-221-4/+3
| | | | | | | | | | | Ideally, coccinelle would strip unnecessary braces too. But I do not see any option in coccinelle for this, so instead, I edited the patch text using search&replace to remove the braces. Unfortunately this is not fully automatic, in particular it didn't deal well with if-else-if-else blocks and ifdefs, so there is an increased likelikehood be some bugs in such spots. I also removed part of the patch that coccinelle generated for udev, where we returns -1 for failure. This should be fixed independently.
* log: introduce new helper call log_setup_service()Lennart Poettering2018-11-201-3/+1
| | | | | Let's reduce the common boilerplate and have a single setup function used by all service code to setup logging.
* initctl: do not ignore errors in functionYu Watanabe2018-08-071-7/+7
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-3/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* log: minimize includes in log.hLennart Poettering2018-01-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | log.h really should only include the bare minimum of other headers, as it is really pulled into pretty much everything else and already in itself one of the most basic pieces of code we have. Let's hence drop inclusion of: 1. sd-id128.h because it's entirely unneeded in current log.h 2. errno.h, dito. 3. sys/signalfd.h which we can replace by a simple struct forward declaration 4. process-util.h which was needed for getpid_cached() which we now hide in a funciton log_emergency_level() instead, which nicely abstracts the details away. 5. sys/socket.h which was needed for struct iovec, but a simple struct forward declaration suffices for that too. Ultimately this actually makes our source tree larger (since users of the functionality above must now include it themselves, log.h won't do that for them), but I think it helps to untangle our web of includes a tiny bit. (Background: I'd like to isolate the generic bits of src/basic/ enough so that we can do a git submodule import into casync for it)
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* tree-wide: make use of getpid_cached() wherever we canLennart Poettering2017-07-201-2/+2
| | | | | | | This moves pretty much all uses of getpid() over to getpid_raw(). I didn't specifically check whether the optimization is worth it for each replacement, but in order to keep things simple and systematic I switched over everything at once.
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4
* Rename formats-util.h to format-util.hZbigniew Jędrzejewski-Szmek2016-11-071-1/+1
| | | | | | We don't have plural in the name of any other -util files and this inconsistency trips me up every time I try to type this file name from memory. "formats-util" is even hard to pronounce.
* tree-wide: make ++/-- usage consistent WRT spacingVito Caputo2016-02-221-1/+1
| | | | | | Throughout the tree there's spurious use of spaces separating ++ and -- operators from their respective operands. Make ++ and -- operator consistent with the majority of existing uses; discard the spaces.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2015-11-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GLIB has recently started to officially support the gcc cleanup attribute in its public API, hence let's do the same for our APIs. With this patch we'll define an xyz_unrefp() call for each public xyz_unref() call, to make it easy to use inside a __attribute__((cleanup())) expression. Then, all code is ported over to make use of this. The new calls are also documented in the man pages, with examples how to use them (well, I only added docs where the _unref() call itself already had docs, and the examples, only cover sd_bus_unrefp() and sd_event_unrefp()). This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we tend to call our destructors these days. Note that this defines no public macro that wraps gcc's attribute and makes it easier to use. While I think it's our duty in the library to make our stuff easy to use, I figure it's not our duty to make gcc's own features easy to use on its own. Most likely, client code which wants to make use of this should define its own: #define _cleanup_(function) __attribute__((cleanup(function))) Or similar, to make the gcc feature easier to use. Making this logic public has the benefit that we can remove three header files whose only purpose was to define these functions internally. See #2008.
* tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-161-3/+3
| | | | Sort the includes accoding to the new coding style.
* treewide: apply errno.cocciMichal Schmidt2015-11-091-2/+1
| | | | with small manual cleanups for style.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-7/+8
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* bus-util: rename bus_open_transport() to bus_connect_transport()Lennart Poettering2015-09-291-1/+1
| | | | | | | | | | | | | | In sd-bus, the sd_bus_open_xyz() family of calls allocates a new bus, while sd_bus_default_xyz() family tries to reuse the thread's default bus. bus_open_transport() sometimes internally uses the former, sometimes the latter family, but suggests it only calls the former via its name. Hence, let's avoid this confusion, and generically rename the call to bus_connect_transport(). Similar for all related calls. And while we are at it, also change cgls + cgtop to do direct systemd connections where possible, since all they do is talk to systemd itself.
* tree-wide: make use of log_error_errno() return valueLennart Poettering2015-09-091-2/+2
| | | | | | | | | | | | | | | | | | | | Turns this: r = -errno; log_error_errno(errno, "foo"); into this: r = log_error_errno(errno, "foo"); and this: r = log_error_errno(errno, "foo"); return r; into this: return log_error_errno(errno, "foo");
* tree-wide: don't do assignments within if checksLennart Poettering2015-09-091-5/+2
| | | | | | | | | | | Turn this: if ((r = foo()) < 0) { ... into this: r = foo(); if (r < 0) { ...
* shared: add formats-util.hRonny Chevalier2015-04-101-0/+1
|
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-8/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* everywhere: remove configurability of sysv runlevel to target mappingLennart Poettering2015-02-181-9/+9
| | | | | | | | | | | | | | | With this change runlevel 2, 3, 4 are mapped to multi-user.target for good, and 5 to graphical.target. This was already the previous mapping but is now no longer reconfigurable, but hard-coded into the core. This should generally simplify things, but also fix one bug: the sysv-generator previously generated symlinks to runlevel[2-5].target units, which possibly weren't picked up if these aliases were otherwise only referenced by the real names "multi-user.target" and "graphical.target". We keep compat aliases "runlevel[2345].target" arround for cases where this target name is explicitly requested.
* 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.
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-7/+7
| | | | | | | | | | | 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: more log_*_errno() conversions, multiline callsMichal Schmidt2014-11-281-2/+1
| | | | | | | | | | | | Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-281-3/+3
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-281-3/+3
| | | | | | | | | | | | | 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().
* notify: send STOPPING=1 from our daemonsLennart Poettering2014-08-211-0/+1
|
* initctl: don't eat up error codeLennart Poettering2014-08-111-1/+1
|
* core: make sure PrivateDevices= makes /dev/log availableLennart Poettering2014-06-041-1/+2
| | | | | | | Now that we moved the actual syslog socket to /run/systemd/journal/dev-log we can actually make /dev/log a symlink to it, when PrivateDevices= is used, thus making syslog available to services using PrivateDevices=.
* 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-3/+2
| | | | | | | | | | | | | | | 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.
* trivial coding style clean upsThomas Hindoe Paaboel Andersen2013-12-031-1/+1
| | | | | | | | | | | | | | - Add space between if/for and the opening parentheses - Place the opening brace on same line as the function (not for udev) From the CODING_STYLE Try to use this: void foo() { } instead of this: void foo() { }
* tree-wide usage of %m specifier instead of strerror(errno)Daniel Buch2013-11-261-7/+5
| | | | | | Also for log_error() except where a specific error is specified e.g. errno ? strerror(errno) : "Some user specified message"
* bus: move ssh support into public API of libsystem-busLennart Poettering2013-10-301-1/+1
|
* initctl: port to sd-busTom Gundersen2013-10-181-47/+27
|
* list: make our list macros a bit easier to use by not requring type spec on ↵Lennart Poettering2013-10-141-2/+2
| | | | | | | each invocation We can determine the list entry type via the typeof() gcc construct, and so we should to make the macros much shorter to use.
* journald: be a bit more verbose when vacuumingZbigniew Jędrzejewski-Szmek2013-09-101-4/+6
| | | | | | | | Vacuuming behaviour is a bit confusing, and/or we have some bugs, so those additional messages should help to find out what's going on. Also, rotation of journal files shouldn't be happening too often, so the level of the messages is bumped to info, so that they'll be logged under normal operation.
* initctl: use irreversible jobs when switching runlevelsZbigniew Jędrzejewski-Szmek2013-07-241-1/+1
| | | | Spotted by uau in #systemd.
* initctl: fix return from unitialized memory in error pathZbigniew Jędrzejewski-Szmek2013-03-211-7/+15
| | | | | | | src/initctl/initctl.c: In function 'server_init': src/initctl/initctl.c:282:13: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized] int r; ^
* 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/+451