Commit graph

238 commits

Author SHA1 Message Date
Lennart Poettering ebcf1f97de bus: rework message handlers to always take an error argument
Message handler callbacks can be simplified drastically if the
dispatcher automatically replies to method calls if errors are returned.

Thus: add an sd_bus_error argument to all message handlers. When we
dispatch a message handler and it returns negative or a set sd_bus_error
we send this as message error back to the client. This means errors
returned by handlers by default are given back to clients instead of
rippling all the way up to the event loop, which is desirable to make
things robust.

As a side-effect we can now easily turn the SELinux checks into normal
function calls, since the method call dispatcher will generate the right
error replies automatically now.

Also, make sure we always pass the error structure to all property and
method handlers as last argument to follow the usual style of passing
variables for return values as last argument.
2013-11-21 21:12:36 +01:00
Lennart Poettering 718db96199 core: convert PID 1 to libsystemd-bus
This patch converts PID 1 to libsystemd-bus and thus drops the
dependency on libdbus. The only remaining code using libdbus is a test
case that validates our bus marshalling against libdbus' marshalling,
and this dependency can be turned off.

This patch also adds a couple of things to libsystem-bus, that are
necessary to make the port work:

- Synthesizing of "Disconnected" messages when bus connections are
  severed.

- Support for attaching multiple vtables for the same interface on the
  same path.

This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus
calls which used an inappropriate signature.

