1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-08 11:27:32 +03:00
Commit Graph

492 Commits

Author SHA1 Message Date
Lennart Poettering
2fc9a280cc systemctl: move unit action table closer to the functions that use them
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-13 17:19:31 +02:00
Zbigniew Jędrzejewski-Szmek
8c06592fa1 systemctl: remove casts in formatting 2014-10-09 23:16:53 -04:00
Zbigniew Jędrzejewski-Szmek
b923047d73 systemctl: suggest -xe not -xn
https://bugzilla.redhat.com/show_bug.cgi?id=1150289
2014-10-08 20:23:09 -04:00
Lukas Nykryn
e94937df95 systemctl: add add-wants and add-requires verbs 2014-10-08 12:44:00 +02:00
Lennart Poettering
cc19881a69 systemctl: remove spurious newline 2014-10-02 20:38:00 +02:00
Cristian Rodríguez
48a2900c66 systemctl: fix resource leak CID #1237747
..by simply moving the declaration of "unit" into the STRV_FOREACH
loop as suggested by Andreas.
2014-09-18 10:16:23 +02:00
Michal Schmidt
d5099efc47 hashmap: introduce hash_ops to make struct Hashmap smaller
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-09-15 16:08:50 +02:00
Zbigniew Jędrzejewski-Szmek
8e07fc41f8 Quote unit names in suggested systemctl commandlines
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-31 00:42:27 -04:00
Sjoerd Simons
498cfc230a systemctl: Correct error message printed when bus_process_wait fails
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-26 20:37:05 +02:00
Lennart Poettering
4fe1be9ce2 systemctl: in list-unit-files, always show legend, even if we know about no unit files 2014-08-21 19:10:29 +02:00
Lukas Nykryn
fdbdf6ec29 systemctl: fail in the case that no unit files were found
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-20 10:45:18 +02:00
Dave Reisner
8085f163c5 util: allow strappenda to take any number of args
This makes strappenda3 redundant, so we remove its usage and
definition. Add a few tests along the way for sanity.
2014-08-13 20:41:41 -04:00
Lennart Poettering
249968612f bus: always explicitly close bus from main programs
Since b5eca3a205 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-04 16:25:24 +02:00
Zbigniew Jędrzejewski-Szmek
601185b43d Unify parse_argv style
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-08-03 21:46:07 -04:00
Zbigniew Jędrzejewski-Szmek
b93312f596 resolve-host: list types and classes
Also update systemctl to similar style.
2014-07-31 08:56:03 -04:00
Zbigniew Jędrzejewski-Szmek
a2a5291b3f Reject invalid quoted strings
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-31 04:00:31 -04:00
Kay Sievers
3a43da2832 time-util: add and use USEC/NSEC_INFINIY 2014-07-29 13:20:20 +02:00
Zbigniew Jędrzejewski-Szmek
0c6ea3a4e2 Add utility function to append root to path 2014-07-26 15:08:42 -04:00
Zbigniew Jędrzejewski-Szmek
60731f32f1 systemctl: do not bother to mutate state on error
We will abort anyway.
2014-07-26 15:08:42 -04:00
Karel Zak
7de80bfe2e Always check asprintf return code
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-26 15:08:41 -04:00
Zbigniew Jędrzejewski-Szmek
78002a6781 systemd-verify: check man pages 2014-07-20 19:48:16 -04:00
Michal Schmidt
b7bbdabeb4 systemctl: fix visual alignment for lines prefixed with color dots 2014-07-08 17:22:34 +02:00
Lennart Poettering
b4af5a803a systemctl: show StatusErrno value in "systemctl status" 2014-07-07 17:33:26 +02:00
Lennart Poettering
99813a1912 systemctl: add new "is-system-running" command to check whether system is fully up
https://bugs.freedesktop.org/show_bug.cgi?id=66926
2014-06-25 12:31:03 +02:00
Dave Reisner
735a1a2ea5 systemctl: reverse order of args when verbosely creating symlinks
This was backwards. The symlink itself points to the source unit, not
the other way around.
2014-06-16 23:30:30 -04:00
Lennart Poettering
749ebb2da4 systemctl: output human readable strings in "systemctl enable" and "systemctl disable" 2014-06-17 02:43:44 +02:00
Lennart Poettering
d309c1c364 install: beef up preset logic to limit to only enable or only disable, and 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-06-17 02:43:17 +02:00
David Strauss
cdc06ed7b6 core: Filter by state behind the D-Bus API, not in the systemctl client. 2014-05-19 00:50:30 +09:00
Nis Martensen
f1721625e7 fix spelling of privilege 2014-05-19 00:40:44 +09:00
Thomas Hindoe Paaboel Andersen
4723e4b2a4 systemctl: more cleanup
This is followup on 05cae7f343

