Harmonize the namespace of fast TLS base pointer getter functions

Protect __lwp_getprivate_fast() with _RTLD_SOURCE, _LIBC_SOURCE and
__LIBPTHREAD_SOURCE__.

Include in this namespace <sys/tcl.h> and use __BEGIN_DECLS/__END_DECLS
for the sake of consistency.
This commit is contained in:
kamil 2019-12-27 00:32:16 +00:00
parent aa22ab9772
commit 4d3a90668a
8 changed files with 70 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.9 2018/02/15 15:53:56 kamil Exp $ */
/* $NetBSD: mcontext.h,v 1.10 2019/12/27 00:32:16 kamil Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -102,6 +102,11 @@ typedef struct {
#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)
#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
defined(__LIBPTHREAD_SOURCE__)
#include <sys/tls.h>
__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@ -113,5 +118,8 @@ __lwp_getprivate_fast(void)
return __tmp;
}
__END_DECLS
#endif
#endif /* !_ALPHA_MCONTEXT_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.19 2018/02/15 15:53:56 kamil Exp $ */
/* $NetBSD: mcontext.h,v 1.20 2019/12/27 00:32:16 kamil Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -84,6 +84,11 @@ typedef struct {
#define __UCONTEXT_SIZE 784
#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
defined(__LIBPTHREAD_SOURCE__)
#include <sys/tls.h>
__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@ -93,6 +98,9 @@ __lwp_getprivate_fast(void)
return __tmp;
}
__END_DECLS
#endif
#ifdef _KERNEL

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.10 2018/02/27 11:26:39 kamil Exp $ */
/* $NetBSD: mcontext.h,v 1.11 2019/12/27 00:32:17 kamil Exp $ */
#ifndef _HPPA_MCONTEXT_H_
#define _HPPA_MCONTEXT_H_
@ -59,6 +59,11 @@ do { \
} while (/*CONSTCOND*/0)
#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[_REG_RET0])
#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
defined(__LIBPTHREAD_SOURCE__)
#include <sys/tls.h>
__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@ -68,6 +73,9 @@ __lwp_getprivate_fast(void)
return __tmp;
}
__END_DECLS
#endif
#endif /* !__ASSEMBLER__ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.14 2018/02/15 15:53:56 kamil Exp $ */
/* $NetBSD: mcontext.h,v 1.15 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -113,6 +113,11 @@ typedef struct {
#define __UCONTEXT_SIZE 776
#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
defined(__LIBPTHREAD_SOURCE__)
#include <sys/tls.h>
__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@ -122,5 +127,8 @@ __lwp_getprivate_fast(void)
return __tmp;
}
__END_DECLS
#endif
#endif /* !_I386_MCONTEXT_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.9 2019/06/17 15:08:34 kamil Exp $ */
/* $NetBSD: mcontext.h,v 1.10 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -117,10 +117,18 @@ typedef struct __mcontext {
#define _UC_MACHINE_INTRV(uc) ((uc)->uc_mcontext.__gregs[8])
#define _UC_MACHINE_SET_PC(uc, pc) (uc)->uc_mcontext.mc_special.iip = (pc)
#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
defined(__LIBPTHREAD_SOURCE__)
#include <sys/tls.h>
__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
return (void*)0;
}
__END_DECLS
#endif
#endif /* !_IA64_MCONTEXT_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.11 2018/02/15 15:53:57 kamil Exp $ */
/* $NetBSD: mcontext.h,v 1.12 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -95,6 +95,11 @@ typedef struct {
#define _UC_CLRSTACK 0x20000
#define _UC_TLSBASE 0x80000
#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
defined(__LIBPTHREAD_SOURCE__)
#include <sys/tls.h>
__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@ -104,5 +109,8 @@ __lwp_getprivate_fast(void)
return __gbr;
}
__END_DECLS
#endif
#endif /* !_SH3_MCONTEXT_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.17 2018/02/19 08:31:13 mrg Exp $ */
/* $NetBSD: mcontext.h,v 1.18 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -161,6 +161,11 @@ do { \
(uc)->uc_mcontext.__gregs[_REG_nPC] = (pc) + 4; \
} while (/*CONSTCOND*/0)
#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
defined(__LIBPTHREAD_SOURCE__)
#include <sys/tls.h>
__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@ -170,5 +175,8 @@ __lwp_getprivate_fast(void)
return __tmp;
}
__END_DECLS
#endif
#endif /* !_SPARC_MCONTEXT_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mcontext.h,v 1.9 2018/02/15 15:53:57 kamil Exp $ */
/* $NetBSD: mcontext.h,v 1.10 2019/12/27 00:32:17 kamil Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -74,9 +74,12 @@ typedef struct {
#define _UC_MACHINE_SET_PC(uc, pc) _UC_MACHINE_PC(uc) = (pc)
#ifndef _KERNEL
#if defined(_RTLD_SOURCE) || defined(_LIBC_SOURCE) || \
defined(__LIBPTHREAD_SOURCE__)
#include <sys/tls.h>
#include <sys/syscall.h>
__BEGIN_DECLS
static __inline void *
__lwp_getprivate_fast(void)
{
@ -84,6 +87,8 @@ __lwp_getprivate_fast(void)
__asm("chmk %0" :: "i"(SYS__lwp_getprivate) : "r0");
return tcb;
}
__END_DECLS
#endif
#endif /* !_VAX_MCONTEXT_H_ */