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 2AF414696C1 for ; Tue, 12 May 2020 15:33:25 +0300 (MSK) From: sergeyb@tarantool.org Date: Tue, 12 May 2020 15:32:20 +0300 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH 04/11] Fix building of tt_pthread_attr_getstack() 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 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 #include #include -#if HAVE_PTHREAD_NP_H +#if HAVE_PTHREAD_NP_H || (__OpenBSD__) #include #endif +#if (__OpenBSD__) +#include +#include +#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