I think the intention was to use the newly introduced 'path'
variable in the inner loop instead of p.
2014-05-17 08:41:37 +02:00
Zbigniew Jędrzejewski-Szmek
05cae7f343 systemctl: small cleanup 2014-05-15 15:30:00 +02:00
Zbigniew Jędrzejewski-Szmek
de0671ee7f Remove unnecessary casts in printfs
No functional change expected :)
2014-05-15 15:29:58 +02:00
Zbigniew Jędrzejewski-Szmek
12ed81d9c8 Make systemctl --root look for files in the proper places
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-15 15:29:58 +02:00
Lennart Poettering
19befb2d5f sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables 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-15 01:15:30 +02:00
Zbigniew Jędrzejewski-Szmek
5bb75bc745 systemctl: return an error code is status fails
This got lost in the refactoring in f74294c1da.

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-05-10 03:44:41 +02:00
Lennart Poettering
6b01f1d391 delta: draw arrows with draw_special_char()
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-23 19:06:39 +02:00
Michael Olbrich
c5220a940d systemctl: delete REBOOT_PARAM_FILE if no parameter is specified
And move it to sperate function.
2014-04-21 09:58:53 -04:00
Djalal Harouni
a1484a216e systemctl: allow to change the default target without the --force switch
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  718db96199
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-16 23:13:22 -04:00
Thomas Hindoe Paaboel Andersen
806a37e743 systemctl: add --recursive for list-timers 2014-04-16 23:51:27 +02:00
Thomas Hindoe Paaboel Andersen
0cfc352571 systemctl: add --recursive for list-sockets 2014-04-16 00:38:22 +02:00
Zbigniew Jędrzejewski-Szmek
ca2d378414 Unify GREEDY_REALLOC and GREEDY_REALLOC_T
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-12 10:20:55 -04:00
Zbigniew Jędrzejewski-Szmek
b3ae710c25 systemctl: update NAME to PATTERN in help()
Previously the man page was modified, but not help().
2014-04-05 00:42:10 -04:00
Brandon Philips
93c941e3fb systemctl: fix spelling in comment 2014-03-27 11:56:33 -07:00
Lennart Poettering
dedabea4b3 timer: support timers that can resume the system from suspend 2014-03-24 16:24:07 +01:00
Lennart Poettering
d784e2dbac systemctl: show last trigger time in "systemctl list-timers" 2014-03-24 03:42:17 +01:00
Lennart Poettering
50933da01b systemctl: sort local host entry before container in list-machines output 2014-03-18 04:46:55 +01:00
Lennart Poettering
90c3f79dc7 systemctl: prefix list-units and list-machines output with a circle indicating a failure state
(Subject to --no-legend)
2014-03-18 04:46:55 +01:00
Lennart Poettering
1238ee09b7 systemctl: introduce -r switch to show units running in local containers in addition to the host 2014-03-17 04:00:44 +01:00
Josh Triplett
f8294e4175 Use strlen even for constant strings
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-16 09:52:56 -04:00
Sebastian Thorarensen
9003d9b0d6 utmp-wtmp: allow overriding username on wall
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-14 21:27:33 +01:00
Lennart Poettering
c3441de061 systemctl: autopage always if systemctl status is invoked without args 2014-03-13 04:17:37 +01:00
Lennart Poettering
ea6c2dd1f8 systemctl: suppress duplicate newline if there's not log output in "systemctl status" 2014-03-13 04:17:37 +01:00
Lennart Poettering
15ef11449b systemctl: reorder verbs 2014-03-13 04:17:37 +01:00
Lennart Poettering
3df538da67 systemctl: make sure status -a doesn't terminate too soon 2014-03-13 04:17:37 +01:00
Lennart Poettering
b0d14c69b2 systemctl: show a colored red dot in "status" output indicating the state of a unit 2014-03-13 04:17:37 +01:00
Lennart Poettering
8fcf784dff systemctl: when "systemctl status" is called without arguments show a short overall system state
Previously "systemctl status" without argument would print the status of
all loaded units. This has now been moved to "systemctl status -a".
2014-03-12 23:33:46 +01:00
Lennart Poettering
0d292f5e75 systemctl: add new "list-machines" command
"systemctl list-machines" shows one line per local container which
includes the current system state of the container, the number of failed
units as well as the number of currently queued jobs.
2014-03-12 21:16:45 +01:00
Harald Hoyer
f39d4a08e7 systemctl: for switch-root check, if we switch to a systemd init
If "systemctl switch-root" is called with a specific "INIT" or
/proc/cmdline contains "init=", then systemd would not serialize
itsself.