As a side effect we will now generate PropertiesChanged messages which
carry property contents, rather than just invalidation information.
2013-11-20 20:52:36 +01:00
Karel Zak 4561be3a64 Remove duplicate includes 2013-11-18 20:28:55 -05:00
Thomas Hindoe Paaboel Andersen d5d217eae1 remove unused variables 2013-11-18 23:04:16 +01:00
Mantas Mikulėnas 6ce774fd80 systemctl: honor --no-legend in 'list-jobs' 2013-11-14 00:17:23 +10:00
Lennart Poettering c49b30a235 bus: rename sd_bus_send_with_reply_and_block() to sd_bus_call()
The call is one of the most important ones we expose, where we place
major emphasis on. We should make sure to give it a short, memorable
name.
2013-11-12 00:12:43 +01:00
Kay Sievers 1823b86ebf systemctl: warning: ‘r’ may be used uninitialized in this function 2013-11-11 17:18:51 +01:00
Zbigniew Jędrzejewski-Szmek ad83b4c47c systemctl: avoid unitialized access when showing 0 timers 2013-11-11 10:55:51 -05:00
Lennart Poettering cbb76c29cc systemctl: add new "list-timers" command 2013-11-11 15:54:43 +01:00
Zbigniew Jędrzejewski-Szmek 0a9776c230 systemctl: make sure daemon-reload returns success
Also change sd_bus_message_exit_container to return -ENOENT
when not in a container, to make it easier to distinguish different
errors.
2013-11-09 19:41:00 -05:00
Zbigniew Jędrzejewski-Szmek 852c1b4d29 systemctl: fix printing of individual properties 2013-11-09 19:02:53 -05:00
Lennart Poettering 477def8097 shutdown: unify handling of reboot() syscall a bit 2013-11-08 19:32:45 +01:00
Lennart Poettering 6d6d40c910 systemctl: properly initialize column widths for list-jobs 2013-11-08 18:57:43 +01:00
Kay Sievers 0d95178e49 systemctl: rename 'listen'
src/systemctl/systemctl.c: In function ‘get_listening’:
src/systemctl/systemctl.c:535:25: warning: declaration of ‘listen’ shadows a global declaration [-Wshadow]
src/systemctl/systemctl.c: In function ‘list_sockets’:
src/systemctl/systemctl.c:690:44: warning: declaration of ‘listen’ shadows a global declaration [-Wshadow]
2013-11-08 18:52:09 +01:00
Kay Sievers 4aa2beacb1 systemctl: fix "reboot" call 2013-11-08 17:49:59 +01:00
Lennart Poettering 41dd15e474 systemctl: restore ability to directly connect to PID1 from systemctl 2013-11-08 17:07:42 +01:00
Kay Sievers a9616cd17f systemctl: initialize variables 2013-11-08 15:21:50 +01:00
Lennart Poettering 7af5a806d1 systemctl: allow listing cgroups of containers 2013-11-08 14:07:27 +01:00
Lennart Poettering cbc9fbd131 systemctl: various cleanups 2013-11-08 14:07:27 +01:00
Marc-Antoine Perennou f459b6025f systemctl: port to libsystemd-bus 2013-11-08 14:07:27 +01:00
Michal Sekletar c6581cc14f systemctl: return r instead of always returning 0 2013-11-08 00:20:09 +01:00
Lennart Poettering 0d49cfa264 systemctl: we show headers for list-units even when piped these days, hence do the same for list-jobs 2013-11-07 21:02:48 +01:00
Mantas Mikulėnas a1074881b4 systemctl: make LOAD column width dynamic
Otherwise 'not-found' overflows into the ACTIVE column.
2013-11-07 01:23:54 -05:00
WaLyong Cho 37185ec80a Support additional argument in reboot
reboot syscall can be performed with an additional argument. In some
systems this functionality can be useful to modify the mode of the
next boot performed by the bootloader.
2013-11-07 01:23:54 -05:00
Lennart Poettering eb9da376d7 clients: unify how we invoke getopt_long()
Among other things this makes sure we always expose a --version command
and show it in the help texts.
2013-11-06 18:28:39 +01:00
Thomas Hindoe Paaboel Andersen 76fdc9669a systemctl: fix typo in help text 2013-11-01 20:46:49 +01:00
Daniel Buch fb15be8395 path_lookup: moved _cleanup_lookup_paths_free_ from install.c to path-lookup.h 2013-10-27 11:51:22 -04:00
Lennart Poettering 71fda00f32 list: make our list macros a bit easier to use by not requring type spec on 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.
2013-10-14 06:11:19 +02:00
Zbigniew Jędrzejewski-Szmek 872c8faaf2 Fix write-only use of a few variables
Since the invention of read-only memory, write-only memory has been
considered deprecated. Where appropriate, either make use of the
value, or avoid writing it, to make it clear that it is not used.
2013-10-13 17:56:54 -04:00
Zbigniew Jędrzejewski-Szmek 7ff7394d9e Never call qsort on potentially NULL arrays
This extends 62678ded 'efi: never call qsort on potentially
NULL arrays' to all other places where qsort is used and it
is not obvious that the count is non-zero.
2013-10-13 17:56:54 -04:00
Václav Pavlín cbb13b2a53 systemctl: fix name mangling for sysv units 2013-10-02 16:42:53 +02:00
Cristian Rodríguez ba5ecfcdbb systemctl: remove legacy upstart compatibility 2013-10-01 03:23:08 +02:00
Lennart Poettering 68372da693 systemctl: make sure set-property mangles unit names 2013-09-27 00:11:54 +02:00
Dave Reisner 184ecaf794 systemctl: Avoid ellipsizing when piping output 2013-09-19 17:39:49 -04:00
Lennart Poettering ddca82aca0 cgroup: get rid of MemorySoftLimit=
The cgroup attribute memory.soft_limit_in_bytes is unlikely to stay
around in the kernel for good, so let's not expose it for now. We can
readd something like it later when the kernel guys decided on a final
API for this.
2013-09-17 14:58:00 -05:00
Kay Sievers 6e869e18c0 shut up gcc complaining about freeing a const variable 2013-09-12 23:37:23 +02:00
Michal Sekletar c1e784feb4 systemctl: process only signals for jobs we really wait for
wait_filter() callback shouldn't process JobRemove signals for arbitrary
jobs. It should only deal with signals for jobs which are included in
set of jobs we wait for.
2013-09-12 18:09:08 +02:00
Gao feng b8ab2dc6c9 systemctl: show BlockIODeviceWeight for unit
We can use systemctl show unitname to show the BlockIODeviceWeight
of unit.
2013-09-10 18:32:32 +02:00
Gao feng 7239c1707a systemcl: add support for setting BlockIODeviceWeight for unit
This patch allows user to set up BlockIODeviceWeight for unit
through systemctl. Such as

