1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-12 15:21:19 +03:00
Commit Graph

22678 Commits

Author SHA1 Message Date
Lennart Poettering
57ab90065d systemctl: split out code invoking SetExitCode() into function of its own 2015-09-29 21:55:53 +02:00
Lennart Poettering
bcbd61db9f pager: minor modernizations 2015-09-29 21:55:53 +02:00
Lennart Poettering
4057e12315 systemctl: don't assert on the arguments array unnecessarily
In most verbs it's fine to treat the arguments array being NULL is empty
array, hence do so.
2015-09-29 21:55:53 +02:00
Lennart Poettering
14b316ebf8 systemctl: make use of strv_skip() where appropriate 2015-09-29 21:55:53 +02:00
Lennart Poettering
691395d84c systemctl: make use of log_error_errno() where we can
Also adds a couple of "return" statements, where they are missing.
2015-09-29 21:55:52 +02:00
Lennart Poettering
4fbd7192c5 systemctl: rework how we connect to busses
Sometimes we have to connect to the system manager directly (early boot,
initrd, late boot, ...), sometimes through the system bus (unprivileged,
remote, logind, ...). Instead of guessing in advance, which kind of
connection we require (and sometimes guessing incorrectly), let's make
sure each time we need  bus connection we request the right bus
explicitly.

This way, we set up exactly the bus connections require, never guess
incorrectly, and do so only immediately when necessary.

As effect this reworks avoid_bus() into install_client_side(), since
that's all it determines now: whether to install unit files client-side
or server-side (i.e. in PID 1).
2015-09-29 21:55:52 +02:00
Lennart Poettering
8c8da0e0cb core: add a "Requires=" dependency between units and the slices they are located in
We place the processes we fork off in the cgroup anyway, and we probably
shouldn't be able to get that far if we couldn't set up the slice due to
resource problems or unmet conditions. Hence upgrade the dependency
between units and the slices they are located in from Wants= to
Requires=.
2015-09-29 21:55:52 +02:00
Lennart Poettering
f0792aae43 update-utmp: flush and close the bus used for connections after use 2015-09-29 21:55:52 +02:00
Lennart Poettering
f0960da0fa update-utmp: minor modernizations 2015-09-29 21:55:52 +02:00
Lennart Poettering
266f3e269d bus-util: rename bus_open_transport() to bus_connect_transport()
In sd-bus, the sd_bus_open_xyz() family of calls allocates a new bus,
while sd_bus_default_xyz() family tries to reuse the thread's default
bus. bus_open_transport() sometimes internally uses the former,
sometimes the latter family, but suggests it only calls the former via
its name. Hence, let's avoid this confusion, and generically rename the
call to bus_connect_transport().

Similar for all related calls.

And while we are at it, also change cgls + cgtop to do direct systemd
connections where possible, since all they do is talk to systemd itself.
2015-09-29 21:55:52 +02:00
Lennart Poettering
65359589c2 pager: minor simplification 2015-09-29 21:55:52 +02:00
Lennart Poettering
2cc7b0a25f systemctl: rename parse_time_spec() to parse_shutdown_time_spec()
Let's clarify that this function is specific to shutdown time
specifications, nothing else.
2015-09-29 21:55:52 +02:00
Lennart Poettering
eca830bee9 systemctl: conditionalize /dev/initctl fallback on HAVE_SYSV_COMPAT 2015-09-29 21:55:52 +02:00
Lennart Poettering
172d7abfea systemctl: allocate arg_wall only on the heap
Previously, we'd allocate it sometimes from the heap, but otherwise let
it point directly int argv[]. Let's clean this up, so that we know
exactly how to release its resources, and do so at the end.
2015-09-29 21:55:52 +02:00
Lennart Poettering
fc2ffaf17d systemctl: add 'const' where appropriate 2015-09-29 21:55:52 +02:00
Lennart Poettering
48ec22bc02 systemctl: remove client-side wall message support
logind sends out wall messages now, let's remove this from the systemctl
client side hence. If people build systemd without logind support they
won't get wall messages now, but that's OK.
2015-09-29 21:55:52 +02:00
Lennart Poettering
e3ead6bb42 systemctl: move strv_skip_first() out of systemctl.c
Make it generic, call it strv_skip() and move it to strv.[ch]
2015-09-29 21:55:52 +02:00
Lennart Poettering
56a730fa56 systemctl: split out code that schedules shutdowsn into its own function 2015-09-29 21:55:52 +02:00
Lennart Poettering
2cf05793f2 systemctl: rename all logind-specific functions to logind_xyz() 2015-09-29 21:55:52 +02:00
Lennart Poettering
949d9ce954 systemctl: move shutdown cancelling code into its own function
Let's make sure the main switch statement only invokes functions, but
doesn't do anything real on its own.
2015-09-29 21:55:52 +02:00
Lennart Poettering
4f16c1f479 systemctl: don't special case ACTION_RUNLEVEL anymore
Let's move its dispatching to the main switch statement.
2015-09-29 21:55:51 +02:00
Lennart Poettering
f2d11d35e9 systemctl: introduce a single function to set the wall message
Let's not have the same code three times, but reduce it to one function.
2015-09-29 21:55:51 +02:00
Lennart Poettering
b9e74c3994 core: rework crash handling
This introduces a new systemd.crash_reboot=1 kernel command line option
that triggers a reboot after crashing.

This also cleans up crash VT handling. Specifically, it cleans up the
configuration setting, to be between 1..63 or a boolean. This is to
replace the previous logic where "-1" meant disabled. We continue to
accept that setting, but only document the boolean syntax instead.

This also brings the documentation of the default settings in sync with
what actually happens.