Let systemctl check, if the new init is in the standard systemd
installation path and if so, clear the INIT parameter,
to let systemd serialize itsself.
2014-03-11 04:45:33 +01:00
Lennart Poettering
df31a6c0fe systemd-run: add new --property= switch that can set arbitrary properties for the unit that is created
The code for parsing these properties is shared with "systemctl
set-property", which means all the resource control settings are
immediately available.
2014-03-05 03:36:22 +01:00
Zbigniew Jędrzejewski-Szmek
6e18964d3a Introduce strv_consume which takes ownership
This mirrors set_consume and makes the common use a bit nicer.
2014-03-04 10:04:50 -05:00
Zbigniew Jędrzejewski-Szmek
41a55c46ab Replace /var/run with /run in remaining places
/run was already used almost everywhere, fix the remaining places
for consistency.
2014-02-25 20:41:24 -05:00
Djalal Harouni
f5080e7385 systemctl: move next elapse calculation to its own function 2014-02-23 23:53:25 -05:00
Lennart Poettering
5556b5fe41 core: clean up some confusing regarding SI decimal and IEC binary suffixes for sizes
According to Wikipedia it is customary to specify hardware metrics and
transfer speeds to the basis 1000 (SI decimal), while software metrics
and physical volatile memory (RAM) sizes to the basis 1024 (IEC binary).
So far we specified everything in IEC, let's fix that and be more
true to what's otherwise customary. Since we don't want to parse "Mi"
instead of "M" we document each time what the context used is.
2014-02-23 03:19:04 +01:00
Daniel Mack
9e82ffa040 systemctl: fix compiler warning in list_timers()
get_next_elapse() will always fill 'next' with values when it
returns >= 0. Hence, the compiler is wrong about this warning.
Initialize 'next' nevertheless.

src/systemctl/systemctl.c: In function ‘list_timers’:
src/systemctl/systemctl.c:953:43: warning: ‘next.monotonic’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
                                 converted = nw.realtime - (nw.monotonic - next.monotonic);
                                           ^
In file included from ./src/shared/log.h:30:0,
                 from src/systemctl/systemctl.c:46:
./src/shared/macro.h:137:38: warning: ‘next.realtime’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
                         _a < _b ? _a : _b;      \
                                      ^
src/systemctl/systemctl.c:933:32: note: ‘next.realtime’ was declared here
                 dual_timestamp next;
                                ^
2014-02-21 12:05:38 +01:00
Lennart Poettering
151b9b9662 api: in constructor function calls, always put the returned object pointer first (or second)
Previously the returned object of constructor functions where sometimes
returned as last, sometimes as first and sometimes as second parameter.
Let's clean this up a bit. Here are the new rules:

1. The object the new object is derived from is put first, if there is any

2. The object we are creating will be returned in the next arguments

3. This is followed by any additional arguments

Rationale:

For functions that operate on an object we always put that object first.
Constructors should probably not be too different in this regard. Also,
if the additional parameters might want to use varargs which suggests to
put them last.

Note that this new scheme only applies to constructor functions, not to
all other functions. We do give a lot of freedom for those.

Note that this commit only changes the order of the new functions we
added, for old ones we accept the wrong order and leave it like that.
2014-02-20 00:03:10 +01:00
Maciej Wereski
31d5a60cae systemctl: remove erroneous return in runlevel_parse_argv() 2014-02-19 16:24:16 +01:00
Dave Reisner
5a1aece581 systemctl: fix exit statuses from is-active/is-failed
This was inadvertantly disturbed in e3e0314b when glob support was
added.
2014-02-13 10:14:31 -05:00
Lennart Poettering
57183d117a core: add SystemCallArchitectures= unit setting to allow disabling of non-native
architecture support for system calls

