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

22435 Commits

Author SHA1 Message Date
Lennart Poettering
9a66c87a23 cgroup: make sure cg_is_empty_recursive() returns 1 for non-existing cgroups
Previously, on the legacy hierarchy a non-existing cgroup was considered
identical to an empty one, but the unified hierarchy the check for a
non-existing one returned ENOENT.
2015-09-04 09:07:31 +02:00
Lennart Poettering
b8725df8b3 cgroup: when comparing agent paths, use path_equal()
After all a path is a path is a path and we should use path_equal() to
comapre those.
2015-09-04 09:07:31 +02:00
Lennart Poettering
d7e46e01ac audit: audit calls should return ENODATA when process are not in an audit session
ENODATA is how we usually indicate such "missing info" cases, so we
should do this here, too.
2015-09-04 09:07:31 +02:00
Lennart Poettering
ef5c570edf util: document why parse_uid() returns ENXIO
parse_uid() returns EINVAL for invalid strings, but ENXIO for the
(uid_t) -1 user ids in order to distinguish these two cases. Document
this.
2015-09-04 09:07:31 +02:00
Lennart Poettering
b3ac818be8 core: split up manager_get_unit_by_pid()
Let's move the actual cgroup part of it into a new separate function
manager_get_unit_by_pid_cgroup(), and then make
manager_get_unit_by_pid() just a wrapper that also checks the two pid
hashmaps.

Then, let's make sure the various calls that want to deliver events to
the owners of a PID check both hashmaps and the cgroup and deliver the
event to *each* of them. OTOH make sure bus calls like GetUnitByPID()
continue to check the PID hashmaps first and the cgroup only as
fallback.
2015-09-04 09:07:31 +02:00
Lennart Poettering
569b19d8fe cgroup: move controller to dirname translation into join_path_legacy()
Let's simplify things a bit.
2015-09-04 09:07:30 +02:00
Lennart Poettering
a1f686daf5 util: add new uid_is_valid() call
This simply factors out the uid validation checks from parse_uid() and
uses them everywhere. This simply verifies that the passed UID is
neither 64bit -1 nor 32bit -1.
2015-09-04 09:07:30 +02:00
Lennart Poettering
fea72cc033 macro: introduce new PID_TO_PTR macros and make use of them
This adds a new PID_TO_PTR() macro, plus PTR_TO_PID() and makes use of
it wherever we maintain processes in a hash table. Previously we
sometimes used LONG_TO_PTR() and other times ULONG_TO_PTR() for that,
hence let's make this more explicit and clean up things.
2015-09-04 09:07:30 +02:00
Lennart Poettering
a8ba86ce6a man: always use the same example in nss module documentation
Show the same recommended example file in all three man pages, just
highlight the different, relevant parts.

This should be less confusing for users, and clarify what we actually
recommend how /etc/nsswitch.conf is set up.
2015-09-04 09:07:30 +02:00
Marcel Holtmann
c7f837628b hwdb: Update database of Bluetooth company identifiers 2015-09-04 02:51:50 +02:00
David Herrmann
e859aa9e99 udev: ignore ENOEXEC from cgroup lookup
The recent cgroup-rework changed the error code for un-mounted cgroupfs to
ENOEXEC. Make sure udev ignores it just like ENOENT and does not spill
warnings on the screen.
2015-09-03 15:19:15 +02:00
Daniel Mack
017574e6e8 Merge pull request #1127 from neheb/master
hwdb: Add Mionix Mouse
2015-09-03 12:35:48 +02:00
Lennart Poettering
78fc2ed383 Merge pull request #1134 from reverendhomer/patch-1
cgroup-util: Removed unreachable statement in cg_get_path
2015-09-03 11:22:19 +02:00
reverendhomer
99d3888a19 cg_get_path: Removed unreachable statement
controller cannot be NULL because if-statement in L509 has return
Coverity #1322379
2015-09-03 11:34:47 +03:00
Lennart Poettering
f0ff5bb88c Merge pull request #1123 from phomes/scope-no-bool-vs-int
scope: do not compare a bool return with "<= 0"
2015-09-03 01:12:58 +02:00
Lennart Poettering
bf1c25bbc4 Merge pull request #1126 from phomes/indentation2
tree-wide: fix indentation
2015-09-03 01:12:07 +02:00
Mangix
f0e04d2032 Add Mionix Mouse 2015-09-02 15:56:57 -07:00
Thomas Hindoe Paaboel Andersen
b3c5bad3d6 tree-wide: fix indentation 2015-09-02 20:46:42 +02:00
Thomas Hindoe Paaboel Andersen
09d2f5b1c9 scope: do not compare a bool return with "<= 0" 2015-09-02 19:58:12 +02:00
Kay Sievers
c069f47779 Merge pull request #1119 from teg/virtio-names
udev: net_id - support predictable ifnames on virtio buses
2015-09-02 14:30:49 +02:00
Tom Gundersen
54683f0f9b udev: net_id - support predictable ifnames on virtio buses
Virtio buses are undeterministically enumerated, so we cannot use them as a basis
for deterministic naming (see bf81e792f3). However, we are guaranteed that there
is only ever one virtio bus for every parent device, so we can simply skip over
the virtio buses when naming the devices.
2015-09-02 14:24:17 +02:00
Lennart Poettering
28bc259c01 Merge pull request #1118 from jsynacek/man-dot-d-v2
man: *.d conf directories: add note about initrd regeneration
2015-09-02 11:30:08 +02:00
Lennart Poettering
a8c0f36714 Merge pull request #1116 from poettering/unified-rebased
core: unified cgroup hierarchy support
2015-09-02 11:21:24 +02:00
David Herrmann
d18ec0491e Merge pull request #1112 from poettering/sd-bus-container-fixes
machined and sd-bus container fixes
2015-09-02 11:14:41 +02:00
Jan Synacek
2ef555d69a man: *.d conf directories: add note about initrd regeneration 2015-09-02 10:01:34 +02:00
Daniel Mack
f22572452b Merge pull request #1117 from evverx/detect-parallels-virt
virt: detect parallels virtualization
2015-09-02 08:00:38 +02:00
Evgeny Vereshchagin
d84248ebec virt: detect parallels virtualization
inspired by http://people.redhat.com/~rjones/virt-what/

