From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp51.i.mail.ru (smtp51.i.mail.ru [94.100.177.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 8AAD5469710 for ; Tue, 12 May 2020 15:33:46 +0300 (MSK) From: sergeyb@tarantool.org Date: Tue, 12 May 2020 15:32:26 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 07/11] say: fix compilation on OpenBSD List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org Cc: o.piskunov@tarantool.org From: Sergey Bronnikov - 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