Systemd/src/basic
Lennart Poettering 0d53667334 tree-wide: use __fsetlocking() instead of fxyz_unlocked()
Let's replace usage of fputc_unlocked() and friends by __fsetlocking(f,
FSETLOCKING_BYCALLER). This turns off locking for the entire FILE*,
instead of doing individual per-call decision whether to use normal
calls or _unlocked() calls.

This has various benefits:

1. It's easier to read and easier not to forget

2. It's more comprehensive, as fprintf() and friends are covered too
   (as these functions have no _unlocked() counterpart)

3. Philosophically, it's a bit more correct, because it's more a
   property of the file handle really whether we ever pass it on to another
   thread, not of the operations we then apply to it.

This patch reworks all pieces of codes that so far used fxyz_unlocked()
calls to use __fsetlocking() instead. It also reworks all places that
use open_memstream(), i.e. use stdio FILE* for string manipulations.

Note that this in some way a revert of 4b61c87511.
2017-12-14 10:42:25 +01:00
..
MurmurHash2.c tree-wide: adjust fall through comments so that gcc is happy 2017-11-20 13:06:25 -08:00
MurmurHash2.h build-sys: split internal basic/ library from shared/ 2015-06-11 10:52:46 +02:00
af-list.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
af-list.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
af-to-name.awk meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
alloc-util.c alloc-util: coding style fix 2017-11-28 20:21:15 +09:00
alloc-util.h alloc-util: coding style fix 2017-11-28 20:21:15 +09:00
architecture.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
architecture.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
arphrd-list.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
arphrd-list.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
arphrd-to-name.awk meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
async.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
async.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
audit-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
audit-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
barrier.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
barrier.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
bitmap.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
bitmap.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
blkid-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
bpf-program.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
bpf-program.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
btrfs-ctree.h tree-wide: remove Emacs lines from all files 2016-02-10 13:41:57 +01:00
btrfs-util.c Add a little helper to make /sys/dev/block/major:minor paths 2017-11-30 12:59:23 +01:00
btrfs-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
build.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
bus-label.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
bus-label.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
calendarspec.c tree-wide: use __fsetlocking() instead of fxyz_unlocked() 2017-12-14 10:42:25 +01:00
calendarspec.h analyze: add new "calendar" command 2017-11-20 10:57:41 +01:00
cap-list.c cap-list: check range of numeric value 2017-11-28 22:06:34 +09:00
cap-list.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
cap-to-name.awk meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
capability-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
capability-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
cgroup-util.c cgroup-util: merge cg_set_tasks_access() and cg-set_group_access() into one 2017-11-25 17:08:21 +01:00
cgroup-util.h cgroup-util: merge cg_set_tasks_access() and cg-set_group_access() into one 2017-11-25 17:08:21 +01:00
chattr-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
chattr-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
clock-util.c tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
clock-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
conf-files.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
conf-files.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
copy.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
copy.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
cpu-set-util.c cpu-set-util: internally merge two functions 2017-12-06 10:32:32 +09:00
cpu-set-util.h core: merge multiple CPUAffinity= settings 2017-12-06 10:32:42 +09:00
crypt-util.c util-lib: export cryptsetup logging glue function 2017-11-30 20:43:25 +01:00
crypt-util.h Define CRYPT_LUKS in crypt-util.h 2017-11-30 20:43:25 +01:00
def.h cgroup: move cgroup controller names def.h → cgroup-util.h 2017-11-21 11:54:08 +01:00
device-nodes.c tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
device-nodes.h Add a helper for /dev/block/major:minor paths 2017-11-30 12:59:23 +01:00
dirent-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
dirent-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
env-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
env-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
errno-list.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
errno-list.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
errno-to-name.awk meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
escape.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
escape.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
ether-addr-util.c tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
ether-addr-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
exec-util.c exec-util: initialize `new` before using it (#7471) 2017-11-26 12:46:56 +01:00
exec-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
exit-status.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
exit-status.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
extract-word.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
extract-word.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
fd-util.c tree-wide: use STRLEN() to allocate buffer of constant size 2017-12-13 11:12:19 +01:00
fd-util.h Merge pull request #7198 from poettering/stdin-stdout 2017-11-19 19:49:11 +01:00
fileio-label.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
fileio-label.h fileio: document why fileio-label.c and fileio.c are two different modules 2017-11-29 12:34:12 +01:00
fileio.c Merge pull request #7618 from tiagosh/sysctl_use_read_line 2017-12-14 13:58:53 +09:00
fileio.h sysctl: disable buffer while writing to /proc 2017-12-13 15:03:41 -02:00
format-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
fs-util.c fs-util: remove comment about non-existing function 2017-12-03 00:25:00 +09:00
fs-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
generate-af-list.sh meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
generate-arphrd-list.sh meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
generate-cap-list.sh meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
generate-errno-list.sh meson: also indent scripts with 8 spaces 2017-04-25 08:49:16 -04:00
generate-gperfs.py tree-wide: adjust fall through comments so that gcc is happy 2017-11-20 13:06:25 -08:00
glob-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
glob-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +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 Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
hash-funcs.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
hashmap.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
hashmap.h Add set/hashmap helpers for non-trivial freeing and use where straighforward 2017-11-28 21:30:30 +01:00
hexdecoct.c hexdecoct: fix comment typo (#7548) 2017-12-06 00:42:58 +09:00
hexdecoct.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
hostname-util.c networkd/dhcp: shorten overlong hostname (#7616) 2017-12-13 18:00:46 +01:00
hostname-util.h networkd/dhcp: shorten overlong hostname (#7616) 2017-12-13 18:00:46 +01:00
in-addr-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
in-addr-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
io-util.c sd-resolve: propagate timeouts in sd_resolve_wait() the same way as in sd_bus_wait(): ETIMEDOUT 2017-11-27 17:08:34 +01:00
io-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
ioprio.h tree-wide: sort includes in *.h 2015-11-18 23:09:02 +01:00
journal-importer.c tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
journal-importer.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
khash.c Replace free and return NULL with return mfree 2017-11-24 10:31:49 +00:00
khash.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
label.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
label.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
list.h udevd: use list.h instead of udev_list_node 2017-11-22 10:38:05 +01:00
locale-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
locale-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
lockfile-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
lockfile-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
log.c Replace use of snprintf with xsprintf 2017-11-24 10:36:04 +00:00
log.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
login-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
login-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
macro.h basic/macros: add STRLEN() to get length of string literal as constant expression 2017-12-13 11:12:07 +01:00
memfd-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
memfd-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
mempool.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
mempool.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
meson.build util-lib: export cryptsetup logging glue function 2017-11-30 20:43:25 +01:00
missing.h mount-util: do not use the official MAX_HANDLE_SZ (#7523) 2017-12-03 12:18:33 +01:00
missing_syscall.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
mkdir-label.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
mkdir.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
mkdir.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
module-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
mount-util.c mount-util: shorten the loop a bit (#7545) 2017-12-06 13:19:03 +09:00
mount-util.h nspawn: make sure images containing an ESP are compatible with userns -U mode 2017-12-05 13:49:12 +01:00
nss-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
ordered-set.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
ordered-set.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
parse-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
parse-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
path-util.c tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
path-util.h util-lib: use trailing slash in chase_symlinks, fd_is_mount_point, path_is_mount_point 2017-11-30 20:43:25 +01:00
prioq.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
prioq.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
proc-cmdline.c Merge pull request #7198 from poettering/stdin-stdout 2017-11-19 19:49:11 +01:00
proc-cmdline.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
process-util.c tree-wide: unify logging of "Must be root" message 2017-12-11 23:19:45 +01:00
process-util.h tree-wide: unify logging of "Must be root" message 2017-12-11 23:19:45 +01:00
random-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
random-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
ratelimit.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
ratelimit.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
raw-clone.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
refcnt.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
replace-var.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
replace-var.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
rlimit-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
rlimit-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
rm-rf.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
rm-rf.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
securebits-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
securebits-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
securebits.h build-sys: split internal basic/ library from shared/ 2015-06-11 10:52:46 +02:00
selinux-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
selinux-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
set.c *: fix some inconsistent control statement style 2017-12-01 16:49:52 -08:00
set.h Add set/hashmap helpers for non-trivial freeing and use where straighforward 2017-11-28 21:30:30 +01:00
sigbus.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
sigbus.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
signal-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
signal-util.h signal-util: use a slightly less likely to conflict variable name instead of 't' 2017-11-20 16:43:15 +01:00
siphash24.c tree-wide: adjust fall through comments so that gcc is happy 2017-11-20 13:06:25 -08: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 Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
smack-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
socket-label.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
socket-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
socket-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
sparse-endian.h Add SPDX license headers to various assorted files 2017-11-19 19:08:15 +01:00
special.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
stat-util.c util-lib: rename path_check_fstype to path_is_fs_type 2017-11-30 20:43:25 +01:00
stat-util.h util-lib: rename path_check_fstype to path_is_fs_type 2017-11-30 20:43:25 +01:00
stdio-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
strbuf.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
strbuf.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
string-table.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
string-table.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
string-util.c tree-wide: use __fsetlocking() instead of fxyz_unlocked() 2017-12-14 10:42:25 +01:00
string-util.h string-util: rework strextend() to optionally inset separators between each appended string 2017-12-05 13:49:12 +01:00
strv.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
strv.h strv: introduce strv_free_and_replace() 2017-11-20 16:43:15 +01:00
strxcpyx.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
strxcpyx.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
syslog-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
syslog-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
terminal-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
terminal-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
time-util.c tree-wide: drop a few == NULL and != NULL comparison 2017-12-11 16:05:40 +01:00
time-util.h util: add new helper in_utc_timezone() 2017-11-20 10:53:26 +01:00
umask-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
unaligned.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
unit-def.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
unit-def.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
unit-name.c Merge pull request #7198 from poettering/stdin-stdout 2017-11-19 19:49:11 +01:00
unit-name.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
user-util.c user-util: synthesize user records for "nobody" the same way as for "root" 2017-12-06 13:40:50 +01:00
user-util.h user-util: add UID_NOBODY defines that resolve to (uid_t) 65534 2017-12-06 13:40:50 +01:00
utf8.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
utf8.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
util.c Add a little helper to make /sys/dev/block/major:minor paths 2017-11-30 12:59:23 +01:00
util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
verbs.c verbs: add a new VERB_MUSTBEROOT flag 2017-12-11 23:19:46 +01:00
verbs.h verbs: add a new VERB_MUSTBEROOT flag 2017-12-11 23:19:46 +01:00
virt.c virt: use XENFEAT_dom0 to detect the hardware domain (#6442, #6662) (#7581) 2017-12-08 22:21:42 +01:00
virt.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
web-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
web-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
xattr-util.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
xattr-util.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
xml.c Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00
xml.h Add SPDX license identifiers to source files under the LGPL 2017-11-19 19:08:15 +01:00