see:
* http://git.annexia.org/?p=virt-what.git;a=blob;f=virt-what.in;h=a5ed33ef3e4bfa3281c9589eccac4d92dff1babe;hb=HEAD#l200
* http://git.annexia.org/?p=virt-what.git;a=blob;f=virt-what.in;h=a5ed33ef3e4bfa3281c9589eccac4d92dff1babe;hb=HEAD#l253
2015-09-02 01:49:47 +00:00
Lennart Poettering
efdb02375b core: unified cgroup hierarchy support
This patch set adds full support the new unified cgroup hierarchy logic
of modern kernels.

A new kernel command line option "systemd.unified_cgroup_hierarchy=1" is
added. If specified the unified hierarchy is mounted to /sys/fs/cgroup
instead of a tmpfs. No further hierarchies are mounted. The kernel
command line option defaults to off. We can turn it on by default as
soon as the kernel's APIs regarding this are stabilized (but even then
downstream distros might want to turn this off, as this will break any
tools that access cgroupfs directly).

It is possibly to choose for each boot individually whether the unified
or the legacy hierarchy is used. nspawn will by default provide the
legacy hierarchy to containers if the host is using it, and the unified
otherwise. However it is possible to run containers with the unified
hierarchy on a legacy host and vice versa, by setting the
$UNIFIED_CGROUP_HIERARCHY environment variable for nspawn to 1 or 0,
respectively.

The unified hierarchy provides reliable cgroup empty notifications for
the first time, via inotify. To make use of this we maintain one
manager-wide inotify fd, and each cgroup to it.

This patch also removes cg_delete() which is unused now.

On kernel 4.2 only the "memory" controller is compatible with the
unified hierarchy, hence that's the only controller systemd exposes when
booted in unified heirarchy mode.

This introduces a new enum for enumerating supported controllers, plus a
related enum for the mask bits mapping to it. The core is changed to
make use of this everywhere.

This moves PID 1 into a new "init.scope" implicit scope unit in the root
slice. This is necessary since on the unified hierarchy cgroups may
either contain subgroups or processes but not both. PID 1 hence has to
move out of the root cgroup (strictly speaking the root cgroup is the
only one where processes and subgroups are still allowed, but in order
to support containers nicey, we move PID 1 into the new scope in all
cases.) This new unit is also used on legacy hierarchy setups. It's
actually pretty useful on all systems, as it can then be used to filter
journal messages coming from PID 1, and so on.

The root slice ("-.slice") is now implicitly created and started (and
does not require a unit file on disk anymore), since
that's where "init.scope" is located and the slice needs to be started
before the scope can.

To check whether we are in unified or legacy hierarchy mode we use
statfs() on /sys/fs/cgroup. If the .f_type field reports tmpfs we are in
legacy mode, if it reports cgroupfs we are in unified mode.

This patch set carefuly makes sure that cgls and cgtop continue to work
as desired.

