Commit graph

264 commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek b652054662 systemctl: simplify start_unit 2013-12-26 11:24:42 -05:00
Zbigniew Jędrzejewski-Szmek 58684be9a7 systemctl: also color filenames of drop-ins in cat 2013-12-22 18:55:01 -05:00
Lennart Poettering 373d32c9f4 systemctl: fix bad memory access when processing PIDs on the "systemctl status" command line 2013-12-21 05:15:09 +01:00
Zbigniew Jędrzejewski-Szmek a669d6226d systemct: add empty line between units in cat 2013-12-18 23:58:24 -05:00
Zbigniew Jędrzejewski-Szmek c0fdf09885 systemctl: highlight filenames in cat 2013-12-16 23:21:51 -05:00
Zbigniew Jędrzejewski-Szmek c0ea486f6e systemctl: fix return value from cat 2013-12-16 23:21:51 -05:00
Lennart Poettering 999b600390 systemctl: properly initialize and free sd_bus_error in "systemctl cat"
We need to properly initialize all error structs before use and free
them after use.

Also, there's no point in flushing stdout if we output a \n anyway...
2013-12-16 21:06:57 +01:00
Djalal Harouni 815ebc540d systemctl: add the --plain option to the help message 2013-12-14 18:13:24 -05:00
Zbigniew Jędrzejewski-Szmek 04504f93d1 systemctl: fix 'is-enabled' 2013-12-08 19:26:51 -05:00
Zbigniew Jędrzejewski-Szmek d08e75edf9 systemctl: simplify argument parsing 2013-12-08 19:26:51 -05:00
Zbigniew Jędrzejewski-Szmek 4f8f66cb42 Help output spring cleaning
Use [brackets] only for optional elements.
Use <optional> in XML sources.
2013-12-08 19:26:51 -05:00
Thomas Hindoe Paaboel Andersen 4c49ab0e7a systemctl: fix and refactor wait_for_jobs
wait_for_jobs was ignoring the errors from the jobs stored in r.
It would only ever return whether the call to sd_bus_remove_filter
went ok. This patch changes it to return the first job related error
encountered. If a job related error is found, then the result of the
call to sd_bus_remove_filter is ignored.

wait_for_jobs was a bit hard to read so I split it up to avoid
the goto and deep nesting.
2013-12-07 22:39:46 +01:00
Zbigniew Jędrzejewski-Szmek d8fba7c6cc systemctl: allow globbing in list-<whatever> commands
It is nicer to say 'systemctl list-units ssh\*' then to use grep,
because colouring is preserved and it is easier to match just against
the unit name.
2013-12-06 21:29:55 -05:00
Zbigniew Jędrzejewski-Szmek 2b6bf07dd2 Get rid of our reimplementation of basename
The only problem is that libgen.h #defines basename to point to it's
own broken implementation instead of the GNU one. This can be fixed
by #undefining basename.
2013-12-06 21:29:55 -05:00
Thomas Hindoe Paaboel Andersen f433609894 systemctl: check the value from start_unit_one
introduced in f459b6025f
2013-12-06 21:13:46 +01:00
Thomas Hindoe Paaboel Andersen 071066a5e5 systemctl: make an always true assert static
Silences a warning i clang
2013-12-04 22:29:58 +01:00
Thomas Hindoe Paaboel Andersen 4fd944ec82 systemctl: no need to fdopen stdout 2013-12-04 22:29:51 +01:00
Thomas Hindoe Paaboel Andersen f168c27313 trivial coding style clean ups
- 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()
    {
    }
2013-12-03 22:27:45 +01:00
Zbigniew Jędrzejewski-Szmek e4c0fbe50c systemctl: do not show SourcePath when FragmentPath cannot be found
Those files can be in a completely deferent format and also
arbitrarily long, and usually contain information about other
stuff. If we ever add SourceLine= or SourceLines= in addition
to SourcePath=, and can show the relevant information only, this
commit can be reverted.
2013-11-30 22:36:08 -05:00
Shawn Landden e93c33d4aa systemctl: add "systemctl cat" 2013-11-30 22:20:20 -05:00
Shawn Landden f74294c1da systemctl: refactor show()
v2, don't leave in unused function
2013-11-30 21:59:53 -05:00
Kay Sievers cc3f2093f6 systemctl: fix enable/disable reply handling 2013-11-26 05:19:39 +01:00
Lennart Poettering 4dc5b821ae systemctl: replace the three job mode options by a single --job-mode= option
Also, expose the new "flush" job mode this way.
2013-11-26 02:26:31 +01:00
Lennart Poettering d2bd639262 systemctl: remove debug log message 2013-11-25 17:40:54 +01:00
Lennart Poettering dbed408b8e systemctl: when status is called without arguments show pager 2013-11-25 17:40:54 +01:00
Lennart Poettering dbc2c080de systemctl: indicate in list-dependencies whether a unit is already running 2013-11-22 19:27:56 +01:00
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