1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00
Commit Graph

31638 Commits

Author SHA1 Message Date
Lennart Poettering
1096bb8a9e process-util: allow rename_process() only in the main thread
We make assumptions about the comm name we set via PR_SET_NAME: that it
would reflect the process name, but that's only the case for the main
thread. Moreover, we cache the mmap() region without locking.

Let's hence be safe rather than sorry and support all this only in the
main thread.
2017-12-25 11:48:21 +01:00
Lennart Poettering
18c528e99f basic: split out blockdev-util.[ch] from util.h
With three functions it makes sense to split this out now.
2017-12-25 11:48:21 +01:00
Lennart Poettering
0adc28ceec agents: use kill_and_sigcont() where appropriate 2017-12-25 11:48:21 +01:00
Lennart Poettering
78752f2eb4 process-util: move fork_agent() to process-util.[ch]
It's a relatively small wrapper around safe_fork() now, hence let's move
it over, and make its signature even more alike. Also, set a different
process name for the polkit and askpw agents.
2017-12-25 11:48:21 +01:00
Lennart Poettering
fa7ff4cf03 tree-wide: properly name all threads we fork off 2017-12-25 11:48:21 +01:00
Lennart Poettering
451cdf7830 udev: some very trivial coding style updates 2017-12-25 11:48:21 +01:00
Lennart Poettering
a45d7127e7 tree-wide: use EXIT_SUCCESS/EXIT_FAILURE in exit() where we can 2017-12-25 11:48:21 +01:00
Lennart Poettering
d00c263143 shutdown: unify shutdown.c's and async.c's sync() helper process
The helper processes are pretty much the same now, let's unify them
hence.
2017-12-25 11:48:21 +01:00
Lennart Poettering
4c253ed1ca tree-wide: introduce new safe_fork() helper and port everything over
This adds a new safe_fork() wrapper around fork() and makes use of it
everywhere. The new wrapper does a couple of things we previously did
manually and separately in a safer, more correct and automatic way:

1. Optionally resets signal handlers/mask in the child

2. Sets a name on all processes we fork off right after forking off (and
   the patch assigns useful names for all processes we fork off now,
   following a systematic naming scheme: always enclosed in () – in order
   to indicate that these are not proper, exec()ed processes, but only
   forked off children, and if the process is long-running with only our
   own code, without execve()'ing something else, it gets am "sd-" prefix.)

3. Optionally closes all file descriptors in the child

4. Optionally sets a PR_SET_DEATHSIG to SIGTERM in the child, in a safe
   way so that the parent dying before this happens being handled
   safely.

5. Optionally reopens the logs

6. Optionally connects stdin/stdout/stderr to /dev/null

7. Debug logs about the forked off processes.
2017-12-25 11:48:21 +01:00
Lennart Poettering
d8caff6db6 terminal-util: open /dev/null with O_CLOEXEC in make_stdio_null()
Ultimately, O_CLOEXEC should be off in fd 0, 1, 2, but when we open
/dev/null here it's unlikely to be < 0, and after dupping the fd to 0,
1, 2 we turn off O_CLOEXEC explicitly anyway.

Unless we know that what we are about to open will return 0, 1 or 2 we
should always set O_CLOEXEC in order to be safe to other threads forking
of subprocesses at the wrong moment.
2017-12-25 11:48:21 +01:00
Lennart Poettering
395195bb42 terminal-util: return first error, not last in make_stdio()
Just a minor tweak, making sure we execute as much as we can of the
funciton, but return the first error instead of the last we encounter.

This is usuelly how we do things when we have functions that continue on
the first error, so let's do it like that here too.
2017-12-25 11:48:21 +01:00
Lennart Poettering
e43bc9f526 fd-util: use close_nointr() return value instead of errno
Our own calls return errors in their return values, hence use that
rather than errno when checking errors.
2017-12-25 11:48:21 +01:00
Lennart Poettering
61ccf77238 fd-util: add some (void) casts 2017-12-25 11:48:21 +01:00
Lennart Poettering
41bd3379ef sync: fork off sync() in a process instead of a thread
Let's fork off sync() ina process instead of a thread, as a safety
measure. This is beneficial to ensure that the original process can exit
without having to wait for the sync() to finish (note that the kernel
will delay process termination until all threads finished their
syscalls). In case of hanging NFS this increases the chance that PID 1
can safely transition to the "systemd-shutdown" process as the sync() is
initiated early on but definitely not waited for.
2017-12-25 11:48:21 +01:00
Yu Watanabe
0e50bfaefd meson: define _GNU_SOURCE to detect copy_file_range() (#7734)
Follow-up for bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f of git
repository for glibc.

Recently glibc added `copy_file_range()`, but to use it,
`_GNU_SOURCE` needs to be defined. This adds the flag in
meson.build to detect the function by meson correctly.
2017-12-25 11:42:42 +01:00
Lennart Poettering
ebe6ff658d
Merge pull request #7663 from keszybz/mkdir-return-value
util-lib: fix return value in mkdir_parents()
2017-12-24 11:59:58 +01:00
Lennart Poettering
15ce164770 systemctl: don't show vendor preset state for generated/transient units (#7711)
Showing the preset state for those suggests they could actually be
enabled/disabled, but that concept doesn't exist for generated/transient
units, hence hide this information.

This came up here:

https://lists.freedesktop.org/archives/systemd-devel/2017-December/040022.html
2017-12-24 08:47:24 +09:00
Lennart Poettering
7785da68e6
Merge pull request #7695 from yuwata/transient-socket
DBus-API: implement transient socket unit
2017-12-23 19:20:29 +01:00
Susant Sahani
d384826f69 networkd: Add support for ipvlan L3s and flags (#7726)
This works supports to configure L3S mode and flags
such as bridge, private and vepa
2017-12-23 18:55:03 +01:00
Lennart Poettering
186d5f2e79
Merge pull request #7620 from keszybz/two-docs
Two docs
2017-12-23 12:40:48 +01:00
Lucas Werkmeister
053114090b man: mention StateDirectory in file-hierarchy(7) 2017-12-23 12:30:05 +01:00
Yu Watanabe
533f8a6771 load-fragment: simplify list insertion logic
LIST_FIND_TAIL and LIST_INSERT_AFTER can work for empty list.
2017-12-23 19:32:46 +09:00
Yu Watanabe
32048f5414 cgroup: IODeviceWeight= or friends can take device node files in /run/systemd/inaccessible/
systemd creates several device nodes in /run/systemd/inaccessible/.
This makes CGroup's settings related to IO can take device node
files in the directory.
2017-12-23 19:32:42 +09:00
Yu Watanabe
845001221d core/socket: shorten socket_fdname() 2017-12-23 19:32:40 +09:00
Yu Watanabe
827d9bf297 core/socket: dump more settings 2017-12-23 19:32:38 +09:00
Yu Watanabe
13ec20d42a dbus-cgroup: merge several blocks which operate almost same tasks 2017-12-23 19:32:36 +09:00
Yu Watanabe
d6ff82d37c dbus-execute: use empty_to_null() where it can be applicable 2017-12-23 19:32:34 +09:00
Yu Watanabe
f50ab33faf doc: add {Condition,Assert}ControlGroupController= to TRANSIENT-SETTINGS.md
Follow-up for e16647c39d.
2017-12-23 19:32:31 +09:00
Yu Watanabe
d9f7305fd7 cgroup: move path checking logic to dbus-cgroup.c 2017-12-23 19:32:29 +09:00
Yu Watanabe
62b749a981 bus-unit-util: simplify bus_append_cgroup_property() 2017-12-23 19:32:27 +09:00
Yu Watanabe
eae194a51b bus-unit-util: make dependency settings can take multiple units
This allows people to specify multiple units in dependency settings
e.g. `Requires=foo.service baz.service`.
2017-12-23 19:32:25 +09:00
Yu Watanabe
b48e508db3 dbus-socket: move truncation check to bus_socket_set_transient_property() 2017-12-23 19:32:23 +09:00
Yu Watanabe
e045e325df basic: introduce socket_protocol_{from,to}_name()
And use them where they can be applicable.
2017-12-23 19:32:04 +09:00
Yu Watanabe
8a211c8edb doc: update TRANSIENT-SETTINGS.md 2017-12-23 18:48:35 +09:00
Yu Watanabe
624dd00973 man: add explanation about transient path or socket units in systemd-run 2017-12-23 18:48:31 +09:00
Yu Watanabe
d59ef3e243 run: add support to create transient path and socket unit 2017-12-23 18:48:27 +09:00
Yu Watanabe
89ada3ba08 bus-unit-util: add socket unit related options
Also, split bus_append_unit_property_assignment().
2017-12-23 18:48:16 +09:00
Yu Watanabe
9c0320e7ab core: implement transient socket unit 2017-12-23 18:47:33 +09:00
Yu Watanabe
398ce0bc5a socket-util: add socket_address_type_{from,to}_string() 2017-12-23 18:46:43 +09:00
Yu Watanabe
038ed5a4b6 core/socket: add socket_port_type_from_string() 2017-12-23 18:46:16 +09:00
Yu Watanabe
836bb1cd42 core:socket: fix string in socket_exec_command_table 2017-12-23 18:45:59 +09:00
Yu Watanabe
9ee896d5dd core,seccomp: fix logic to parse RestrictAddressFamilies= in dbus-execute.c
If multiple RestrictAddressFamilies= settings, some of them are
whitelist and the others are blacklist, are sent to bus, then parsing
result was corrupted.
This fixes the parse logic, now it is the same as one used in
load-fragment.c
2017-12-23 18:45:52 +09:00
Yu Watanabe
898748d8b9 core,seccomp: fix logic to parse syscall filter in dbus-execute.c
If multiple SystemCallFilter= settings, some of them are whitelist
and the others are blacklist, are sent to bus, then the parse
result was corrupted.
This fixes the parse logic, now it is the same as one used in
load-fragment.c
2017-12-23 18:45:32 +09:00
Lennart Poettering
7e985c6983 coccinelle: beef up isempty() checks (#7729)
With these additions, coccinelle finds everything fixed by the first
commit in PR #7695. In order not to needlessly conflict with that PR
this PR won't include those fixes, but only the coccinelle changes to
detect them automatically in the future.
2017-12-23 08:47:55 +01:00
Dmitry Rozhkov
5526ac50fe man: fix example config to conform the content of the man page
The config example contains wrong specificator for hostname.
It should be %H instead of %h as documented in the man page.

Use correct specificator for hostname.
2017-12-22 15:35:17 +01:00
Sylvain Plantefève
fe25b1496b catalog: update french translation 2017-12-22 15:34:51 +01:00
Mathieu Malaterre
63d00dfb64 shared/seccomp: add mmap handling for powerpc
Also remove the warning:

./src/shared/seccomp-util.c:1414:2: warning: #warning "Consider adding the right mmap() syscall definitions here!" [-Wcpp]
 #warning "Consider adding the right mmap() syscall definitions here!"
2017-12-22 15:30:03 +01:00
Yu Watanabe
e1694a752f networkd: show warning on error or cast to void when error is ignored (#7716) 2017-12-21 19:07:23 +01:00
Zbigniew Jędrzejewski-Szmek
4f561ecda9 meson: reuse libsystemd_static for libsystemd
This gets rid of recompilation, making things faster and avoids duplicated warnings.
The result seems to be the same:
$ ls -l build/libsystemd.so.0.20.0 build2/libsystemd.so.0.20.0
-rwxrwxr-x. 1 zbyszek zbyszek 3071312 Dec 19 11:45 build2/libsystemd.so.0.20.0
-rwxrwxr-x. 1 zbyszek zbyszek 3071760 Dec 19 11:11 build/libsystemd.so.0.20.0
$ diff -U1 <(objdump -T build/libsystemd.so.0.20.0|sed -r 's/[0-9a-f]{16}/________________/g') <(objdump -T build2/libsystemd.so.0.20.0|sed -r 's/[0-9a-f]{16}/________________/g')
-build/libsystemd.so.0.20.0:     file format elf64-x86-64
+build2/libsystemd.so.0.20.0:     file format elf64-x86-64
2017-12-21 17:01:23 +01:00
Zbigniew Jędrzejewski-Szmek
37e4d7a855 meson: rename libsystemd_internal to libsystem_static
We already use the "_static" suffix for libshared_static ("shared" is the name
of the library, "static" is the format) and other libs, so let's rename for
consistency.

Also change libsystemd_static_sources to libsystemd_sources, since the same
list is used for both and shorter is better.
2017-12-21 17:01:02 +01:00