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 04/11] Fix building of tt_pthread_attr_getstack() on OpenBSD
Date: Tue, 12 May 2020 15:32:20 +0300	[thread overview]
Message-ID: <cd2a3d0f9850f38ccf77f5b1ea840838bca32209.1589284160.git.sergeyb@tarantool.org> (raw)
In-Reply-To: <cover.1589284160.git.sergeyb@tarantool.org>

From: Sergey Bronnikov <sergeyb@tarantool.org>

Part of #4967
---
 src/tt_pthread.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/tt_pthread.h b/src/tt_pthread.h
index 6bb19eb23..70f605091 100644
--- a/src/tt_pthread.h
+++ b/src/tt_pthread.h
@@ -37,9 +37,13 @@
 #include <stdio.h>
 #include <errno.h>
 #include <pthread.h>
-#if HAVE_PTHREAD_NP_H
+#if HAVE_PTHREAD_NP_H || (__OpenBSD__)
 #include <pthread_np.h>
 #endif
+#if (__OpenBSD__)
+#include <signal.h>
+#include <sys/signal.h>
+#endif
 #include "say.h"
 
 /**
@@ -358,6 +362,11 @@ tt_pthread_attr_getstack(pthread_t thread, void **stackaddr, size_t *stacksize)
 	/* Old macOS */
 	*stacksize = pthread_get_stacksize_np(thread);
 	*stackaddr = pthread_get_stackaddr_np(thread);
+#elif (__OpenBSD__)
+	stack_t *sinfo = (stack_t*)malloc(sizeof(stack_t));
+	pthread_stackseg_np(thread, sinfo);
+	*stacksize = sinfo->ss_size;
+	*stackaddr = sinfo->ss_sp;
 #else
 #error Unable to get thread stack
 #endif
-- 
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 ` sergeyb [this message]
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 ` [Tarantool-patches] [PATCH 07/11] say: fix compilation " sergeyb
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=cd2a3d0f9850f38ccf77f5b1ea840838bca32209.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 04/11] Fix building of tt_pthread_attr_getstack() 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