Commit graph

22194 commits

Author SHA1 Message Date
Lennart Poettering 03a7b521e3 core: add support for the "pids" cgroup controller
This adds support for the new "pids" cgroup controller of 4.3 kernels.
It allows accounting the number of tasks in a cgroup and enforcing
limits on it.

This adds two new setting TasksAccounting= and TasksMax= to each unit,
as well as a gloabl option DefaultTasksAccounting=.

This also updated "cgtop" to optionally make use of the new
kernel-provided accounting.

systemctl has been updated to show the number of tasks for each service
if it is available.

This patch also adds correct support for undoing memory limits for units
using a MemoryLimit=infinity syntax. We do the same for TasksMax= now
and hence keep things in sync here.
2015-09-10 18:41:06 +02:00
Lennart Poettering 15af581253 Merge pull request #1236 from evverx/systemctl-requisite-of
systemctl: add RequisiteOf* as inverses of Requisite and RequisiteOverridable
2015-09-10 16:40:04 +02:00
Lennart Poettering 78e28c98e9 Merge pull request #1238 from again4you/devel/fix_smack_mtab
smack: label /etc/mtab as "_" when '--with-smack-run-label' is enabled.
2015-09-10 16:36:07 +02:00
Sangjung Woo 1fab0cbafc smack: label /etc/mtab as "_" when '--with-smack-run-label' is enabled.
/etc/mtab should be labeled as "_", even though systemd has its own
smack label using '--with-smack-run-label' configuration. This is mainly
because all processes could read that file and the origin of this file
(i.e. /proc/mounts) is labeled as "_". This labels /etc/mtab as "_" when
'--with-smack-run-label' is enabled.
2015-09-10 21:52:39 +09:00
Evgeny Vereshchagin 1143adf722 systemctl: add RequisiteOf* as inverses of Requisite and RequisiteOverridable 2015-09-10 14:49:29 +03:00
Daniel Mack f33be31198 Merge pull request #1226 from poettering/coccinelle-fixes3
Third round of Coccinelle fixes
2015-09-10 13:46:14 +02:00
Lennart Poettering 89921f6ed0 Merge pull request #1234 from medhefgo/master
cryptsetup-generator: Properly check return code
2015-09-10 12:10:44 +02:00
Jan Janssen c802a7306b cryptsetup-generator: Properly check return code 2015-09-10 10:23:49 +02:00
Martin Pitt 0018e4e479 Merge pull request #1230 from swem/master
Add microphone mute keymap for Dell Precision
2015-09-10 06:56:44 +02:00
Chen-Han Hsiao (Stanley) 6e675e278c Add microphone mute keymap for Dell Precision 2015-09-10 11:30:57 +08:00
Lennart Poettering f24aa148ab Merge pull request #1225 from mbiebl/remove-sphinx-leftover2
README: remove obsolete instructions regarding python-systemd/sphinx
2015-09-09 23:13:58 +02:00
Lennart Poettering 525d3cc746 tree-wide: take benefit of the fact that hashmap_free() returns NULL
And set_free() too.

Another Coccinelle patch.
2015-09-09 23:12:07 +02:00
Michael Biebl 45096d27d3 README: remove obsolete instructions regarding python-systemd/sphinx 2015-09-09 23:10:34 +02:00
Lennart Poettering 6796073e33 tree-wide: make use of the fact that strv_free() returns NULL
Another Coccinelle patch.
2015-09-09 23:05:58 +02:00
Lennart Poettering 1d1423257a Makefile: fix gardel target 2015-09-09 23:05:46 +02:00
Lennart Poettering c6312fb3cf Merge pull request #1220 from zonque/logind-dry-run
logind: make dry run command line arguments work again (v2)
2015-09-09 18:39:01 +02:00
Daniel Mack 7681f5b889 systemctl: add dry-run support for scheduled shutdowns
Prefix the action parameter with "dry-" in case the --dry-run command
line switch was passed.
2015-09-09 17:52:12 +02:00
Daniel Mack 1389f4b958 logind: allow dry run variants for scheduled shutdowns
Allow passing a "dry-" prefix to the action parameter passed to
.ScheduleShutdown(). When strings with this prefix are passed,
the scheduled action will not take place. Instead, an info message
is logged.
2015-09-09 17:52:11 +02:00
Lennart Poettering c36d25218b Merge pull request #1213 from evverx/systemd-notify-log
notify: log error when sd_pid_notify() == 0
2015-09-09 15:54:41 +02:00
Daniel Mack 01da201420 Merge pull request #1218 from poettering/safe-fclose
util: introduce safe_fclose() and port everything over to it
2015-09-09 15:45:03 +02:00
Daniel Mack 37b76fd3ee README: document new /etc/mtab requirement 2015-09-09 15:27:56 +02:00
Lennart Poettering 74ca738f6a util: introduce safe_fclose() and port everything over to it
Adds a coccinelle script to port things over automatically.
2015-09-09 15:26:11 +02:00
Lennart Poettering d58e8bc973 Merge pull request #1217 from zonque/free-and-replace
locale: kill free_and_replace()
2015-09-09 15:25:15 +02:00
Daniel Mack 87699fe313 locale: kill free_and_replace()
That function really makes little sense, as the open-coded variant
is much more readable. Also, if the 2nd argument is NULL, mfree()
is a much better candidate.