systemctl set-property sshd.service BlockIODeviceWeight="/dev/sda 100"
2013-09-10 18:31:43 +02:00
Gao feng 670612567b systemcl: add support for setting BlockIORead/WriteBandwidth for unit
This patch allows user to set up BlockIOReadBandwidth and BlockIOWriteBandwidth
for unit through systemctl. Such as

systemctl set-property sshd.service BlockIOReadBandwidth="/dev/sda 100000"
systemctl set-property sshd.service BlockIOWriteBandwidth="/dev/sda 200000"
2013-09-10 17:29:55 +02:00
Zbigniew Jędrzejewski-Szmek 94e0bd7db1 systemctl: show hint about --full when lines don't fit 2013-08-11 18:10:34 -04:00
Lennart Poettering f535088ef7 systemctl: add missing newline to --help output 2013-08-09 19:05:07 +02:00
Daniel Schaal 0b5a519c89 systemd-delta: Only print colors when on a tty
This make systemd-delta follow the behaviour of systemctl
and journalctl.

https://bugs.freedesktop.org/show_bug.cgi?id=67656

[zj: unify color query methods between those three programs.]
2013-08-04 08:33:02 -04:00
Lennart Poettering a521ae4a56 systemctl: rearrange --help output a bit 2013-07-26 17:11:41 +02:00
Lennart Poettering 223ab9345d systemctl: remove "load" command
"systemctl load" has always been racy since the GC could hit any time,
before making use of the loaded unit. Very recent systemd will run GC
immeidately after all unit state changes which has the effect that the
the effect of "systemctl load" is completely gone now, so let's remove
the support for it in "systemctl" for good.
2013-07-26 17:05:43 +02:00
Lennart Poettering a65615ca5d systemctl: move set-log-level to systemd-analyze
"systemctl set-log-level" is a command for analysis and tracing hence
"systemd-analyze" should be the better home for it, thus allowing us to
make the overly large "systemctl" a bit smaller.
2013-07-26 16:59:55 +02:00
Lennart Poettering 9ea9d4cf16 systemctl: move "dump" command from systemctl to systemd-analyze
It's an analysis command and its format is explicitly not covered by any
stability guarantees, hence move away from systemctl and into
systemd-analyze, minimizing the already large interface of systemctl a
bit.

This patch also adds auto-paging to the various systemd-analyze commands
where that makes sense
2013-07-26 16:36:25 +02:00
Lennart Poettering 83787333bd man: update documentation of systemctl cgroup commands 2013-07-19 19:29:08 +02:00
Maciej Wereski 9b9b3d36b8 systemctl: option to list units by state
This allows to show only units with specified LOAD or SUB or ACTIVE state.
2013-07-18 19:50:04 +02:00
Zbigniew Jędrzejewski-Szmek 52990c2e0e systemd,systemctl: export condition status and show failing condition
$ systemctl --user status hoohoo
hoohoo.service
   Loaded: loaded (/home/zbyszek/.config/systemd/user/hoohoo.service; static)
   Active: inactive (dead)
           start condition failed at Tue 2013-06-25 18:08:42 EDT; 1s ago
           ConditionPathExists=/tmp/hoo was not met

Full information is exported over D-Bus:
  [(condition, trigger, negate, param, state),...]
where state is one of "failed" (<0), "untested" (0), "OK" (>0).
I've decided to use 0 for "untested", because it might be useful to
differentiate different types of failure later on, without breaking
compatibility.

systemctl shows the failing condition, if there was a non-trigger
failing condition, or says "none of the trigger conditions were met",
because there're often many trigger conditions, and they must all
fail for the condition to fail, so printing them all would consume
a lot of space, and bring unnecessary attention to something that is
quite low-level.
2013-07-17 23:41:10 -04:00