Also, turn system call filter bus properties into complex types instead
of concatenated strings.
2014-02-13 00:24:00 +01:00
Tom Gundersen
36e0e6311b includes: remove duplicate includes
Found by the new check-includes make target.
2014-02-10 13:06:31 +01:00
Lennart Poettering
67d6621059 systemctl: skip native unit file handling if sysv file handling already handled everything
Issue pointed out by Colin Guthrie.
2014-01-20 13:43:57 +01:00
Lennart Poettering
ac3efa8ac6 systemctl: introduce new "import-environment" command
This may be used in graphical session start-up scripts to upload
environment variables such as $DISPLAY into the systemd manager easily.
2014-01-15 20:16:20 +01:00
Simon Peeters
e3e45d4f82 strv: multiple cleanups
- turn strv_merge into strv_extend_strv.
   appending strv b to the end of strv a instead of creating a new strv
- strv_append: remove in favor of strv_extend and strv_push.
- strv_remove: write slightly more elegant
- strv_remove_prefix: remove unused function
- strv_overlap: use strv_contains
- strv_printf: STRV_FOREACH handles NULL correctly
2014-01-05 09:16:15 -05:00
Thomas Hindoe Paaboel Andersen
39602c3905 systemctl: improve readability on failed commands
Not long ago a failed command would print:
"Failed to start something.service: ..."
regardless of whether the command was to start/stop/restart/etc.

With e3e0314 this was improved to print the method used. E.g. for stopping:
"Failed to StopUnit something.service: ..."

This patch matches the method to a more human readable word. E.g:
"Failed to stop something.service: ..."
2014-01-04 12:49:40 +01:00
Thomas Hindoe Paaboel Andersen
984af580b3 systemctl: remove unused variable 2013-12-27 12:04:00 +01:00
Zbigniew Jędrzejewski-Szmek
f78e6385dc Use enums to make it obvious what boolean params mean
Suggested-by: Russ Allbery <rra@debian.org>
2013-12-26 15:49:54 -05:00
Zbigniew Jędrzejewski-Szmek
e3e0314b56 systemctl: allow globbing in commands which take multiple unit names 2013-12-26 13:24:36 -05:00
Zbigniew Jędrzejewski-Szmek
8d5ba5a946 systemctl: drop uninteresting units immediately
Also properly free memory if list-unit-files --root=... is used.
2013-12-26 11:24:42 -05:00
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
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
Lennart Poettering
2ce982f9b1 systemctl: also highlight a load state of "not-found" as red
"not-found" is a recently added load state and was previously just a
special case of "error". Since it also indicates a load error we should
also highlight it red, the same way as "error" was treated before.
2013-07-18 02:32:34 +02:00
Lukas Nykryn
66a6931494 systemctl: remove unused variable 2013-07-12 01:10:04 +02:00
Lennart Poettering
042f9f5e5e systemctl: show cgroup tree if cgroup is empty but has non-empty children
This makes sure "systemctl status user.slice" shows a nice cgroup tree
of all logged in users.
2013-07-11 19:15:01 +02:00
Lennart Poettering
d0ede8f1c5 systemctl: suppress error message when doing "systemctl daemon-reexec"
When we issue a reexecution request via the private socket we need to
expect a "Disconnected" in addition to "NoReply" when the connection is
terminated.
2013-07-10 23:41:03 +02:00
Lennart Poettering
94c01aeb10 systemctl: suppress error messages when checking whether a unit needs to be reloaded 2013-07-10 23:41:03 +02:00
David Coppa
286ca4852e build-sys: rename LEGACY to NOLEGACY to better reflect meaning
https://bugs.freedesktop.org/show_bug.cgi?id=66542
2013-07-03 09:09:36 -04:00
Jason St. John
e9c1ea9de8 replace tabs with spaces in various files
The affected files in this patch had inconsistent use of tabs vs. spaces
for indentation, and this patch eliminates the stray tabs.

Also, the opening brace of sigchld_hdl() in activate.c was moved so the
opening braces are consistent throughout the file.
2013-07-02 23:06:22 -04:00
Lennart Poettering
fb6becb443 logind: port over to use scopes+slices for all cgroup stuff
In order to prepare things for the single-writer cgroup scheme, let's
make logind use systemd's own primitives for cgroup management.

