diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-07-20 16:19:18 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-07-20 20:27:24 +0200 |
commit | df0ff127758809a45105893772de76082d12a26d (patch) | |
tree | 9deb3a960cf26b54beae6a0b60d376c6ba8efe9a /src/basic/log.h | |
parent | 5c30a6d2b805ae9b5dd0ad003b9ee86b8965bc47 (diff) | |
download | systemd-df0ff127758809a45105893772de76082d12a26d.tar.gz |
tree-wide: make use of getpid_cached() wherever we can
This moves pretty much all uses of getpid() over to getpid_raw(). I
didn't specifically check whether the optimization is worth it for each
replacement, but in order to keep things simple and systematic I
switched over everything at once.
Diffstat (limited to 'src/basic/log.h')
-rw-r--r-- | src/basic/log.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/basic/log.h b/src/basic/log.h index ff5d776b1d..186747ff8e 100644 --- a/src/basic/log.h +++ b/src/basic/log.h @@ -30,6 +30,7 @@ #include "sd-id128.h" #include "macro.h" +#include "process-util.h" typedef enum LogRealm { LOG_REALM_SYSTEMD, @@ -247,7 +248,7 @@ void log_assert_failed_return_realm( #define log_notice(...) log_full(LOG_NOTICE, __VA_ARGS__) #define log_warning(...) log_full(LOG_WARNING, __VA_ARGS__) #define log_error(...) log_full(LOG_ERR, __VA_ARGS__) -#define log_emergency(...) log_full(getpid() == 1 ? LOG_EMERG : LOG_ERR, __VA_ARGS__) +#define log_emergency(...) log_full(getpid_cached() == 1 ? LOG_EMERG : LOG_ERR, __VA_ARGS__) /* Logging triggered by an errno-like error */ #define log_debug_errno(error, ...) log_full_errno(LOG_DEBUG, error, __VA_ARGS__) @@ -255,7 +256,7 @@ void log_assert_failed_return_realm( #define log_notice_errno(error, ...) log_full_errno(LOG_NOTICE, error, __VA_ARGS__) #define log_warning_errno(error, ...) log_full_errno(LOG_WARNING, error, __VA_ARGS__) #define log_error_errno(error, ...) log_full_errno(LOG_ERR, error, __VA_ARGS__) -#define log_emergency_errno(error, ...) log_full_errno(getpid() == 1 ? LOG_EMERG : LOG_ERR, error, __VA_ARGS__) +#define log_emergency_errno(error, ...) log_full_errno(getpid_cached() == 1 ? LOG_EMERG : LOG_ERR, error, __VA_ARGS__) #ifdef LOG_TRACE # define log_trace(...) log_debug(__VA_ARGS__) |