summaryrefslogtreecommitdiff
path: root/src/systemctl
AgeCommit message (Collapse)Author
2015-09-22Merge pull request #1334 from poettering/sd-bus-default-flush-closeDavid Herrmann
sd-bus: introduce new sd_bus_default_flush_close() call
2015-09-22cgtop: underline table headerLennart Poettering
Let's underline the header line of the table shown by cgtop, how it is customary for tables. In order to do this, let's introduce new ANSI underline macros, and clean up the existing ones as side effect.
2015-09-22sd-bus: introduce new sd_bus_default_flush_close() callLennart Poettering
If code enqueues a message on one of the default busses, but doesn't sync on it, and immediately drops the reference to the bus again, it will stay queued and consume memory. Intrdouce a new call sd_bus_default_flush_close() that can be invoked at the end of programs (or threads) and flushes out all unsent messages on any of the default busses.
2015-09-21containers: systemd exits with non-zero codeAlban Crequy
When a systemd service running in a container exits with a non-zero code, it can be useful to terminate the container immediately and get the exit code back to the host, when systemd-nspawn returns. This was not possible to do. This patch adds the following to make it possible: - Add a read-only "ExitCode" property on PID 1's "Manager" bus object. By default, it is 0 so the behaviour stays the same as previously. - Add a method "SetExitCode" on the same object. The method fails when called on baremetal: it is only allowed in containers or in user session. - Add support in systemctl to call "systemctl exit 42". It reuses the existing code for user session. - Add exit.target and systemd-exit.service to the system instance. - Change main() to actually call systemd-shutdown to exit() with the correct value. - Add verb 'exit' in systemd-shutdown with parameter --exit-code - Update systemctl manpage. I used the following to test it: | $ sudo rkt --debug --insecure-skip-verify run \ | --mds-register=false --local docker://busybox \ | --exec=/bin/chroot -- /proc/1/root \ | systemctl --force exit 42 | ... | Container rkt-895a0cba-5c66-4fa5-831c-e3f8ddc5810d failed with error code 42. | $ echo $? | 42 Fixes https://github.com/systemd/systemd/issues/1290
2015-09-21core: extend KillUnit() to return error when no unit was killedJan Synacek
2015-09-10Merge pull request #1227 from intelfx/systemctl-legacy-tools-polkitLennart Poettering
systemctl: fix various aspects of polkit authorization in legacy tools.
2015-09-10Merge pull request #1239 from poettering/cgroup-pidsDaniel Mack
core: add support for the "pids" cgroup controller
2015-09-10Merge pull request #1242 from poettering/no-off_tDaniel Mack
Drop usage of off_t
2015-09-10core: add support for the "pids" cgroup controllerLennart Poettering
This adds support for the new "pids" cgroup controller of 4.3 kernels. It allows accounting the number of tasks in a cgroup and enforcing limits on it. This adds two new setting TasksAccounting= and TasksMax= to each unit, as well as a gloabl option DefaultTasksAccounting=. This also updated "cgtop" to optionally make use of the new kernel-provided accounting. systemctl has been updated to show the number of tasks for each service if it is available. This patch also adds correct support for undoing memory limits for units using a MemoryLimit=infinity syntax. We do the same for TasksMax= now and hence keep things in sync here.
2015-09-10tree-wide: never use the off_t unless glibc makes us use itLennart Poettering
off_t is a really weird type as it is usually 64bit these days (at least in sane programs), but could theoretically be 32bit. We don't support off_t as 32bit builds though, but still constantly deal with safely converting from off_t to other types and back for no point. Hence, never use the type anymore. Always use uint64_t instead. This has various benefits, including that we can expose these values directly as D-Bus properties, and also that the values parse the same in all cases.
2015-09-10systemctl: add RequisiteOf* as inverses of Requisite and RequisiteOverridableEvgeny Vereshchagin
2015-09-10systemctl: improve clarity of error messages in the logind pathIvan Shapovalov
2015-09-10systemctl: relax permission checks in halt_main()Ivan Shapovalov
Thus we allow (non-interactive) polkit auth to kick in for legacy commands (halt, poweroff, reboot, telinit) as well. Fixes (another aspect of) issue #213.
2015-09-10systemctl: fix logind bus call error handling in halt_main()Ivan Shapovalov
Handle -EOPNOTSUPP and -EINPROGRESS like in start_special().
2015-09-10systemctl: minor: use IN_SET() instead of repeated equality checks.Ivan Shapovalov
2015-09-10systemctl: legacy tools shall never be interactiveIvan Shapovalov
Fixes (the main concern of) issue #213.
2015-09-09systemctl: add dry-run support for scheduled shutdownsDaniel Mack
Prefix the action parameter with "dry-" in case the --dry-run command line switch was passed.
2015-09-09tree-wide: drop {} from one-line if blocksLennart Poettering
Patch via coccinelle.
2015-09-08systemctl: add ConsistsOf as the inverse of PartOfEvgeny Vereshchagin
2015-09-07systemctl: a number of cleanups regarding error handling in systemctlLennart Poettering
2015-09-01cgroup: drop "ignore_self" argument from cg_is_empty()Lennart Poettering
In all cases where the function (or cg_is_empty_recursive()) ignoring the calling process is actually wrong, as a process keeps a cgroup busy regardless if its the current one or another. Hence, let's simplify things and drop the "ignore_self" parameter.
2015-08-25Revert "systemctl: properly handle empty control group paths in "status""Lennart Poettering
This reverts commit b04c25f9ef6359ed0ae403bdbfe4df840aba0f58.
2015-08-25Merge pull request #1022 from poettering/machinectl-shellTom Gundersen
Add new "machinectl shell" command for su(1)-like behaviour
2015-08-25logind/systemctl: introduce SetWallMessage and --messageJan Synacek
Enable unprivileged users to set wall message on a shutdown operation. When the message is set via the --message option, it is logged together with the default shutdown message. $ systemctl reboot --message "Applied kernel updates." $ journalctl -b -1 ... systemd-logind[27]: System is rebooting. (Applied kernel updates.) ...
2015-08-24systemctl: properly handle empty control group paths in "status"Lennart Poettering
When showing the status of the "-.slice" slice root unit (whose reported cgroup path is ""), we suppressed the cgroup tree so far, because skipped it for all unit with an empty cgroup path. Let's fix that, and properly handle the empty cgroup path.
2015-08-12support reboot -f for kexec kernelThomas Blume
Fix error message: -->-- Code should not be reached 'Unknown action.' at src/systemctl/systemctl.c:6382, function halt_now(). Aborting. Aborted --<-- when executing 'reboot -f' from a system running a kexec kernel.
2015-07-31tree-wide: introduce mfree()David Herrmann
Pretty trivial helper which wraps free() but returns NULL, so we can simplify this: free(foobar); foobar = NULL; to this: foobar = mfree(foobar);
2015-07-03sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering
sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
2015-06-18systemctl: fix edit when EDITOR contains argumentsJan Synacek
Correctly support cases when the EDITOR environment variable and friends also contain arguments. For example, to run emacs in terminal only, one can say: EDITOR="emacs -nw" systemctl edit myservice
2015-06-16everywhere: actually make use of DUAL_TIMESTAMP_NULL macroLennart Poettering
Let's use it as initializer where appropriate.
2015-06-15util: when creating temporary file names, allow including extra id string in itLennart Poettering
This adds a "char *extra" parameter to tempfn_xxxxxx(), tempfn_random(), tempfn_ranomd_child(). If non-NULL this string is included in the middle of the newly created file name. This is useful for being able to distuingish the kind of temporary file when we see one. This also adds tests for the three call. For now, we don't make use of this at all, but port all users over.
2015-06-14tree-wide: fix memory leaks in users of bus_map_all_properties()David Herrmann
If you use bus_map_all_properties(), you must be aware that it might touch output variables even though it may fail. This is, because we parse many different bus-properties and cannot tell how to clean them up, in case we fail deep down in the parser. Fix all callers of bus_map_all_properties() to correctly cleanup any context structures at all times.
2015-06-10tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering
mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
2015-06-03systemctl: Use /usr/bin/editor if availableMichael Biebl
If the EDITOR environment variable is not set, the Debian policy recommends to use the /usr/bin/editor program as default editor. This file is managed via the dpkg alternatives mechanism and typically used in Debian/Ubuntu and derivatives to configure the default editor. See section 11.4 of the Debian policy [1]. Therefor prefer /usr/bin/editor over specific editors if available. [1] https://www.debian.org/doc/debian-policy/ch-customized-programs.html
2015-05-29util: split out signal-util.[ch] from util.[ch]Lennart Poettering
No functional changes.
2015-05-28systemctl: Don't skip SysV init.d scripts when enabling/disabling unitsMartin Pitt
If there is both a SysV init.d script and a systemd unit for a given name, we want to do the same enable/disable operation for both, instead of just on the systemd unit. This keeps the enablement status in sync so that switching init systems behaves as expected.
2015-05-28systemctl: drop hardcoded chkconfig invocationMartin Pitt
Introduce /usr/lib/systemd/systemd-sysv-install [--root=] <action> <name> abstraction, replacing the direct calling of chkconfig. This allows distributions to call their specific tools like update-rc.d without patching systemd. Ship systemd-sysv-install.SKELETON as an example for packagers how to implement this. Drop the --enable-chkconfig configure option. Document this in README and point to it in NEWS.
2015-05-18util: split all hostname related calls into hostname-util.cLennart Poettering
2015-05-15systemctl: introduce --now for enable, disable and maskJan Synacek
https://bugs.freedesktop.org/show_bug.cgi?id=42940
2015-05-12systemctl: fix check for template unitsThomas Hindoe Paaboel Andersen
A typo from 7410616c. We want to ignore EINVAL but only catch errors.
2015-05-11core: rename SystemdRunningAs to ManagerRunningAsLennart Poettering
It's primarily just a property of the Manager object after all, and we try to refer to PID 1 as "manager" instead of "systemd", hence let's to stick to this here too.
2015-05-11treewide: Correct typos and spell plural of bus consistentTorstein Husebø
2015-05-06systemctl: null-initialize pointer with cleanup attributeDaniel Buch
2015-05-05core: rework unit name validation and manipulation logicLennart Poettering
A variety of changes: - Make sure all our calls distuingish OOM from other errors if OOM is not the only error possible. - Be much stricter when parsing escaped paths, do not accept trailing or leading escaped slashes. - Change unit validation to take a bit mask for allowing plain names, instance names or template names or an combination thereof. - Refuse manipulating invalid unit name
2015-04-24systemctl: kill newline characters from log_error_errno() callsDaniel Mack
log_error_errno() already adds a newline, so drop them.
2015-04-24systemctl: talk to logind for scheduled shutdownsDaniel Mack
Drop the code which communicates with shutdownd via its private socket, and use the functionality in logind instead. The code pathes which talk to logind have to create their own ad-hoc bus connection because by default, systemctl connects to systemd's private socket.
2015-04-24shared/utmp-wtmp: add parameter for origin tty and callback userdataDaniel Mack
Instead of looking up the tty from STDIN, let utmp_wall() take an argument to specify an origin tty for the wall message. Only if that argument is NULL do the STDIN lookup. Also add an void *userdata argument that is handed back to the callback function.
2015-04-14systemctl: avoid bumping NOFILE rlimit unless neededZbigniew Jędrzejewski-Szmek
We actually only use the journal when showing status. Move setrlimit call so it is only called for status. https://bugzilla.redhat.com/show_bug.cgi?id=1184712
2015-04-11shared: add terminal-util.[ch]Ronny Chevalier
2015-04-10shared: add process-util.[ch]Ronny Chevalier