summaryrefslogtreecommitdiff
path: root/src/systemctl/systemctl.c
AgeCommit message (Collapse)Author
2014-11-28Revert "systemctl: append default suffix only if none present"Zbigniew Jędrzejewski-Szmek
This reverts a chunk out of commit 5e03c6e3b517286bbd65b48d88f60e5b83721894 which was trying to pass NULL to the the '.service' default. Anyway, it seems better to be explicit.
2014-11-28systemctl: append default suffix only if none presentZbigniew Jędrzejewski-Szmek
Simplify unit_name_mangle() and unit_name_mangle_with_suffix() to always behave the same, and only append a suffix if there is no type suffix. If a user says 'isolate blah.device' it is better to return an error that the type cannot be isolated, than to try to isolate blah.device.target.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
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().
2014-11-22systemctl: show BindsTo/BoundBy in list-dependenciesZbigniew Jędrzejewski-Szmek
Suggested-by: Peter Mattern <matternp@arcor.de> http://lists.freedesktop.org/archives/systemd-devel/2014-November/025437.html
2014-11-10shared/install: when unit contains only Also=, report 'indirect'Jan Synacek
If a unit contains only Also=, with no Alias= or WantedBy=, it shouldn't be reported as static. New 'indirect' status shall be introduced. https://bugzilla.redhat.com/show_bug.cgi?id=864298
2014-11-07copy: teach copy_bytes() sendfile() support, and then replace ↵Lennart Poettering
sendfile_full() by it
2014-11-06systemctl: when invokes as "reboot -f", sync()Lennart Poettering
We do this in the clean shutdown path in shutdown.c, hence we should do is for "reboot -f", too.
2014-11-06core: introduce the concept of AssertXYZ= similar to ConditionXYZ=, but ↵Lennart Poettering
fatal for a start job if not met
2014-10-29systemctl: obey --state in list-unit-filesZbigniew Jędrzejewski-Szmek
2014-10-29systemctl: let list-{units,unit-files } honour --typeZbigniew Jędrzejewski-Szmek
The docs don't clarify what is expected, but I don't see any reason why --type should be ignored. Also restucture the compund conditions into separate clauses for easier reading.
2014-10-17systemctl: by default interactively ask for polkit authorization, if possibleLennart Poettering
Also, allow using --no-ask-password to turn off ineractive polkit authorization.
2014-10-13systemctl: when mangle unit names for the "isolate", suffix with ".target" ↵Lennart Poettering
rather than ".service" by default After all, we set AllowIsolate exclusively for target units so far, and this is more or less the only thing tht makes sense, hence also use ".target" as completion suffix by default.
2014-10-13systemctl: move unit action table closer to the functions that use themLennart Poettering
All other static tables we placed next to the functions that access them, so let's do this for the unit action table too.
2014-10-09systemctl: remove casts in formattingZbigniew Jędrzejewski-Szmek
2014-10-08systemctl: suggest -xe not -xnZbigniew Jędrzejewski-Szmek
https://bugzilla.redhat.com/show_bug.cgi?id=1150289
2014-10-08systemctl: add add-wants and add-requires verbsLukas Nykryn
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.