diff options
-rw-r--r-- | meson.build | 1 | ||||
-rw-r--r-- | src/basic/capability-util.c | 1 | ||||
-rw-r--r-- | src/basic/cgroup-util.c | 1 | ||||
-rw-r--r-- | src/basic/log.c | 1 | ||||
-rw-r--r-- | src/basic/macro.h | 14 | ||||
-rw-r--r-- | src/basic/memory-util.c | 1 | ||||
-rw-r--r-- | src/basic/missing_threads.h | 15 | ||||
-rw-r--r-- | src/basic/process-util.c | 1 | ||||
-rw-r--r-- | src/basic/psi-util.c | 1 | ||||
-rw-r--r-- | src/basic/random-util.c | 1 | ||||
-rw-r--r-- | src/basic/signal-util.c | 1 | ||||
-rw-r--r-- | src/basic/time-util.c | 1 | ||||
-rw-r--r-- | src/basic/virt.c | 1 | ||||
-rw-r--r-- | src/libsystemd/sd-bus/sd-bus.c | 1 | ||||
-rw-r--r-- | src/libsystemd/sd-event/sd-event.c | 1 | ||||
-rw-r--r-- | src/libsystemd/sd-id128/sd-id128.c | 1 | ||||
-rw-r--r-- | src/libsystemd/sd-resolve/sd-resolve.c | 1 | ||||
-rw-r--r-- | src/login/logind-inhibit.c | 1 | ||||
-rw-r--r-- | src/network/networkd-route-util.c | 1 | ||||
-rw-r--r-- | src/nss-systemd/nss-systemd.c | 1 | ||||
-rw-r--r-- | src/shared/cgroup-setup.c | 1 | ||||
-rw-r--r-- | src/shared/uid-alloc-range.c | 1 |
22 files changed, 35 insertions, 14 deletions
diff --git a/meson.build b/meson.build index 5e7cb92a83..a274de5601 100644 --- a/meson.build +++ b/meson.build @@ -756,6 +756,7 @@ foreach header : ['crypt.h', 'linux/memfd.h', 'linux/vm_sockets.h', 'sys/auxv.h', + 'threads.h', 'valgrind/memcheck.h', 'valgrind/valgrind.h', 'linux/time_types.h', diff --git a/src/basic/capability-util.c b/src/basic/capability-util.c index 87fb2203f0..1698ea02cc 100644 --- a/src/basic/capability-util.c +++ b/src/basic/capability-util.c @@ -14,6 +14,7 @@ #include "logarithm.h" #include "macro.h" #include "missing_prctl.h" +#include "missing_threads.h" #include "parse-util.h" #include "user-util.h" diff --git a/src/basic/cgroup-util.c b/src/basic/cgroup-util.c index feda596939..90877c9fa1 100644 --- a/src/basic/cgroup-util.c +++ b/src/basic/cgroup-util.c @@ -23,6 +23,7 @@ #include "login-util.h" #include "macro.h" #include "missing_magic.h" +#include "missing_threads.h" #include "mkdir.h" #include "parse-util.h" #include "path-util.h" diff --git a/src/basic/log.c b/src/basic/log.c index 6a43731012..40602d5dda 100644 --- a/src/basic/log.c +++ b/src/basic/log.c @@ -25,6 +25,7 @@ #include "log.h" #include "macro.h" #include "missing_syscall.h" +#include "missing_threads.h" #include "parse-util.h" #include "proc-cmdline.h" #include "process-util.h" diff --git a/src/basic/macro.h b/src/basic/macro.h index ddf3032fbc..2425d27819 100644 --- a/src/basic/macro.h +++ b/src/basic/macro.h @@ -297,20 +297,6 @@ static inline int __coverity_check_and_return__(int condition) { p != (typeof(p)) POINTER_MAX; \ p = *(++_l)) -/* Define C11 thread_local attribute even on older gcc compiler - * version */ -#ifndef thread_local -/* - * Don't break on glibc < 2.16 that doesn't define __STDC_NO_THREADS__ - * see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769 - */ -#if __STDC_VERSION__ >= 201112L && !(defined(__STDC_NO_THREADS__) || (defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 16)) -#define thread_local _Thread_local -#else -#define thread_local __thread -#endif -#endif - #define DEFINE_TRIVIAL_DESTRUCTOR(name, type, func) \ static inline void name(type *p) { \ func(p); \ diff --git a/src/basic/memory-util.c b/src/basic/memory-util.c index c4f54c7b4e..fcedae2d41 100644 --- a/src/basic/memory-util.c +++ b/src/basic/memory-util.c @@ -3,6 +3,7 @@ #include <unistd.h> #include "memory-util.h" +#include "missing_threads.h" size_t page_size(void) { static thread_local size_t pgsz = 0; diff --git a/src/basic/missing_threads.h b/src/basic/missing_threads.h new file mode 100644 index 0000000000..fb3b72249b --- /dev/null +++ b/src/basic/missing_threads.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +#pragma once + +/* If threads.h doesn't exist, then define our own thread_local to match C11's thread_local. */ +#if HAVE_THREADS_H +# include <threads.h> +#elif !(defined(thread_local)) +/* Don't break on glibc < 2.16 that doesn't define __STDC_NO_THREADS__ + * see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53769 */ +# if __STDC_VERSION__ >= 201112L && !(defined(__STDC_NO_THREADS__) || (defined(__GNU_LIBRARY__) && __GLIBC__ == 2 && __GLIBC_MINOR__ < 16)) +# define thread_local _Thread_local +# else +# define thread_local __thread +# endif +#endif diff --git a/src/basic/process-util.c b/src/basic/process-util.c index 919387f958..5d499a57b4 100644 --- a/src/basic/process-util.c +++ b/src/basic/process-util.c @@ -36,6 +36,7 @@ #include "memory-util.h" #include "missing_sched.h" #include "missing_syscall.h" +#include "missing_threads.h" #include "mountpoint-util.h" #include "namespace-util.h" #include "nulstr-util.h" diff --git a/src/basic/psi-util.c b/src/basic/psi-util.c index a3b553cb44..af8e278bd0 100644 --- a/src/basic/psi-util.c +++ b/src/basic/psi-util.c @@ -8,6 +8,7 @@ #include "extract-word.h" #include "fd-util.h" #include "fileio.h" +#include "missing_threads.h" #include "parse-util.h" #include "psi-util.h" #include "string-util.h" diff --git a/src/basic/random-util.c b/src/basic/random-util.c index 28ace92f19..98bcc7444c 100644 --- a/src/basic/random-util.c +++ b/src/basic/random-util.c @@ -24,6 +24,7 @@ #include "io-util.h" #include "missing_random.h" #include "missing_syscall.h" +#include "missing_threads.h" #include "parse-util.h" #include "random-util.h" #include "sha256.h" diff --git a/src/basic/signal-util.c b/src/basic/signal-util.c index 7875ca69bb..5d9484626d 100644 --- a/src/basic/signal-util.c +++ b/src/basic/signal-util.c @@ -6,6 +6,7 @@ #include "errno-util.h" #include "macro.h" #include "missing_syscall.h" +#include "missing_threads.h" #include "parse-util.h" #include "signal-util.h" #include "stdio-util.h" diff --git a/src/basic/time-util.c b/src/basic/time-util.c index 26fd1bae65..e2c0d7ea9e 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -17,6 +17,7 @@ #include "io-util.h" #include "log.h" #include "macro.h" +#include "missing_threads.h" #include "missing_timerfd.h" #include "parse-util.h" #include "path-util.h" diff --git a/src/basic/virt.c b/src/basic/virt.c index ca3edaf3b5..f264cc6eb3 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -16,6 +16,7 @@ #include "fd-util.h" #include "fileio.h" #include "macro.h" +#include "missing_threads.h" #include "process-util.h" #include "stat-util.h" #include "string-table.h" diff --git a/src/libsystemd/sd-bus/sd-bus.c b/src/libsystemd/sd-bus/sd-bus.c index 93d2a83bb0..5590cecfd9 100644 --- a/src/libsystemd/sd-bus/sd-bus.c +++ b/src/libsystemd/sd-bus/sd-bus.c @@ -37,6 +37,7 @@ #include "macro.h" #include "memory-util.h" #include "missing_syscall.h" +#include "missing_threads.h" #include "parse-util.h" #include "path-util.h" #include "process-util.h" diff --git a/src/libsystemd/sd-event/sd-event.c b/src/libsystemd/sd-event/sd-event.c index 2c0895dc74..413ac16aa2 100644 --- a/src/libsystemd/sd-event/sd-event.c +++ b/src/libsystemd/sd-event/sd-event.c @@ -24,6 +24,7 @@ #include "memory-util.h" #include "missing_magic.h" #include "missing_syscall.h" +#include "missing_threads.h" #include "path-util.h" #include "prioq.h" #include "process-util.h" diff --git a/src/libsystemd/sd-id128/sd-id128.c b/src/libsystemd/sd-id128/sd-id128.c index ec3a496dba..5ce36cf2fc 100644 --- a/src/libsystemd/sd-id128/sd-id128.c +++ b/src/libsystemd/sd-id128/sd-id128.c @@ -14,6 +14,7 @@ #include "io-util.h" #include "macro.h" #include "missing_syscall.h" +#include "missing_threads.h" #include "random-util.h" #include "stat-util.h" #include "user-util.h" diff --git a/src/libsystemd/sd-resolve/sd-resolve.c b/src/libsystemd/sd-resolve/sd-resolve.c index 48a92ac615..f1c7e0a2da 100644 --- a/src/libsystemd/sd-resolve/sd-resolve.c +++ b/src/libsystemd/sd-resolve/sd-resolve.c @@ -22,6 +22,7 @@ #include "list.h" #include "memory-util.h" #include "missing_syscall.h" +#include "missing_threads.h" #include "process-util.h" #include "resolve-private.h" #include "socket-util.h" diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c index 8735538d20..12cd854706 100644 --- a/src/login/logind-inhibit.c +++ b/src/login/logind-inhibit.c @@ -18,6 +18,7 @@ #include "io-util.h" #include "logind-dbus.h" #include "logind-inhibit.h" +#include "missing_threads.h" #include "mkdir-label.h" #include "parse-util.h" #include "path-util.h" diff --git a/src/network/networkd-route-util.c b/src/network/networkd-route-util.c index 84866d3f84..e497f05996 100644 --- a/src/network/networkd-route-util.c +++ b/src/network/networkd-route-util.c @@ -4,6 +4,7 @@ #include "alloc-util.h" #include "logarithm.h" +#include "missing_threads.h" #include "networkd-address.h" #include "networkd-link.h" #include "networkd-manager.h" diff --git a/src/nss-systemd/nss-systemd.c b/src/nss-systemd/nss-systemd.c index 75d749e736..1d6e25399f 100644 --- a/src/nss-systemd/nss-systemd.c +++ b/src/nss-systemd/nss-systemd.c @@ -9,6 +9,7 @@ #include "fd-util.h" #include "log.h" #include "macro.h" +#include "missing_threads.h" #include "nss-systemd.h" #include "nss-util.h" #include "pthread-util.h" diff --git a/src/shared/cgroup-setup.c b/src/shared/cgroup-setup.c index 2ea83f05d3..65be851014 100644 --- a/src/shared/cgroup-setup.c +++ b/src/shared/cgroup-setup.c @@ -8,6 +8,7 @@ #include "fd-util.h" #include "fileio.h" #include "fs-util.h" +#include "missing_threads.h" #include "mkdir.h" #include "parse-util.h" #include "path-util.h" diff --git a/src/shared/uid-alloc-range.c b/src/shared/uid-alloc-range.c index dcecdbe343..1953119422 100644 --- a/src/shared/uid-alloc-range.c +++ b/src/shared/uid-alloc-range.c @@ -3,6 +3,7 @@ #include "chase-symlinks.h" #include "fd-util.h" #include "fileio.h" +#include "missing_threads.h" #include "string-util.h" #include "uid-alloc-range.h" #include "user-util.h" |