Every login user now gets his own private slice unit, in which his sessions
live in a scope unit each. Also, add user@$UID.service to the same
slice, and implicitly start it on first login.
2013-07-02 01:48:55 +02:00
Lennart Poettering
a00963a2e4 systemctl: show per-unit cgroup tree correctly following the new property 2013-07-01 00:18:00 +02:00
Lennart Poettering
7041efe960 dbus: make DeviceAllow=/DevicePolicy= writable 2013-06-27 23:13:17 +02:00
Lennart Poettering
b42defe3b8 dbus: make more cgroup attributes runtime settable 2013-06-27 21:50:35 +02:00
Lennart Poettering
8e2af47840 dbus: add infrastructure for changing multiple properties at once on units and hook some cgroup attributes up to it
This introduces two bus calls to make runtime changes to selected bus
properties, optionally with persistence.

This currently hooks this up only for three cgroup atributes, but this
brings the infrastructure to add more changable attributes.

This allows setting multiple attributes at once, and takes an array
rather than a dictionary of properties, in order to implement simple
resetting of lists using the same approach as when they are sourced from
unit files. This means, that list properties are appended to by this
call, unless they are first reset via assigning the empty list.
2013-06-27 21:14:56 +02:00
Lennart Poettering
4ad490007b core: general cgroup rework
Replace the very generic cgroup hookup with a much simpler one. With
this change only the high-level cgroup settings remain, the ability to
set arbitrary cgroup attributes is removed, so is support for adding
units to arbitrary cgroup controllers or setting arbitrary paths for
them (especially paths that are different for the various controllers).

This also introduces a new -.slice root slice, that is the parent of
system.slice and friends. This enables easy admin configuration of
root-level cgrouo properties.

This replaces DeviceDeny= by DevicePolicy=, and implicitly adds in
/dev/null, /dev/zero and friends if DeviceAllow= is used (unless this is
turned off by DevicePolicy=).
2013-06-27 04:17:34 +02:00
Harald Hoyer
3b05b8b3b5 systemctl: conform to LSB with the "status" return code
check for pid file existance before returning 1
2013-06-25 16:28:00 +02:00
Harald Hoyer
175728c45f systemctl: conform to LSB with the "status" return code
http://fedoraproject.org/wiki/Packaging:SysVInitScript#Exit_Codes_for_the_Status_Action

https://bugzilla.redhat.com/show_bug.cgi?id=975016
2013-06-25 13:08:27 +02:00
Zbigniew Jędrzejewski-Szmek
422fa6500a cgls,loginctl,systemctl: fix -l
Fixup for 98a6e13 "journalctl,loginctl,systemctl,systemd-cgls: add -l
as alias for --full".
2013-06-19 18:08:14 -04:00
Lennart Poettering
a016b9228f core: add new .slice unit type for partitioning systems
In order to prepare for the kernel cgroup rework, let's introduce a new
unit type to systemd, the "slice". Slices can be arranged in a tree and
are useful to partition resources freely and hierarchally by the user.

Each service unit can now be assigned to one of these slices, and later
on login users and machines may too.

Slices translate pretty directly to the cgroup hierarchy, and the
various objects can be assigned to any of the slices in the tree.
2013-06-17 21:36:51 +02:00
Daniel Albers
98a6e132b5 journalctl,loginctl,systemctl,systemd-cgls: add -l as alias for --full
https://bugs.freedesktop.org/show_bug.cgi?id=65850
2013-06-17 10:33:34 -04:00
Daniel Wallace
7085053a43 Allow for the use of @ in remote host calls
Without this you have to use %40 with the -H flag because dbus doesn't
like the @ sign being unescaped.
2013-06-09 18:26:41 -04:00
Zbigniew Jędrzejewski-Szmek
856323c9cb systemctl: remove extra padding from status output
In 131601349 'systemctl: align all status fields to common column',
padding was calculated for 'ListenStream: ...', etc. Later on in
45a4f7233 'systemctl: tweak output of Listen: fields a bit' output
was changed to 'Listen: ... (stream)', but calculation didn't change.

Just remove the calculation, since now the result will be always 8,
and it it more important to have everything aligned to the widest
field ("Main-PID"), than to save a few columns, usually at most two
(e.g. "Listen").

Note: strlen is more natural, and is optimized to sizeof even
with -O0.
2013-06-09 14:31:17 -04:00
Zbigniew Jędrzejewski-Szmek
3a256a12ad systemctl: add missing verbs to help 2013-06-04 10:58:00 -04:00
Zbigniew Jędrzejewski-Szmek
1058cbf2ad systemctl: suggest 'systemctl daemon-reload' without --system
--system is default anyway, and some poor user might type 9
characters without needing to.
2013-05-30 20:44:41 -04:00
Václav Pavlín
76d5a71de9 systemctl: add command set-log-level
Command changes current log level
2013-05-30 20:44:41 -04:00
Václav Pavlín
99504dd4c1 systemctl: add commands set-default and get-default
systemctl set-default NAME links the default.target to the given unit,
get-default prints out the path to the currently set default target.
2013-05-30 20:44:41 -04:00
Václav Pavlín
3a05c0f96c systemctl: mangle names when avoiding dbus
Unit names were mangled in function enable_unit only when dbus was
used. This patch adds mangling also when the dbus is not in use.

This makes it possible to say e.g.:
   systemctl --root=/path enable cups
without spelling cups.service out in full.
2013-05-23 00:29:10 -04:00
Mantas Mikulėnas
571bfc6c56 systemctl: honor "--no-legend" in 'list-sockets' 2013-05-21 09:23:51 -04:00
Zbigniew Jędrzejewski-Szmek
e9dd0369e4 systemctl: use GREEDY_REALLOC in one more place 2013-05-03 19:56:54 -04:00
Lukas Nykryn
5d0c05e5f4 systemctl: add --plain option to list-dependencies
This patch adds more script-friendly output for list-dependencies.
2013-05-03 18:58:12 +02:00
Zbigniew Jędrzejewski-Szmek
44a6b1b680 Add __attribute__((const, pure, format)) in various places
I'm assuming that it's fine if a _const_ or _pure_ function
calls assert. It is assumed that the assert won't trigger,
and even if it does, it can only trigger on the first call
with a given set of parameters, and we don't care if the
compiler moves the order of calls.
2013-05-02 22:52:09 -04:00
Zbigniew Jędrzejewski-Szmek
afba41995d systemctl: show reverse dependencies or before/after ordering
Also update completion scripts a bit.
2013-04-24 00:25:04 -04:00
Zbigniew Jędrzejewski-Szmek
ef42202ac8 Add set_consume which always takes ownership
Freeing in error path is the common pattern with set_put().
2013-04-24 00:25:04 -04:00
Harald Hoyer
7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Lennart Poettering
a5e4972c89 systemctl: drop usage of "internally loaded modules"
I wouldn't know what "internally" is supposed to mean hear, and we use
this terminology in this context nowhere else, so let's drop this.
2013-04-18 02:10:44 +02:00
Harald Hoyer
4b6756a88d systemctl:enable_sysv_units() more _cleanup_free_ 2013-04-17 12:03:20 +02:00
Harald Hoyer
87698625aa systemctl: clarify usage of "--all" versus list-unit-files
Novice users might think, that
 $ systemctl --all
is equal to
 $ systemctl list-unit-files

https://bugzilla.redhat.com/show_bug.cgi?id=748512
2013-04-17 09:23:09 +02:00
Lennart Poettering
82da66fb75 util: replace decimal_str_max() by a typesafe macro DECIMAL_STR_WIDTH()
DECIMAL_STR_WIDTH() now works on any numeric type, and is easier to
distingish from DECIMAL_STR_MAX().

This also replaces another manual implementaiton of ulog10 by this macro.
2013-04-16 05:04:53 +02:00
Anatol Pomozov
ab06eef810 Fix spelling errors using 'codespell' tool 2013-04-15 08:40:05 -04:00
Zbigniew Jędrzejewski-Szmek
991f2a3932 systemctl: new verb 'list-sockets'
LISTEN           UNIT                            ACTIVATES
/dev/initctl     systemd-initctl.socket          systemd-initctl.service
/dev/log         systemd-journald.socket         systemd-journald.service
...
[::]:19531       systemd-journal-gatewayd.socket systemd-journal-gatewayd.service
kobject-uevent 1 systemd-udevd-kernel.socket     systemd-udevd.service

