diff options
Diffstat (limited to 'shared/systemd/sd-adapt-shared')
| -rw-r--r-- | shared/systemd/sd-adapt-shared/missing.h | 3 | ||||
| -rw-r--r-- | shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h | 19 |
2 files changed, 15 insertions, 7 deletions
diff --git a/shared/systemd/sd-adapt-shared/missing.h b/shared/systemd/sd-adapt-shared/missing.h index 637892c2..2ee34b6a 100644 --- a/shared/systemd/sd-adapt-shared/missing.h +++ b/shared/systemd/sd-adapt-shared/missing.h @@ -1,3 +1,6 @@ #pragma once /* dummy header */ + +#include "missing_fcntl.h" +#include "missing_type.h" diff --git a/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h b/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h index 905e45c0..06008ce8 100644 --- a/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h +++ b/shared/systemd/sd-adapt-shared/nm-sd-adapt-shared.h @@ -16,8 +16,8 @@ * Copyright (C) 2014 - 2018 Red Hat, Inc. */ -#ifndef __NM_SD_ADAPT_BASIC_H__ -#define __NM_SD_ADAPT_BASIC_H__ +#ifndef __NM_SD_ADAPT_SHARED_H__ +#define __NM_SD_ADAPT_SHARED_H__ #include "nm-default.h" @@ -27,11 +27,16 @@ /*****************************************************************************/ +/* strerror() is not thread-safe. Patch systemd-sources via a define. */ +#define strerror(errsv) nm_strerror_native (errsv) + +/*****************************************************************************/ + static inline NMLogLevel _slog_level_to_nm (int slevel) { - switch (LOG_PRI (slevel)) { - case LOG_DEBUG: return LOGL_DEBUG; + switch (LOG_PRI (slevel)) { + case LOG_DEBUG: return LOGL_DEBUG; case LOG_WARNING: return LOGL_WARN; case LOG_CRIT: case LOG_ERR: return LOGL_ERR; @@ -54,10 +59,10 @@ _nm_log_get_max_level_realm (void) const int _nm_e = (error); \ const NMLogLevel _nm_l = _slog_level_to_nm ((level)); \ \ - if (_nm_log_enabled (_nm_l, LOGD_SYSTEMD)) { \ + if (_nm_log_enabled_impl (!(NM_THREAD_SAFE_ON_MAIN_THREAD), _nm_l, LOGD_SYSTEMD)) { \ const char *_nm_location = strrchr ((""file), '/'); \ \ - _nm_log_impl (_nm_location ? _nm_location + 1 : (""file), (line), (func), _nm_l, LOGD_SYSTEMD, _nm_e, NULL, NULL, ("%s"format), "libsystemd: ", ## __VA_ARGS__); \ + _nm_log_impl (_nm_location ? _nm_location + 1 : (""file), (line), (func), !(NM_THREAD_SAFE_ON_MAIN_THREAD), _nm_l, LOGD_SYSTEMD, _nm_e, NULL, NULL, ("%s"format), "libsystemd: ", ## __VA_ARGS__); \ } \ (_nm_e > 0 ? -_nm_e : _nm_e); \ }) @@ -130,4 +135,4 @@ static inline pid_t gettid(void) { /*****************************************************************************/ -#endif /* __NM_SD_ADAPT_BASIC_H__ */ +#endif /* __NM_SD_ADAPT_SHARED_H__ */ |