1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

28133 Commits

Author SHA1 Message Date
Lennart Poettering
b415174d8e Merge pull request #5202 from keszybz/cgls-units
systemd-cgls --unit --user-unit
2017-02-02 11:45:51 +01:00
Zbigniew Jędrzejewski-Szmek
f7dda6c625 Merge pull request #5203 from poettering/dotdot
trivial unification of checking for "." and ".." when iterating through directories...
2017-02-01 22:43:28 -05:00
Zbigniew Jędrzejewski-Szmek
256c1eba6b cgls: allow --unit, --user-unit to take optional argument
The following are all equivalent:
--unit foo.service bar.service
--unit=foo.service bar.service
--unit=foo.service --unit=bar.service
foo.service bar.service --unit

Similarly for --user-unit.

The only case that doesn't work well is when --unit and --user-unit are mixed:
  --unit=foo.service --user-unit=bar.service
We'll treat both names as user units. I think this is OK.
2017-02-01 22:32:19 -05:00
Zbigniew Jędrzejewski-Szmek
e7aa3f5014 cgls: add --user-unit to show user units 2017-02-01 22:31:41 -05:00
Zbigniew Jędrzejewski-Szmek
d9855d87eb cgls: add --unit to show units
$ systemd-cgls -u systemd-journald.service machine.slice

I opted for a "global" switch, instead of modifying the behaviour of just one
argument. It seem to be a more useful setting, since usually one will want to
query one or more units, and not mix unit names with paths.

Closes #5156.
2017-02-01 22:30:03 -05:00
Zbigniew Jędrzejewski-Szmek
bc06be7533 shared/cgroup-show: extract funtion to query unit cgroup path
…and use it where possible.
2017-02-01 20:31:50 -05:00
Zbigniew Jędrzejewski-Szmek
d3e8277d50 cgtop: use common function to query cgroup root
show_cgroup_get_root_and_warn is renamed to show_cgroup_get_path_and_warn
because it now optionally allows querying a non-root path.

This removes duplicated code and teaches cgtop to combine
-M with a root prefix:

$ systemd-cgtop -M myprecious /system.slice
...
2017-02-01 20:29:09 -05:00
Zbigniew Jędrzejewski-Szmek
049cb73b36 cgls: make function to query cgroup root public
No functional change.
2017-02-01 20:25:30 -05:00
Lennart Poettering
ef2f4f911b Merge pull request #5151 from keszybz/journal-flags
More information about unsupported journal file flags
2017-02-02 01:01:45 +01:00
Brandon Philips
9806301614 man: fix spelling error parth -> path 2017-02-02 00:54:42 +01:00
Zbigniew Jędrzejewski-Szmek
bef19548a2 systemctl: restore --failed (#5198)
'systemctl --failed' is an extremely common operation and it's nice to have
a shortcut for it.

Revert "man: don't document systemctl --failed" and add the option back to
systemctl's help and shell completion scripts.

This reverts commit 036359ba8d.
2017-02-02 00:23:46 +01:00
Lennart Poettering
9ff233dc1f hexdecoct: use typesafe new() instead of malloc() 2017-02-02 00:10:44 +01:00
Lennart Poettering
49bfc8774b fs-util: unify code we use to check if dirent's d_name is "." or ".."
We use different idioms at different places. Let's replace this is the
one true new idiom, that is even a bit faster...
2017-02-02 00:06:18 +01:00
Zbigniew Jędrzejewski-Szmek
1cec251c24 system-update-generator: warn if the command line blocks updates (#5173)
If "3", "5", "systemd.unit=", or similar are present on the kernel command line,
the system will not enter into offline update. This behaviour is in line with the
general logic that configuration on the kernel command line has higher priority
than the configuration on disk, but is rather surprising. Emit a warning to help
users diagnose the situation.

https://bugzilla.redhat.com/show_bug.cgi?id=1405439#c4
2017-02-01 21:50:03 +01:00
Lennart Poettering
1d0106996c update TODO 2017-02-01 20:02:17 +01:00
Zbigniew Jędrzejewski-Szmek
869a3458cb Merge pull request #5191 from keszybz/tweaks 2017-02-01 10:27:32 -05:00
Zbigniew Jędrzejewski-Szmek
a6c5909665 Revert "Trivial typo fixes and code refactorings (#5191)"
Let's do a merge to preserve all the commit messages.

This reverts commit 785d345145.
2017-02-01 10:26:50 -05:00
Zbigniew Jędrzejewski-Szmek
785d345145 Trivial typo fixes and code refactorings (#5191)
* logind: trivial simplification

free_and_strdup() handles NULL arg, so make use of that.

* boot: fix two typos

* pid1: rewrite check in ignore_proc() to not check condition twice

It's harmless, but it seems nicer to evaluate a condition just a single time.

* core/execute: reformat exec_context_named_iofds() for legibility

* core/execute.c: check asprintf return value in the usual fashion

This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.

CID #1368227.

* core/timer: use (void)

CID #1368234.

* journal-file: check asprintf return value in the usual fashion

This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.

CID #1368236.

* shared/cgroup-show: use (void)

CID #1368243.

* cryptsetup: do not return uninitialized value on error

CID #1368416.
2017-02-01 15:04:27 +01:00
Philip Withnall
1a68e1e543 nspawn: Print attempted execv() path on failure (#5199)
The failure message is typically currently:
   execv() failed: No such file or directory
which is not very useful because it doesn’t tell you which file or
directory it was trying to exec.
2017-02-01 08:36:16 -05:00
Evgeny Vereshchagin
b5267219dd Merge pull request #5166 from keszybz/gcc7
Fixes for gcc 7 and new µhttpd & glibc warnings
2017-02-01 12:02:50 +03:00
Zbigniew Jędrzejewski-Szmek
a38d90c672 Merge pull request #5146 from ssahani/ifname-alias
networkd: Allow ':' in label

This reverts a341dfe563 and takes a slightly different approach: anything is
allowed in network interface labels, but network interface names are verified
as before (i.e. amongst other things, no colons are allowed there).
2017-01-31 20:36:20 -05:00
Zbigniew Jędrzejewski-Szmek
6154d33de3 nss-util: silence warning about deprecated RES_USE_INET6
src/nss-resolve/nss-resolve.c: In function ‘_nss_resolve_gethostbyname_r’:
src/nss-resolve/nss-resolve.c:680:13: warning: RES_USE_INET6 is deprecated
 NSS_GETHOSTBYNAME_FALLBACKS(resolve);
             ^~~~~~~~~~~~~~~~~~~~~~~~~

In glibc bz #19582, RES_USE_INET6 was deprecated. This might make sense for
clients, but they didn't take into account nss module implementations which
*must* continue to support the option. glibc internally defines
DEPRECATED_RES_USE_INET6 which can be used without emitting a warning, but
it's not exported publicly. Let's do the same, and just copy the definition
to our header.
2017-01-31 19:55:33 -05:00
Zbigniew Jędrzejewski-Szmek
2c5248e245 MurmurHash: all /* fall through */ comments 2017-01-31 19:35:04 -05:00
Zbigniew Jędrzejewski-Szmek
81a6ac6cf6 cryptsetup: do not return uninitialized value on error
CID #1368416.
2017-01-31 14:08:14 -05:00
Zbigniew Jędrzejewski-Szmek
ae50101aab journal/lookup3: silence gcc 7 implicit-fallthrough warning
This file doesn't include any of our headers, so just use the pragma
without defining it in macros.h
2017-01-31 14:04:55 -05:00
Zbigniew Jędrzejewski-Szmek
ec251fe7d5 tree-wide: adjust fall through comments so that gcc is happy
gcc 7 adds -Wimplicit-fallthrough=3 to -Wextra. There are a few ways
we could deal with that. After we take into account the need to stay compatible
with older versions of the compiler (and other compilers), I don't think adding
__attribute__((fallthrough)), even as a macro, is worth the trouble. It sticks
out too much, a comment is just as good. But gcc has some very specific
requiremnts how the comment should look. Adjust it the specific form that it
likes. I don't think the extra stuff we had in those comments was adding much
value.

(Note: the documentation seems to be wrong, and seems to describe a different
pattern from the one that is actually used. I guess either the docs or the code
will have to change before gcc 7 is finalized.)
2017-01-31 14:04:55 -05:00
Zbigniew Jędrzejewski-Szmek
9ce6d1b319 nspawn: fix clobbering of selinux context arg
First bug fixed by gcc 7. Yikes.
2017-01-31 14:04:55 -05:00
Zbigniew Jędrzejewski-Szmek
70954c50e7 pid1: remove duplicate const attribute
gcc 7 started warning about this.
2017-01-31 14:04:55 -05:00
Zbigniew Jędrzejewski-Szmek
21b6ff3684 microhttpd-util: silence warnings about deprecated options 2017-01-31 14:04:55 -05:00
Evgeny Vereshchagin
91d910e386 core: fix copy paste error (s/source/destination/) (#5197)
```
-bash-4.3# systemd-run --property BindPaths=/etc:tmp/hey sh -c 'ls /tmp/hey'
```
prints
`Destination path tmp/hey is not absolute.`
instead of
`Destination path /etc is not absolute.`

CID #1368239
2017-01-31 13:04:01 -05:00
Zbigniew Jędrzejewski-Szmek
db284505c8 shared/cgroup-show: use (void)
CID #1368243.
2017-01-31 11:41:48 -05:00
Zbigniew Jędrzejewski-Szmek
7645c77b9b journal-file: check asprintf return value in the usual fashion
This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.

CID #1368236.
2017-01-31 11:41:46 -05:00
Zbigniew Jędrzejewski-Szmek
25cb94d431 core/timer: use (void)
CID #1368234.
2017-01-31 11:33:56 -05:00
Zbigniew Jędrzejewski-Szmek
587ab01b53 core/execute.c: check asprintf return value in the usual fashion
This is unlikely to fail, but we cannot rely on asprintf return value
on failure, so let's just be correct here.

CID #1368227.
2017-01-31 11:31:47 -05:00
Zbigniew Jędrzejewski-Szmek
56fbd56143 core/execute: reformat exec_context_named_iofds() for legibility 2017-01-31 11:23:10 -05:00
Evgeny Vereshchagin
d3cba4eaf6 coredump: really extract container cmdline (#5167)
Fixes:
```
root# systemd-nspawn -D ./cont/ --register=no /bin/sh -c '/bin/sh -c "kill -ABRT \$\$"'
...
Container cont failed with error code 134.

root# journalctl MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1 -o verbose | grep -i container_cmdline
...prints nothing...
...should be COREDUMP_CONTAINER_CMDLINE=systemd-nspawn -D ./cont/ --register=no /bin/sh -c /bin/sh -c "kill -ABRT \$\$"
```

Also, fixes CID #1368263
```
==352== 130 bytes in 1 blocks are definitely lost in loss record 1 of 2
==352==    at 0x4C2ED5F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==352==    by 0x4ED8581: greedy_realloc (alloc-util.c:57)
==352==    by 0x4ECAAD5: get_process_cmdline (process-util.c:147)
==352==    by 0x10E385: get_process_container_parent_cmdline (coredump.c:645)
==352==    by 0x112949: process_kernel (coredump.c:1240)
==352==    by 0x113003: main (coredump.c:1297)
==352==
```
2017-01-31 11:04:20 -05:00
Zbigniew Jędrzejewski-Szmek
aa475dc227 Merge pull request #5168 from ddstreet/apply_format_helper
simplify udev_event_apply_format().
2017-01-31 10:56:09 -05:00
Zbigniew Jędrzejewski-Szmek
2c4c08b7e6 Merge pull request #5177 from M0Rf30/master
hwdb: quirk for kionix accelerometer on Asus TP500LB
2017-01-31 10:51:56 -05:00
Zbigniew Jędrzejewski-Szmek
fccdf28c86 Merge pull request #5192 from keszybz/systemctl-ignore-sigterm
Fix for initrd-switch-root failing and causing emergency.target to be started.
2017-01-31 10:36:30 -05:00
3chas3
877777d776 util-lib: Fix chase_symlinks() with absolute symlinks (#5185)
If chase_symlinks() encouters an absolute symlink, it resets the todo
buffer to just the newly discovered symlink and discards any of the
remaining previous symlink path.  Regardless of whether or not the
symlink is absolute or relative, we need to preserve the remainder of
the path that has not yet been resolved.
2017-01-31 16:21:15 +03:00
Evgeny Vereshchagin
ef1fd941f9 basic: check strdup result in khash_dup (#5176)
Fixes CID #1368249
2017-01-31 08:27:14 +01:00
Martin Pitt
70d940ec75 Merge pull request #5175 from keszybz/hostname-fallback
Allow distributions to override the "localhost" fallback
2017-01-31 08:26:42 +01:00
Zbigniew Jędrzejewski-Szmek
c954f33233 man: mention ConditionFirstBoot= in systemd-firstboot(1) (#5186) 2017-01-31 08:25:19 +01:00
Zbigniew Jędrzejewski-Szmek
750e550eba units: restore Before dependencies for systemd-vconsole-setup.service
When the service is run in the initramfs, it is possible for it to get started
and not be fast enough to exit before the root switch happens. It is started
multiple times (depending on the consoles being detected), and runs
asynchronously, so this is quite likely. It'll then get killed by killall(),
and systemd will consider the service failed. To avoid all this, just wait
for the service to terminate on it's own.

Before=initrd-switch-root.target should be good for the initramfs, and
Before=shutdown.tuarget should be good for the real system, although it's
unlikely to make any difference there.
2017-01-31 01:34:40 -05:00
Zbigniew Jędrzejewski-Szmek
8a7a9ceab2 systemctl: ignore SIGTERM after switch root
https://bugzilla.redhat.com/show_bug.cgi?id=1414904#c14 and #c15.
2017-01-31 01:34:40 -05:00
Zbigniew Jędrzejewski-Szmek
0af9a194ca units: drop KillMode= from initrd-switch-root.service
The service already has DefaultDeps disabled, so systemd should not try to stop
it. And if it *does* get stopped, we don't want the zombie process around.
KillMode=none does not change anything in the killall() phase, and we already
use argv[0][0] = '@' to protect against that anyway. KillMode=none should not
be useful in normal operation, so let's leave it out.
2017-01-31 01:34:40 -05:00
Zbigniew Jędrzejewski-Szmek
b3ad0ff48c systemctl: always avoid being killed when doing switch-root
The same logic as described in acc28e2e30 applies to any time we are
switching root, to just set the flag unconditionally.
2017-01-31 01:34:40 -05:00
Zbigniew Jędrzejewski-Szmek
9e615117da pid1: rewrite check in ignore_proc() to not check condition twice
It's harmless, but it seems nicer to evaluate a condition just a single time.
2017-01-31 00:49:53 -05:00
Zbigniew Jędrzejewski-Szmek
7db5706eec boot: fix two typos 2017-01-31 00:49:53 -05:00
Zbigniew Jędrzejewski-Szmek
28a9ec4443 logind: trivial simplification
free_and_strdup() handles NULL arg, so make use of that.
2017-01-31 00:47:07 -05:00