The CrashChVT= configuration file setting is renamed to CrashChangeVT=,
following our usual logic of not abbreviating unnecessarily. The old
setting stays support for compat reasons.

Fixes #1300
2015-09-29 21:55:51 +02:00
Lennart Poettering
3607810227 socket: rename ffs_xyz to usbffs_xyz
The relation to USB should really be clearer.
2015-09-29 21:55:51 +02:00
Lennart Poettering
00411a1343 core: turn a large if statement into a switch 2015-09-29 21:55:51 +02:00
Lennart Poettering
710a6b5017 selinux: add _cleanup_ concepts to SELinux label allocation 2015-09-29 21:55:51 +02:00
Lennart Poettering
e8da24a642 core: simplify how we create socket fds
Let's always return the allocated fds as return values where possible,
and make more use of _cleanup_close_
2015-09-29 21:55:51 +02:00
Lennart Poettering
ed460b077a core: small error message wording improvements 2015-09-29 21:55:51 +02:00
Lennart Poettering
97792515b4 core: properly use the ExitCode bus property when exiting is --user instance 2015-09-29 21:55:51 +02:00
Lennart Poettering
5f5d8eab1f core: allow setting WorkingDirectory= to the special value ~
If set to ~ the working directory is set to the home directory of the
user configured in User=.

This change also exposes the existing switch for the working directory
that allowed making missing working directories non-fatal.

This also changes "machinectl shell" to make use of this to ensure that
the invoked shell is by default in the user's home directory.

Fixes #1268.
2015-09-29 21:55:51 +02:00
Lennart Poettering
0521e286fc man: also properly indent our examples to 8ch 2015-09-29 21:55:51 +02:00
Lennart Poettering
9e6a555ae4 detect-virt: various modernizations 2015-09-29 21:55:51 +02:00
Lennart Poettering
939c173f60 journal-cat: various modernizations 2015-09-29 21:55:51 +02:00
Lennart Poettering
e4603df5cf journal-cat: return a correct error, not -1 2015-09-29 21:55:51 +02:00
Lennart Poettering
4a9b1dd4ad machine-id-commit: merge machine-id-commit functionality into machine-id-setup
And remove machine-id-commit as separate binary.

There's really no point in keeping this separate, as the sources are
pretty much identical, and have pretty identical interfaces. Let's unify
this in one binary.

Given that machine-id-commit was a private binary of systemd (shipped in
/usr/lib/) removing the tool is not an API break.

While we are at it, improve the documentation of the command substantially.
2015-09-29 21:55:51 +02:00
Lennart Poettering
c2fc2c2560 units: increase watchdog timeout to 3min for all our services
Apparently, disk IO issues are more frequent than we hope, and 1min
waiting for disk IO happens, so let's increase the watchdog timeout a
bit, for all our services.

See #1353 for an example where this triggers.
2015-09-29 21:55:51 +02:00
Lennart Poettering
31021ba085 sd-daemon: Simplify sd_booted() check
We can just use access() to check whether /run/system/system/ is a
directory, no need to involve stat(). The trick is to suffix the path
name with a dash.
2015-09-29 21:55:51 +02:00
Lennart Poettering
94f099d813 systemctl: make "systemctl is-system-running" return "offline" if we are not booted with systemd
This sounds like the better place to expose this than in "systemd-notify
--booted".

Also document the so far undocumented "unknown" state the command might
return. And rearrange the table of states documented to be more like the
one for "is-running".

Also, don't document the precise exit code of this function, just say
errors are reported != 0 or > 0...
2015-09-29 21:55:51 +02:00
Lennart Poettering
41d5895f80 Merge pull request #1398 from evverx/man-systemd-journald
man: journald: add commands for /var/log/journal
2015-09-29 21:35:52 +02:00
Lennart Poettering
04c4507098 Merge pull request #1407 from dvdhrm/prioq
prioq: drop stability guarantee
2015-09-29 21:16:14 +02:00
Lennart Poettering
16f98462a0 tty-ask-password: minor modernizations 2015-09-29 21:08:37 +02:00
Lennart Poettering
3f6fd1ba65 util: introduce common version() implementation and use it everywhere
This also allows us to drop build.h from a ton of files, hence do so.
Since we touched the #includes of those files, let's order them properly
according to CODING_STYLE.
2015-09-29 21:08:37 +02:00
Lennart Poettering
189d5bac5c util: unify implementation of NOP signal handler
This is highly complex code after all, we really should make sure to
only keep one implementation of this extremely difficult function
around.
2015-09-29 21:08:37 +02:00
Lennart Poettering
e6e242ad2d core: remove set_default_unit()
The new free_and_strdup() call does pretty much the same thing these
days, no need to keep a private limited purpose version around.
2015-09-29 21:08:37 +02:00
Lennart Poettering
48b9085914 core: modernize prepare_reexecute() 2015-09-29 21:08:37 +02:00
Lennart Poettering
aa8aeac050 core: exit early if we hit OOM 2015-09-29 21:08:37 +02:00
Lennart Poettering
d1cefe0ae2 core: use %m rather than strerror() where we can 2015-09-29 21:08:37 +02:00
Lennart Poettering
92ca4cac43 main: minor clean-ups
Add (void) casting for a couple of functions where we knowingly ignore
the returning error code.

Use EXIT_FAILURE where appropriate.

Try to initialize structures at declaration time, or at once.
2015-09-29 21:08:37 +02:00
Lennart Poettering
2feceb5eb9 tree-wide: take benefit of the fact that fdset_free() returns NULL 2015-09-29 21:08:37 +02:00
Lennart Poettering
3dfc97634e core: order #includes in main.c 2015-09-29 21:08:37 +02:00