summaryrefslogtreecommitdiff
path: root/src/systemctl
AgeCommit message (Collapse)Author
2014-10-02systemctl: remove spurious newlineLennart Poettering
2014-09-18systemctl: fix resource leak CID #1237747Cristian Rodríguez
..by simply moving the declaration of "unit" into the STRV_FOREACH loop as suggested by Andreas.
2014-09-15hashmap: introduce hash_ops to make struct Hashmap smallerMichal Schmidt
It is redundant to store 'hash' and 'compare' function pointers in struct Hashmap separately. The functions always comprise a pair. Store a single pointer to struct hash_ops instead. systemd keeps hundreds of hashmaps, so this saves a little bit of memory.
2014-08-31Quote unit names in suggested systemctl commandlinesZbigniew Jędrzejewski-Szmek
The fact that unit names have to be quoted can be a bit surprising. Show quotes in the hint commandline, but only after checking that this is necessary, since quotes are visually heavy and usually not needed. https://bugs.freedesktop.org/show_bug.cgi?id=82832
2014-08-26systemctl: Correct error message printed when bus_process_wait failsSjoerd Simons
Actually use the variable containing the return code of bus_process_wait when printing the error message as a result of it failing.
2014-08-21systemctl: in list-unit-files, always show legend, even if we know about no ↵Lennart Poettering
unit files
2014-08-20systemctl: fail in the case that no unit files were foundLukas Nykryn
Previously systemctl died with message -bash-4.2# systemctl --root /rawhi list-unit-files (src/systemctl/systemctl.c:868) Out of memory. in the case that no unit files were found in the --root or the directory did not exist. So lets return ENOENT in the case that --root does not exist and empty list in the case that there are no unit files.
2014-08-13util: allow strappenda to take any number of argsDave Reisner
This makes strappenda3 redundant, so we remove its usage and definition. Add a few tests along the way for sanity.
2014-08-04bus: always explicitly close bus from main programsLennart Poettering
Since b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 we don't attempt to GC busses anymore when unsent messages remain that keep their reference, when they otherwise are not referenced anymore. This means that if we explicitly want connections to go away, we need to close them. With this change we will no do so explicitly wherver we connect to the bus from a main program (and thus know when the bus connection should go away), or when we create a private bus connection, that really should go away after our use. This fixes connection leaks in the NSS and PAM modules.
2014-08-03Unify parse_argv styleZbigniew Jędrzejewski-Szmek
getopt is usually good at printing out a nice error message when commandline options are invalid. It distinguishes between an unknown option and a known option with a missing arg. It is better to let it do its job and not use opterr=0 unless we actually want to suppress messages. So remove opterr=0 in the few places where it wasn't really useful. When an error in options is encountered, we should not print a lengthy help() and overwhelm the user, when we know precisely what is wrong with the commandline. In addition, since help() prints to stdout, it should not be used except when requested with -h or --help. Also, simplify things here and there.
2014-07-31resolve-host: list types and classesZbigniew Jędrzejewski-Szmek
Also update systemctl to similar style.
2014-07-31Reject invalid quoted stringsZbigniew Jędrzejewski-Szmek
String which ended in an unfinished quote were accepted, potentially with bad memory accesses. Reject anything which ends in a unfished quote, or contains non-whitespace characters right after the closing quote. _FOREACH_WORD now returns the invalid character in *state. But this return value is not checked anywhere yet. Also, make 'word' and 'state' variables const pointers, and rename 'w' to 'word' in various places. Things are easier to read if the same name is used consistently. mbiebl_> am I correct that something like this doesn't work mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-passwd "Unlock EncFS"' mbiebl_> systemd seems to strip of the quotes mbiebl_> systemctl status shows mbiebl_> ExecStart=/usr/bin/encfs --extpass='/bin/systemd-ask-password Unlock EncFS $RootDir $MountPoint mbiebl_> which is pretty weird
2014-07-29time-util: add and use USEC/NSEC_INFINIYKay Sievers
2014-07-26Add utility function to append root to pathZbigniew Jędrzejewski-Szmek
2014-07-26systemctl: do not bother to mutate state on errorZbigniew Jędrzejewski-Szmek
We will abort anyway.
2014-07-26Always check asprintf return codeKarel Zak
There is a small number of the places in sources where we don't check asprintf() return code and assume that after error the function returns NULL pointer via the first argument. That's wrong, after error the content of pointer is undefined.
2014-07-20systemd-verify: check man pagesZbigniew Jędrzejewski-Szmek
2014-07-08systemctl: fix visual alignment for lines prefixed with color dotsMichal Schmidt
2014-07-07systemctl: show StatusErrno value in "systemctl status"Lennart Poettering
2014-06-25systemctl: add new "is-system-running" command to check whether system is ↵Lennart Poettering
fully up https://bugs.freedesktop.org/show_bug.cgi?id=66926
2014-06-16systemctl: reverse order of args when verbosely creating symlinksDave Reisner
This was backwards. The symlink itself points to the source unit, not the other way around.
2014-06-17systemctl: output human readable strings in "systemctl enable" and ↵Lennart Poettering
"systemctl disable"
2014-06-17install: beef up preset logic to limit to only enable or only disable, and ↵Lennart Poettering
do all-unit preset operations The new "systemctl preset-all" command may now be used to put all installed units back into the enable/disable state the vendor/admin encoded in preset files. Also, introduce "systemctl --preset-mode=enable-only" and "systemctl --preset-mode=disable-only" to only apply the enable or only the disable operations of a "systemctl preset" or "systemctl preset-all" operation. "systemctl preset-all" implements this RFE: https://bugzilla.redhat.com/show_bug.cgi?id=630174
2014-05-19core: Filter by state behind the D-Bus API, not in the systemctl client.David Strauss
2014-05-19fix spelling of privilegeNis Martensen
2014-05-17systemctl: more cleanupThomas Hindoe Paaboel Andersen
This is followup on 05cae7f3431446236139434ee58a6275f3cb31e8 I think the intention was to use the newly introduced 'path' variable in the inner loop instead of p.
2014-05-15systemctl: small cleanupZbigniew Jędrzejewski-Szmek
2014-05-15Remove unnecessary casts in printfsZbigniew Jędrzejewski-Szmek
No functional change expected :)
2014-05-15Make systemctl --root look for files in the proper placesZbigniew Jędrzejewski-Szmek
Running systemctl enable/disable/set-default/... with the --root option under strace reveals that it accessed various files and directories in the main fs, and not underneath the specified root. This can lead to correct results only when the layout and configuration in the container are identical, which often is not the case. Fix this by adding the specified root to all file access operations. This patch does not handle some corner cases: symlinks which point outside of the specified root might be interpreted differently than they would be by the kernel if the specified root was the real root. But systemctl does not create such symlinks by itself, and I think this is enough of a corner case not to be worth the additional complexity of reimplementing link chasing in systemd. Also, simplify the code in a few places and remove an hypothetical memory leak on error.
2014-05-15sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables ↵Lennart Poettering
attached to a bus connection This makes callback behaviour more like sd-event or sd-resolve, and creates proper object for unregistering callbacks. Taking the refernce to the slot is optional. If not taken life time of the slot will be bound to the underlying bus object (or in the case of an async call until the reply has been recieved).
2014-05-10systemctl: return an error code is status failsZbigniew Jędrzejewski-Szmek
This got lost in the refactoring in f74294c1dabb4. Also make sure that the return code corresponds to the *first* failure, not the last. https://lists.fedoraproject.org/pipermail/devel/2014-May/199080.html
2014-04-23delta: draw arrows with draw_special_char()Lennart Poettering
Let's unify generation of unicode chars at one place. Also, don't add an extra space into chars we print, except for the tree chars where this is really necessary.
2014-04-21systemctl: delete REBOOT_PARAM_FILE if no parameter is specifiedMichael Olbrich
And move it to sperate function.
2014-04-16systemctl: allow to change the default target without the --force switchDjalal Harouni
Currently "systemctl set-default" will fail to change the default target due to the 'default.target' being a symlink which is always the case. To work around this, the user must specify the "--force" switch to be able to overwrite the existing symlink. This is clearly a regression that was introduced by commit 718db96199e since it worked before without the "--force" switch and the man pages do not mention that you need to specify it. It is expected that this is a symlink. So just explicity set the force flag to make it work again. https://bugs.freedesktop.org/show_bug.cgi?id=76623 Reported-by: <code@progandy.de>
2014-04-16systemctl: add --recursive for list-timersThomas Hindoe Paaboel Andersen
2014-04-16systemctl: add --recursive for list-socketsThomas Hindoe Paaboel Andersen
2014-04-12Unify GREEDY_REALLOC and GREEDY_REALLOC_TZbigniew Jędrzejewski-Szmek
greedy_realloc() and greedy_realloc0() now store the allocated size as the count, not bytes. Replace GREEDY_REALLOC uses with GREEDY_REALLOC_T everywhere, and then rename GREEDY_REALLOC_T to GREEDY_REALLOC. It is just too error-prone to have two slightly different macros which do the same thing.
2014-04-05systemctl: update NAME to PATTERN in help()Zbigniew Jędrzejewski-Szmek
Previously the man page was modified, but not help().
2014-03-27systemctl: fix spelling in commentBrandon Philips
2014-03-24timer: support timers that can resume the system from suspendLennart Poettering
2014-03-24systemctl: show last trigger time in "systemctl list-timers"Lennart Poettering
2014-03-18systemctl: sort local host entry before container in list-machines outputLennart Poettering
2014-03-18systemctl: prefix list-units and list-machines output with a circle ↵Lennart Poettering
indicating a failure state (Subject to --no-legend)
2014-03-17systemctl: introduce -r switch to show units running in local containers in ↵Lennart Poettering
addition to the host
2014-03-16Use strlen even for constant stringsJosh Triplett
GCC optimizes strlen("string constant") to a constant, even with -O0. Thus, replace patterns like sizeof("string constant")-1 with strlen("string constant") where possible, for clarity. In particular, for expressions intended to add up the lengths of components going into a string, this often makes it clearer that the expression counts the trailing '\0' exactly once, by putting the +1 for the '\0' at the end of the expression, rather than hidden in a sizeof in the middle of the expression.
2014-03-14utmp-wtmp: allow overriding username on wallSebastian Thorarensen
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'.
2014-03-13systemctl: autopage always if systemctl status is invoked without argsLennart Poettering
2014-03-13systemctl: suppress duplicate newline if there's not log output in ↵Lennart Poettering
"systemctl status"
2014-03-13systemctl: reorder verbsLennart Poettering
2014-03-13systemctl: make sure status -a doesn't terminate too soonLennart Poettering