diff options
author | 2016-05-07 19:05:21 +0000 | |
---|---|---|
committer | 2016-05-07 19:05:21 +0000 | |
commit | fe38b55cb0aae270de3f844146814682e8cd345c (patch) | |
tree | 9825cc8aa96314e8e79ea1802ccbc9349772680b /lib/libc/stdio/local.h | |
parent | Implement ACPI 5.0 GeneralPurposeIo OpRegion support. This basically allows (diff) | |
download | wireguard-openbsd-fe38b55cb0aae270de3f844146814682e8cd345c.tar.xz wireguard-openbsd-fe38b55cb0aae270de3f844146814682e8cd345c.zip |
Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!
Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!
Clean up libpthread's symbol exports like libc.
On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.
Testing by various, particularly sthen@ and patrick@
ok kettenis@
Diffstat (limited to 'lib/libc/stdio/local.h')
-rw-r--r-- | lib/libc/stdio/local.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/libc/stdio/local.h b/lib/libc/stdio/local.h index 94b2804ff18..ad888b0fd50 100644 --- a/lib/libc/stdio/local.h +++ b/lib/libc/stdio/local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: local.h,v 1.23 2015/10/25 18:01:24 guenther Exp $ */ +/* $OpenBSD: local.h,v 1.24 2016/05/07 19:05:22 guenther Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -40,6 +40,7 @@ #include <wchar.h> #include "wcio.h" #include "fileext.h" +#include "thread_private.h" void _cleanup(void); int _fwalk(int (*)(FILE *)); @@ -96,5 +97,13 @@ __END_HIDDEN_DECLS (fp)->_lb._base = NULL; \ } -#define FLOCKFILE(fp) do { if (__isthreaded) flockfile(fp); } while (0) -#define FUNLOCKFILE(fp) do { if (__isthreaded) funlockfile(fp); } while (0) +#define FLOCKFILE(fp) \ + do { \ + if (_thread_cb.tc_flockfile != NULL) \ + _thread_cb.tc_flockfile(fp); \ + } while (0) +#define FUNLOCKFILE(fp) \ + do { \ + if (_thread_cb.tc_funlockfile != NULL) \ + _thread_cb.tc_funlockfile(fp); \ + } while (0) |