Convert the only users of this function in localed, and then remove it
entirely.
2015-09-09 15:15:14 +02:00
Daniel Mack d7acddde05 Merge pull request #1216 from poettering/coccinelle-fixes-2
Coccinelle fixes 2
2015-09-09 15:12:28 +02:00
Lennart Poettering 57255510c9 tree-wide: replace while(1) by for(;;) everywhere
Another Coccinelle script.
2015-09-09 14:59:53 +02:00
Lennart Poettering 1f6b411372 tree-wide: update empty-if coccinelle script to cover empty-while and more
Let's also clean up single-line while and for blocks.
2015-09-09 14:59:51 +02:00
Lennart Poettering 94c156cd45 tree-wide: make use of log_error_errno() return value in more cases
The previous coccinelle semantic patch that improved usage of
log_error_errno()'s return value, only looked for log_error_errno()
invocations with a single parameter after the error parameter. Update
the patch to handle arbitrary numbers of additional arguments.
2015-09-09 14:58:26 +02:00
David Herrmann 02736a9abc sd-bus: drop weird empty lines
We should never put empty lines between `if` and `else if`, unless we use
braces.
2015-09-09 14:57:41 +02:00
Lennart Poettering 5bdb84b393 Merge pull request #1215 from maciejaszek/fds_pass_fixes
sd_pid_notify_with_fds: fix computing msg_controllen
2015-09-09 14:44:52 +02:00
Lennart Poettering 0f9415d44c Merge pull request #1214 from zonque/mtab
core: freeze execution if /etc/mtab exists
2015-09-09 14:43:42 +02:00
Maciej Wereski a5bd3c32ab sd_pid_notify_with_fds: fix computing msg_controllen
CMSG_SPACE(0) may return value other than 0. This caused sendmsg to fail
with EINVAL, when have_pid or n_fds was 0.
2015-09-09 14:28:43 +02:00
Lennart Poettering 542a69a284 Merge pull request #1212 from again4you/devel/fix_smack_label_#3
Wrong smack label of the symlink in CGROUP root directory when enabling '--with-smack-run-label' (v3)
2015-09-09 14:01:26 +02:00
Daniel Mack bcce71873b core: freeze execution if /etc/mtab exists
The mount monitor that was added to libmount v2.27 requires /etc/mtab to be
non-existant. As systemd now uses that functionality, we cannot monitor any
mounts anymore, and hence not support .mount units.

Systems that have /etc/mtab around as regular file are unsupported by
systemd since a long time.

This patch makes that condition fatal, so we do not boot up with
non-working mount monitor support.
2015-09-09 14:00:23 +02:00
Evgeny Vereshchagin 39b50ad105 notify: log error when sd_pid_notify() == 0 2015-09-09 14:55:13 +03:00
Sangjung Woo f8c1a81c51 smack: bugfix the smack label of symlink when '--with-smack-run-label' is set
Even though systemd has its own smack label since
'--with-smack-run-label' configuration is set, the smack label of each
CGROUP root directory should have the star (i.e. *) label. This is
mainly because current Linux Kernel set the label in this way.
(Refer to smack_d_instantiate() in security/smack/smack_lsm.c)

However, if systemd has its own smack label and arg_join_controllers is
explicitly set or initialized by initialize_join_controllers() function,
current systemd creates the symlink in CGROUP root directory with its
own smack label as below.

lrwxrwxrwx. 1 root root System  11 Dec 31 16:00 cpu -> cpu,cpuacct
dr-xr-xr-x. 4 root root *        0 Dec 31 16:01 cpu,cpuacct
lrwxrwxrwx. 1 root root System  11 Dec 31 16:00 cpuacct -> cpu,cpuacct

This patch fixes that bug by copying the smack label from the origin.
2015-09-09 20:26:52 +09:00
Sangjung Woo ba056b738d smack: introduce new mac_smack_copy() function
This adds a new mac_smack_copy() function in order to read the smack
label from the source and apply it to the destination.
2015-09-09 20:26:46 +09:00
Daniel Mack 9c00a6adfa importd: fix typos 2015-09-09 10:10:23 +02:00
Daniel Mack 94766ad2ba Merge pull request #1210 from poettering/import-fixes
cgroup fix, nspawn fix, plus change to download .nspawn files in importd
2015-09-09 10:08:44 +02:00
Daniel Mack 0fa7d1f5be Merge pull request #1207 from poettering/coccinelle-fixes
Coccinelle fixes
2015-09-09 09:57:29 +02:00
Lennart Poettering 38c2ef1d55 nspawn: add missing comma to gperf file 2015-09-09 08:36:20 +02:00
Lennart Poettering bed2c013b6 Merge pull request #1180 from evverx/dot-from-to-alias-handling
analyze: add alias handling for --{from,to}-pattern options of the dot command
2015-09-09 08:31:11 +02:00
Lennart Poettering ece174c543 tree-wide: drop {} from one-line if blocks
Patch via coccinelle.
2015-09-09 08:20:20 +02:00
Lennart Poettering 76ef789d26 tree-wide: make use of log_error_errno() return value
Turns this:

        r = -errno;
        log_error_errno(errno, "foo");

into this:

        r = log_error_errno(errno, "foo");

and this:

        r = log_error_errno(errno, "foo");
        return r;

into this:

        return log_error_errno(errno, "foo");
2015-09-09 08:20:20 +02:00
Lennart Poettering 3cc2aff1ab tree-wide: don't do assignments within if checks
Turn this:

       if ((r = foo()) < 0) { ...

into this:

       r = foo();
       if (r < 0) { ...
2015-09-09 08:20:20 +02:00
Lennart Poettering 7f6e12b033 tree-wide: drop redundant if checks before safe_close()
Replace this:

        if (fd >= 0)
                safe_close(fd);

by this:

        safe_close(fd);
2015-09-09 08:20:19 +02:00
Lennart Poettering 66e405837b tree-wide: make more code use safe_close()
Replace this:

        close(fd);
        fd = -1;

write this:

        fd = safe_close(fd);
2015-09-09 08:20:19 +02:00
Lennart Poettering a1e58e8ee1 tree-wide: use coccinelle to patch a lot of code to use mfree()
This replaces this:

        free(p);
        p = NULL;

by this:

        p = mfree(p);

Change generated using coccinelle. Semantic patch is added to the
sources.
2015-09-09 08:19:27 +02:00
Lennart Poettering 7aa5f9b61b Merge pull request #1206 from davidmilburn/ata-by-path
udev: build by-path identifiers for ATA devices.
2015-09-09 08:05:53 +02:00
David Milburn ba86822db7 udev: build by-path identifiers for ATA devices.
/dev/disk/by-path

total 0
lrwxrwxrwx. 1 root root  9 Sep  4 10:02 pci-0000:00:1f.2-ata-2 -> ../../sr0
lrwxrwxrwx. 1 root root  9 Sep  4 10:02 pci-0000:00:1f.2-ata-3 -> ../../sdd
lrwxrwxrwx. 1 root root 10 Sep  4 10:02 pci-0000:00:1f.2-ata-3-part1 -> ../../sdd1
lrwxrwxrwx. 1 root root 10 Sep  4 10:02 pci-0000:00:1f.2-ata-3-part2 -> ../../sdd2
lrwxrwxrwx. 1 root root 10 Sep  4 10:02 pci-0000:00:1f.2-ata-3-part3 -> ../../sdd3
lrwxrwxrwx. 1 root root  9 Sep  4 10:02 pci-0000:03:00.0-ata-4 -> ../../sda
lrwxrwxrwx. 1 root root 10 Sep  4 10:02 pci-0000:03:00.0-ata-4-part1 -> ../../sda1
lrwxrwxrwx. 1 root root 10 Sep  4 10:02 pci-0000:03:00.0-ata-4-part2 -> ../../sda2
lrwxrwxrwx. 1 root root  9 Sep  4 10:02 pci-0000:08:00.0-ata-1 -> ../../sdc
lrwxrwxrwx. 1 root root 10 Sep  4 10:02 pci-0000:08:00.0-ata-1-part1 -> ../../sdc1
lrwxrwxrwx. 1 root root 10 Sep  4 10:02 pci-0000:08:00.0-ata-1-part2 -> ../../sdc2
2015-09-08 16:41:49 -05:00