Systemd/src/basic
Tejun Heo 415fc41cea core: simplify cg_[all_]unified()
cg_[all_]unified() test whether a specific controller or all controllers are on
the unified hierarchy.  While what's being asked is a simple binary question,
the callers must assume that the functions may fail any time, which
unnecessarily complicates their usages.  This complication is unnecessary.
Internally, the test result is cached anyway and there are only a few places
where the test actually needs to be performed.

This patch simplifies cg_[all_]unified().

* cg_[all_]unified() are updated to return bool.  If the result can't be
  decided, assertion failure is triggered.  Error handlings from their callers
  are dropped.

* cg_unified_flush() is updated to calculate the new result synchrnously and
  return whether it succeeded or not.  Places which need to flush the test
  result are updated to test for failure.  This ensures that all the following
  cg_[all_]unified() tests succeed.

* Places which expected possible cg_[all_]unified() failures are updated to
  call and test cg_unified_flush() before calling cg_[all_]unified().  This
  includes functions used while setting up mounts during boot and
  manager_setup_cgroup().
2017-02-18 17:51:13 -05:00
..
.gitignore build-sys: split internal basic/ library from shared/ 2015-06-11 10:52:46 +02:00
Makefile build-sys: split internal basic/ library from shared/ 2015-06-11 10:52:46 +02:00
MurmurHash2.c MurmurHash: all /* fall through */ comments 2017-01-31 19:35:04 -05:00
MurmurHash2.h build-sys: split internal basic/ library from shared/ 2015-06-11 10:52:46 +02:00
af-list.c build-sys: add check for gperf lookup function signature (#5055) 2017-01-10 08:39:05 +01:00
af-list.h Use provided buffer in dns_resource_key_to_string 2016-02-16 19:55:51 -05:00
alloc-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
alloc-util.h tree-wide: introduce free_and_replace helper 2016-10-16 23:35:39 -04:00
architecture.c basic/architecture: adjust Risc-V ifdef (#5304) 2017-02-10 23:48:22 +01:00
architecture.h basic/architecture: adjust Risc-V ifdef (#5304) 2017-02-10 23:48:22 +01:00
arphrd-list.c build-sys: add check for gperf lookup function signature (#5055) 2017-01-10 08:39:05 +01:00
arphrd-list.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
async.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
async.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
audit-util.c audit: disable if cannot create NETLINK_AUDIT socket 2016-10-06 11:49:00 +02:00
audit-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
barrier.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
barrier.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
bitmap.c tree-wide: use mfree more 2016-10-16 23:35:39 -04:00
bitmap.h resolved: when using the ResolveRecord() bus call, adjust TTL for caching time 2016-06-21 13:20:48 +02:00
blkid-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
btrfs-ctree.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
btrfs-util.c copy: change the various copy_xyz() calls to take a unified flags parameter 2017-02-17 10:22:28 +01:00
btrfs-util.h nspawn: add fallback top normal copy/reflink when we cannot btrfs snapshot 2016-11-22 13:35:09 +01:00
build.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
bus-label.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
bus-label.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
calendarspec.c calendarspec: fix duplicate detection (#5310) 2017-02-12 00:39:17 -05:00
calendarspec.h calendarspec: rename fields of CalendarComponent 2016-12-16 19:45:06 -05:00
cap-list.c build-sys: add check for gperf lookup function signature (#5055) 2017-01-10 08:39:05 +01:00
cap-list.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
capability-util.c user-util: rework maybe_setgroups() a bit 2016-10-06 19:04:10 +02:00
capability-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
cgroup-util.c core: simplify cg_[all_]unified() 2017-02-18 17:51:13 -05:00
cgroup-util.h core: simplify cg_[all_]unified() 2017-02-18 17:51:13 -05:00
chattr-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
chattr-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
clock-util.c clock-util: be more tolerant in parsing /etc/adjtime 2016-02-26 12:33:41 +01:00
clock-util.h clock-util: make clock_is_localtime() testable and add initial tests 2016-02-26 11:28:49 +01:00
conf-files.c basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix 2017-02-07 21:06:38 -05:00
conf-files.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
copy.c machined: when copying files from/to userns containers chown to root 2017-02-17 10:22:28 +01:00
copy.h machined: when copying files from/to userns containers chown to root 2017-02-17 10:22:28 +01:00
cpu-set-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
cpu-set-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
def.h tree-wide: rename config_parse_many to …_nulstr 2016-09-16 10:32:03 -04:00
device-nodes.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
device-nodes.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
dirent-util.c basic/dirent-util: allow suffix to be omitted for dirent_is_file_with_suffix 2017-02-07 21:06:38 -05:00
dirent-util.h tree-wide: rename hidden_file to hidden_or_backup_file and optimize 2016-04-28 08:25:17 -04:00
env-util.c basic/env-uil: fix assertion failure in strv_env_replace (#4688) 2016-11-17 22:25:01 +01:00
env-util.h core/load-fragment: modify existing environment instead of copying strv over and over 2016-11-05 18:54:27 -04:00
errno-list.c build-sys: add check for gperf lookup function signature (#5055) 2017-01-10 08:39:05 +01:00
errno-list.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
escape.c tree-wide: remove consecutive duplicate words in comments 2016-10-04 17:06:25 +02:00
escape.h Merge pull request #2589 from keszybz/resolve-tool-2 2016-02-13 11:15:41 +01:00
ether-addr-util.c util-lib: add ether_addr_from_string() 2016-05-17 16:55:20 -04:00
ether-addr-util.h util-lib: add ether_addr_from_string() 2016-05-17 16:55:20 -04:00
exit-status.c core: run each system service with a fresh session keyring 2016-12-13 20:59:10 +01:00
exit-status.h core: run each system service with a fresh session keyring 2016-12-13 20:59:10 +01:00
extract-word.c basic/extract-word,man: clarify "correction" of invalid escapes 2016-12-11 00:21:36 -05:00
extract-word.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
fd-util.c tree-wide: replace all readdir cycles with FOREACH_DIRENT{,_ALL} (#4853) 2016-12-09 10:04:30 +01:00
fd-util.h basic/fd-util: introduce stdio_unset_cloexec() function 2016-07-02 23:38:47 +06:00
fileio-label.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
fileio-label.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
fileio.c util-lib: add easy helpers for temporary directories that rmdir()ed via _cleanup_ 2016-12-07 18:38:41 +01:00
fileio.h util-lib: add easy helpers for temporary directories that rmdir()ed via _cleanup_ 2016-12-07 18:38:41 +01:00
format-util.h Rename formats-util.h to format-util.h 2016-11-07 10:15:08 -05:00
fs-util.c util-lib: Fix chase_symlinks() with absolute symlinks (#5185) 2017-01-31 16:21:15 +03:00
fs-util.h util-lib: add easy helpers for temporary directories that rmdir()ed via _cleanup_ 2016-12-07 18:38:41 +01:00
glob-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
glob-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
gunicode.c basic: use for() loop instead of while() 2016-10-12 22:48:41 +02:00
gunicode.h tree-wide: place #pragma once at the same place everywhere 2016-02-20 22:42:29 +01:00
hash-funcs.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
hash-funcs.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
hashmap.c set: add new set_put_strsplit() call 2016-06-21 13:20:48 +02:00
hashmap.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
hexdecoct.c hexdecoct: use typesafe new() instead of malloc() 2017-02-02 00:10:44 +01:00
hexdecoct.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
hostname-util.c hostname-util: default to the compile time default hostname in gethostname_malloc() 2017-02-17 10:19:26 +01:00
hostname-util.h networkd: add basic LLDP transmission support 2016-02-21 20:58:59 +01:00
in-addr-util.c basic: make sure in_addr_from_string() can take NULL arguments 2016-11-21 22:47:47 +01:00
in-addr-util.h basic: add explicit ipv4-specific in_addr classification calls 2016-11-21 22:47:47 +01:00
io-util.c core: rework how we flush incoming traffic when a socket unit goes down 2016-05-06 13:29:26 +02:00
io-util.h tree-wide: minor formatting inconsistency cleanups 2016-02-23 14:20:34 -08:00
ioprio.h tree-wide: sort includes in *.h 2015-11-18 23:09:02 +01:00
journal-importer.c Move export format parsing from src/journal-remote/ to src/basic/ 2017-02-14 23:56:48 -05:00
journal-importer.h Move export format parsing from src/journal-remote/ to src/basic/ 2017-02-14 23:56:48 -05:00
khash.c basic: check strdup result in khash_dup (#5176) 2017-01-31 08:27:14 +01:00
khash.h core: add "khash" API to src/basic/ (as wrapper around kernel AF_ALG) 2016-11-29 15:13:00 +01:00
label.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
label.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
list.h list: LIST_INSERT_BEFORE: update head if necessary (#4261) 2016-10-04 16:15:37 +02:00
locale-util.c locale-util: mark special_glyph() as _const_ 2016-05-09 15:17:57 -04:00
locale-util.h locale-util: mark special_glyph() as _const_ 2016-05-09 15:17:57 -04:00
lockfile-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
lockfile-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
log.c tree-wide: add SD_ID128_MAKE_STR, remove LOG_MESSAGE_ID 2017-02-15 00:45:12 -05:00
log.h tree-wide: add SD_ID128_MAKE_STR, remove LOG_MESSAGE_ID 2017-02-15 00:45:12 -05:00
login-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
login-util.h tree-wide: place #pragma once at the same place everywhere 2016-02-20 22:42:29 +01:00
macro.h networkd: add support to configure VLAN on bridge ports 2016-06-10 09:10:41 +02:00
memfd-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
memfd-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
mempool.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
mempool.h tree-wide: make more global variables static 2016-02-13 12:28:28 +01:00
missing.h missing.h: add AF_VSOCK bits 2017-01-10 15:27:00 +00:00
missing_syscall.h missing: add renameat2() definition for 64bit arm (#5378) 2017-02-17 13:10:09 -05:00
mkdir-label.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
mkdir.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
mkdir.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
mount-util.c util-lib: make verbose_mount() grok MS_MOVE 2016-12-20 20:00:09 +01:00
mount-util.h Modify mount_propagation_flags_from_string to return a normal int code 2016-12-17 13:57:04 -05:00
nss-util.h nss-util: silence warning about deprecated RES_USE_INET6 2017-01-31 19:55:33 -05:00
ordered-set.c networkd: use an OrderedSet instead of Set to collect link domains 2016-01-26 14:42:03 +01:00
ordered-set.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
parse-util.c core: introduce parse_ip_port (#4825) 2016-12-06 12:21:45 +01:00
parse-util.h core: introduce parse_ip_port (#4825) 2016-12-06 12:21:45 +01:00
path-util.c fs-util: unify code we use to check if dirent's d_name is "." or ".." 2017-02-02 00:06:18 +01:00
path-util.h fs-util: unify code we use to check if dirent's d_name is "." or ".." 2017-02-02 00:06:18 +01:00
prioq.c tree-wide: use mfree more 2016-10-16 23:35:39 -04:00
prioq.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
proc-cmdline.c tree-wide: remove consecutive duplicate words in comments (#5148) 2017-01-24 21:45:30 -05:00
proc-cmdline.h util-lib: various improvements to kernel command line parsing 2016-12-21 19:09:08 +01:00
process-util.c process-util: rename char *r to ans and add comment 2017-01-15 12:41:34 -05:00
process-util.h util-lib: rework rename_process() to be able to make use of PR_SET_MM_ARG_START 2016-12-14 18:29:30 +01:00
random-util.c Fixed a small typo in a comment (#3514) 2016-06-12 16:42:13 +02:00
random-util.h basic: include only what we use 2015-11-30 21:51:03 +01:00
ratelimit.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
ratelimit.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
raw-clone.h seccomp: on s390 the clone() parameters are reversed 2017-02-08 22:21:27 +01:00
refcnt.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
replace-var.c tree-wide: use mfree more 2016-10-16 23:35:39 -04:00
replace-var.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
rlimit-util.c Rename formats-util.h to format-util.h 2016-11-07 10:15:08 -05:00
rlimit-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
rm-rf.c fs-util: unify code we use to check if dirent's d_name is "." or ".." 2017-02-02 00:06:18 +01:00
rm-rf.h util-lib: drop unnecessary NULL check 2016-12-07 18:38:41 +01:00
securebits.h build-sys: split internal basic/ library from shared/ 2015-06-11 10:52:46 +02:00
selinux-util.c tree-wide: get rid of selinux_context_t (#3732) 2016-07-15 18:44:02 +02:00
selinux-util.h selinux: always try to load the full selinux db 2016-03-01 20:39:30 -05:00
set.h basic/set: remove some spurious spaces 2016-08-04 23:53:07 -04:00
sigbus.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
sigbus.h tree-wide: place #pragma once at the same place everywhere 2016-02-20 22:42:29 +01:00
signal-util.c tree-wide: add new SIGNAL_VALID() macro-like function that validates signal numbers 2016-04-12 13:43:32 +02:00
signal-util.h tree-wide: add new SIGNAL_VALID() macro-like function that validates signal numbers 2016-04-12 13:43:32 +02:00
siphash24.c tree-wide: adjust fall through comments so that gcc is happy 2017-01-31 14:04:55 -05:00
siphash24.h shared: make sure foo.bar and foobar result in different domain name hashes 2016-01-11 19:39:59 +01:00
smack-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
smack-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
socket-label.c socket_address_listen: do not rely on errno (2) 2016-03-10 09:24:08 -05:00
socket-util.c fs-util: unify code we use to check if dirent's d_name is "." or ".." 2017-02-02 00:06:18 +01:00
socket-util.h socket-util: drop _pure_ from a function with an output parameter 2017-01-11 16:37:34 -05:00
sparse-endian.h sparse: avoid clash with __bitwise and __force from 4.10 linux/types.h (#5061) 2017-01-11 10:50:25 +01:00
special.h core: implicitly order units with PrivateTmp= after systemd-tmpfiles-setup.service 2016-12-27 23:25:24 +01:00
stat-util.c util-lib: rework path_check_fstype() and path_is_temporary_fs() to use O_PATH 2016-12-21 19:09:32 +01:00
stat-util.h util-lib: add new path_is_temporary_fs() API 2016-12-20 20:00:09 +01:00
stdio-util.h tree-wide: minor formatting inconsistency cleanups 2016-02-23 14:20:34 -08:00
strbuf.c tree-wide: use mfree more 2016-10-16 23:35:39 -04:00
strbuf.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
string-table.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
string-table.h string-table: make sure DEFINE_STRING_TABLE_LOOKUP_WITH_BOOLEAN() handles NULL strings nicely 2016-06-21 13:20:47 +02:00
string-util.c treewide: replace homegrown memory_erase with explicit_bzero 2017-02-05 21:07:55 -05:00
string-util.h treewide: replace homegrown memory_erase with explicit_bzero 2017-02-05 21:07:55 -05:00
strv.c tree-wide: use mfree more 2016-10-16 23:35:39 -04:00
strv.h strv: fix STRV_FOREACH_BACKWARDS() to be a single statement only 2016-10-07 20:14:38 +02:00
strxcpyx.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
strxcpyx.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
syslog-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
syslog-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
terminal-util.c core: reprint the question every 2 sec in ask_char() 2016-11-17 18:16:49 +01:00
terminal-util.h terminal-util: helper macro for highlighting functions 2016-10-17 11:48:12 -04:00
time-util.c time-util: Fix overflow check introduce in commit f977849 (#5216) 2017-02-03 16:13:55 +01:00
time-util.h time-util: refuse formatting/parsing times that we can't store 2017-02-02 20:12:31 +01:00
umask-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
unaligned.h util-lib: add accessors for unaligned native endian words 2016-06-06 19:59:09 +02:00
unit-name.c tree-wide: drop NULL sentinel from strjoin 2016-10-23 11:43:27 -04:00
unit-name.h unit-name: remove spurious newline 2016-06-13 18:47:42 +02:00
user-util.c util-lib: add a comment explaining the user name rules we enforce 2016-12-27 18:09:58 +01:00
user-util.h core: do not fail in a container if we can't use setgroups 2016-10-06 11:49:00 +02:00
utf8.c tree-wide: make ++/-- usage consistent WRT spacing 2016-02-22 20:32:04 -08:00
utf8.h Ignore BOM in config files 2016-03-22 18:51:59 -04:00
util.c Merge pull request #4771 from keszybz/udev-property-ordering 2016-12-12 16:03:52 +01:00
util.h Rename formats-util.h to format-util.h 2016-11-07 10:15:08 -05:00
verbs.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
verbs.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
virt.c virt: Update cache if the detected vm is virtualbox (#5364) 2017-02-17 08:45:30 +01:00
virt.h detect-virt: add --private-users switch to check if a userns is active 2016-10-26 20:12:51 -04:00
web-util.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
web-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
xattr-util.c tree-wide: no need to pass excess flags to open()/openat() if O_PATH is passed 2016-03-02 00:42:49 +06:00
xattr-util.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
xml.c tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
xml.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00