ucontext.h: Expose __UCONTEXT_SIZE to userland.

But don't expose __CTASSERT(__UCONTEXT_SIZE == sizeof(ucontext_t)) to
userland.

- __UCONTEXT_SIZE will be needed soon by libc and signal trampolines
  in order to version ucontext so we can safely expand it with
  architecture extensions.

- __CTASSERT is not safe to use in header files in arbitrary
  compilation environments (although in the NetBSD kernel build it is
  safe).  Exposing the __CTASSERT in a header file used by userland
  appears to have the side effect of breaking the Firefox build in
  rustc, though the mechanism isn't entirely clear.

Firefox/rustc discussion here:
https://mail-index.netbsd.org/pkgsrc-users/2024/05/18/msg039578.html

Let's see if this makes a difference -- if it works, great; if not,
maybe it will help us to narrow down what's happening with rustc and
Firefox.
This commit is contained in:
riastradh 2024-05-25 13:44:48 +00:00
parent c05c85b7d7
commit 2fef80593e
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ucontext.h,v 1.23 2024/05/24 13:50:30 ryoon Exp $ */
/* $NetBSD: ucontext.h,v 1.24 2024/05/25 13:44:48 riastradh Exp $ */
/*-
* Copyright (c) 1999, 2003, 2024 The NetBSD Foundation, Inc.
@ -82,6 +82,10 @@ struct __ucontext {
#define _UC_UCONTEXT_ALIGN (~0)
#endif
#ifndef __UCONTEXT_SIZE
#define __UCONTEXT_SIZE sizeof(ucontext_t)
#endif
#ifndef _UC_TLSBASE
#error _UC_TLSBASE not defined.
#endif
@ -105,8 +109,6 @@ int cpu_mcontext_validate(struct lwp *, const mcontext_t *);
#ifdef __UCONTEXT_SIZE
__CTASSERT(sizeof(ucontext_t) == __UCONTEXT_SIZE);
#else
#define __UCONTEXT_SIZE sizeof(ucontext_t)
#endif
#endif /* _KERNEL */