]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/network/networkd-link.c
tree-wide: use __fsetlocking() instead of fxyz_unlocked()
authorLennart Poettering <lennart@poettering.net>
Mon, 11 Dec 2017 18:50:30 +0000 (19:50 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 14 Dec 2017 09:42:25 +0000 (10:42 +0100)
commit0d5366733428b657e1b5b7700b461e878e00b578
treee2bcdb9f85e01c79221a9f4797e11fae60166c48
parent966c04cf012f48686cf5359067a7b26c080f44ea
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 4b61c8751135c58be043d86b9fef4c8ec7aadf18.
26 files changed:
src/basic/calendarspec.c
src/basic/string-util.c
src/busctl/busctl.c
src/core/dbus-cgroup.c
src/core/dbus-execute.c
src/core/dbus-service.c
src/core/manager.c
src/core/smack-setup.c
src/coredump/coredump.c
src/coredump/stacktrace.c
src/cryptsetup/cryptsetup-generator.c
src/fstab-generator/fstab-generator.c
src/journal/journal-qrcode.c
src/libsystemd-network/sd-dhcp-lease.c
src/libsystemd/sd-bus/bus-introspect.c
src/libsystemd/sd-bus/bus-match.c
src/libsystemd/sd-bus/bus-objects.c
src/locale/keymap-util.c
src/login/logind-seat.c
src/login/logind-user.c
src/machine/machine.c
src/network/networkd-link.c
src/network/networkd-manager.c
src/resolve/resolved-link.c
src/resolve/resolved-manager.c
src/resolve/resolved-resolv-conf.c