[Tarantool-patches] [PATCH 07/11] say: fix compilation on OpenBSD

sergeyb at tarantool.org sergeyb at tarantool.org
Tue May 12 15:32:26 MSK 2020


From: Sergey Bronnikov <sergeyb at tarantool.org>

- define macros LOG_MAKEPRI() on OpenBSD as it is absent
- replace sigtimedwait() by sigwait() as latter is unsupported on OpenBSD

Part of #4967
---
 src/lib/core/say.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/lib/core/say.c b/src/lib/core/say.c
index 8c000b4b1..7116883d4 100644
--- a/src/lib/core/say.c
+++ b/src/lib/core/say.c
@@ -434,10 +434,19 @@ log_pipe_init(struct log *log, const char *init_str)
 	struct timespec timeout;
 	timeout.tv_sec = 0;
 	timeout.tv_nsec = 1; /* Mostly to trigger preemption. */
+#if defined(__OpenBSD__)
+	int sig = 0;
+	sigwait(&mask, &sig);
+	if (sig ==SIGCHLD) {
+		diag_set(IllegalParams, "logger process died");
+		return -1;
+	}
+#else
 	if (sigtimedwait(&mask, NULL, &timeout) == SIGCHLD) {
 		diag_set(IllegalParams, "logger process died");
 		return -1;
 	}
+#endif
 #endif
 	/* OK, let's hope for the best. */
 	sigprocmask(SIG_UNBLOCK, &mask, NULL);
@@ -945,6 +954,9 @@ say_format_syslog(struct log *log, char *buf, int len, int level, const char *fi
 
 	/* Format syslog header according to RFC */
 	int prio = level_to_syslog_priority(level);
+#if defined(__OpenBSD__)
+#define LOG_MAKEPRI(fac, pri)        (((fac) << 3) | (pri))
+#endif
 	SNPRINT(total, snprintf, buf, len, "<%d>",
 		LOG_MAKEPRI(8 * log->syslog_facility, prio));
 	SNPRINT(total, strftime, buf, len, "%h %e %T ", &tm);
-- 
2.23.0



More information about the Tarantool-patches mailing list