17 sockets listed.
Pass --all to see loaded but inactive sockets, too.
2013-04-12 19:26:36 -04:00
Zbigniew Jędrzejewski-Szmek
bcb161b023 errno is positive
Make sure we compare errno against positive error codes.
The ones in hwclock.c and install.c can have an impact, the
rest are unlikely to be hit or in code that isn't widely
used.

Also check that errno > 0, to help gcc know that we are
returning a negative error code.
2013-04-11 19:13:18 -04:00
Zbigniew Jędrzejewski-Szmek
0ad4e1a872 systemctl: show the name of failing unit in red
It makes it easier to pick out problematic unit
names from a long list.
2013-04-11 19:13:17 -04:00
Zbigniew Jędrzejewski-Szmek
20b3f379cf systemctl: allow multiple arguments to --type
This mirrors --property, and is generally useful.

New functionality is used in bash completion.

In case of zsh completion, new functionality is less useful
because of caching. Nevertheless, zsh completion for restart
is made to behave more-or-less the same as bash completion.
At least sockets can be restarted.
2013-04-11 19:11:52 -04:00
Zbigniew Jędrzejewski-Szmek
75add28aa1 systemctl: ellipsize job list only when necessary, highlight running
I was debugging systemd waiting on a missing disk, and noticed
that the job listing could use some polishing. Jobs that are
actually running are highlighted, so it's easier to see what
very actually waiting for.

Also, the needed widths are precalculated, to use available columns
more ecomically.
2013-04-10 19:46:49 -04:00
Zbigniew Jędrzejewski-Szmek
b92bea5d2a Use initalization instead of explicit zeroing
Before, we would initialize many fields twice: first
by filling the structure with zeros, and then a second
time with the real values. We can let the compiler do
the job for us, avoiding one copy.

A downside of this patch is that text gets slightly
bigger. This is because all zero() calls are effectively
inlined:

$ size build/.libs/systemd
         text    data     bss     dec     hex filename
before 897737  107300    2560 1007597   f5fed build/.libs/systemd
after  897873  107300    2560 1007733   f6075 build/.libs/systemd

… actually less than 1‰.

A few asserts that the parameter is not null had to be removed. I
don't think this changes much, because first, it is quite unlikely
for the assert to fail, and second, an immediate SEGV is almost as
good as an assert.
2013-04-05 19:50:57 -04:00
Lennart Poettering
5a8e9427a6 systemctl: tweak drop-in display
So far we didn't place spaces between the box drawing chars and the
values next to them. Let's be consistent here.

(Or to turn this around: if we really want to place a space there we
probably should do that in all our tree outputs, not just here...)
2013-04-05 20:19:54 +02:00
Lennart Poettering
45a4f72337 systemctl: tweak output of Listen: fields a bit
It's probably a good idea to minimize the number of field names to show
in the "systemctl status" output, in order to make them useful as a
guide for the reader how things are "grouped". This patch moves
information about the used socket technology to the end of the output
lines in brackets, rather than into the field names. This turns the used
socket technology into what it is -- peripheral meta information --
instead of something that was at the core.

New output:

systemd-journald.socket - Journal Socket
         Loaded: loaded (/usr/lib/systemd/system/systemd-journald.socket; static)
         Active: active (running) since Fr 2013-03-29 02:16:30 CET; 1 weeks 0 days ago
           Docs: man:systemd-journald.service(8)
                 man:journald.conf(5)
                 man:systemd-journald.service(8)
                 man:journald.conf(5)
         Listen: /run/systemd/journal/stdout (Stream)
                 /run/systemd/journal/socket (Datagram)
                 /dev/log (Datagram)
2013-04-05 20:12:39 +02:00
Oleksii Shevchuk
76d14b876a systemctl: Add DropIn paths to status message
$ systemctl status null.target
null.target - NYAN
   Loaded: loaded (/home/alxchk/.config/systemd/user/null.target; disabled)
  Drop-In: /home/alxchk/.config/systemd/user/null.target.d
           └─ descr.conf, install-1.conf, install.conf
           /etc/systemd/user/null.target.d
           └─ test.conf
   Active: active since Пт 2013-04-05 20:42:13 EEST; 1min 58s ago
2013-04-05 20:01:42 +02:00
Zbigniew Jędrzejewski-Szmek
e8853816bf systemctl: align cgroups to 'n' in 'name='
Also drop ':' in repeated Docs lines.
2013-04-05 00:17:35 -04:00