From 20029ee35ab294365b320a4adf047804dd367b5c Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Thu, 16 Aug 2018 13:03:21 +0200 Subject: [PATCH] log: add CMD_SYSINFO() Add a thread-safe and uniform way to retrieve errno values in programs that are shipped as part of LXC but are not expected to have access to the logging system. Signed-off-by: Christian Brauner --- src/lxc/log.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lxc/log.h b/src/lxc/log.h index d75d87d43..4654fd918 100644 --- a/src/lxc/log.h +++ b/src/lxc/log.h @@ -435,6 +435,12 @@ ATTR_UNUSED static inline void LXC_##LEVEL(struct lxc_log_locinfo* locinfo, \ fprintf(stderr, "%s - " format, ptr, ##__VA_ARGS__); \ } while (0) +#define CMD_SYSINFO(format, ...) \ + do { \ + lxc_log_strerror_r; \ + printf("%s - " format, ptr, ##__VA_ARGS__); \ + } while (0) + extern int lxc_log_fd; extern int lxc_log_syslog(int facility); -- 2.47.2