When invoking nspawn as a service it will implicitly create two
subcgroups in the cgroup it is using, one to move the nspawn process
into, the other to move the actual container processes into. This is
done because of the requirement that cgroups may either contain
processes or other subgroups.
2015-09-01 23:52:27 +02:00
Lennart Poettering
b92340af68 Merge pull request #1115 from phomes/hwdb-mice
hwdb: more mice
2015-09-01 22:07:58 +02:00
Thomas Hindoe Paaboel Andersen
ea24343247 hwdb: more mice 2015-09-01 22:02:05 +02:00
Lennart Poettering
b85ec419cb Merge pull request #1098 from filbranden/cpuaffinity2
Getting rid of FOREACH_WORD_QUOTED and some more cleanup in config_parse_cpu_affinity2
2015-09-01 20:52:52 +02:00
Lennart Poettering
92dcf85e11 Merge pull request #1107 from msekletar/selinux-get-raw-context
selinux: always use *_raw API from libselinux
2015-09-01 20:46:27 +02:00
Lennart Poettering
751090cc8a sd-bus: when connecting to a container, don't fall back to host bus
We should never connect to the host bus as fallback if connecting to a
container failed via one method. Otherwise connecting to a dbus1
container will always result in a connection to the host.
2015-09-01 20:40:24 +02:00
Lennart Poettering
80b0d3e311 sd-bus: when connecting to a kdbus container bus pass error up
We rely on the correct error used when opening the kdbus device node,
hence let's make sure we pass it up from the namespaced child process to
the process which actually wants to connect.
2015-09-01 20:40:24 +02:00
Lennart Poettering
a07c35c3e6 machined: introduce a ptsname_namespace() call and make use of it
The call is like ptsname() but does not assume the pty path was
accessible in the local namespace. It uses the same internal ioctl
though.
2015-09-01 20:40:24 +02:00
Lennart Poettering
395745ba53 machined: call unlockpt() in container, not host
It makes assumptions about the pty path, hence better call it in the
container namespace rather than the host.
2015-09-01 20:40:24 +02:00
Filipe Brandenburger
5cc623e644 core: Log parse errors in config_parse_cpu_affinity2 2015-09-01 11:10:09 -07:00
Tom Gundersen
fc94c32605 Merge pull request #1111 from poettering/more-cgroup-fixes
More cgroup fixes
2015-09-01 19:48:04 +02:00
Lennart Poettering
332929623a Merge pull request #1099 from filbranden/joincontrollers2
Getting rid of FOREACH_WORD_QUOTED in config_parse_join_controllers
2015-09-01 19:10:45 +02:00
Lennart Poettering
aa3e5246ba Merge pull request #1102 from heftig/master
build-sys: Look for gcc-* binutils wrappers only if we're using GCC
2015-09-01 19:09:42 +02:00
Lennart Poettering
d6d8075a86 Merge pull request #1109 from phomes/man-typos
man: fix typos in systemd-path.xml
2015-09-01 19:08:55 +02:00
Lennart Poettering
a9326c4046 Merge pull request #1110 from evverx/run-interactive-auth
run: enable interactive authorization
2015-09-01 19:08:17 +02:00
Lennart Poettering
d06673212e core: rework when we kill with which signal
When the user wants to explicitly send our own PID a signal, then do so.

Don't follow up SIGABRT with a SIGHUP if send_sighup is enabled. At that
point the process should have segfaulted, hence there's no point in
following up with a SIGHUP.

Send only termination signals to ourselves, never KILL or ABRT signals.
2015-09-01 18:54:08 +02:00
Lennart Poettering
102ef9829e core: don't allow changing the slice of a unit while it is active 2015-09-01 18:53:29 +02:00
Lennart Poettering
b821a397c0 unit: small clean-ups
Always say when we ignore errors. Cast calls whose return value we
knowingly ingore to (void). Use "bool" where we actually mean a boolean,
even if we return it as an int later on.
2015-09-01 18:52:15 +02:00
Lennart Poettering
5fe8876b32 core: when looking for the unit for a process, look at the PID hashmaps first
It's cheaper that going to cgroupfs, and also usually the better choice
since it's not racy and can map PIDs even if they were moved to a
different unit.
2015-09-01 18:47:46 +02:00
Evgeny Vereshchagin
8c7db2fb21 run: enable interactive authorization 2015-09-01 16:43:08 +00:00
Lennart Poettering
6fd6650737 cgroup: the root cgroup is always populated 2015-09-01 18:37:01 +02:00
Lennart Poettering
6f883237f1 cgroup: drop "ignore_self" argument from cg_is_empty()
In all cases where the function (or cg_is_empty_recursive()) ignoring
the calling process is actually wrong, as a process keeps a cgroup busy
regardless if its the current one or another. Hence, let's simplify
things and drop the "ignore_self" parameter.
2015-09-01 18:37:01 +02:00
Lennart Poettering
e155a0aa04 cgroup: small cleanups and coding style fixes
A number of simplications and adjustments to brings things closer to our
coding style.
2015-09-01 18:37:01 +02:00