Tarantool development patches archive
 help / color / mirror / Atom feed
From: sergeyb@tarantool.org
To: tarantool-patches@dev.tarantool.org
Cc: o.piskunov@tarantool.org
Subject: [Tarantool-patches] [PATCH 07/11] say: fix compilation on OpenBSD
Date: Tue, 12 May 2020 15:32:26 +0300	[thread overview]
Message-ID: <e59e53c9a5d8792d00829f5013c6e57c90622d07.1589284160.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1589284160.git.sergeyb@tarantool.org>

From: Sergey Bronnikov <sergeyb@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

  parent reply	other threads:[~2020-05-12 12:33 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-12 12:32 [Tarantool-patches] [PATCH 00/11] Add OpenBSD support sergeyb
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 01/11] build: introduce openbsd build target sergeyb
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 02/11] build: test pthread_stackseg_np() on OpenBSD sergeyb
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 03/11] build: skip linking with -ldl " sergeyb
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 04/11] Fix building of tt_pthread_attr_getstack() " sergeyb
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 05/11] sql: use mremap() " sergeyb
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 06/11] Include libgen.h when building " sergeyb
2020-05-12 12:32 ` sergeyb [this message]
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 08/11] test: mute broken tests " sergeyb
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 09/11] Add README.OpenBSD sergeyb
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 10/11] Mention OpenBSD as supported platorm sergeyb
2020-05-12 12:32 ` [Tarantool-patches] [PATCH 11/11][small] Add MAP_STACK to mmap() flags sergeyb
2020-05-18 18:22 ` [Tarantool-patches] [PATCH 00/11] Add OpenBSD support Cyrill Gorcunov
2020-05-20  6:41 ` Kirill Yukhin
2020-05-20 12:23   ` Sergey Bronnikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e59e53c9a5d8792d00829f5013c6e57c90622d07.1589284160.git.sergeyb@tarantool.org \
    --to=sergeyb@tarantool.org \
    --cc=o.piskunov@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 07/11] say: fix compilation on OpenBSD' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox