summaryrefslogtreecommitdiffstats
path: root/lib/librthread/rthread_file.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2016-05-07 19:05:21 +0000
committerguenther <guenther@openbsd.org>2016-05-07 19:05:21 +0000
commitfe38b55cb0aae270de3f844146814682e8cd345c (patch)
tree9825cc8aa96314e8e79ea1802ccbc9349772680b /lib/librthread/rthread_file.c
parentImplement ACPI 5.0 GeneralPurposeIo OpRegion support. This basically allows (diff)
downloadwireguard-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/librthread/rthread_file.c')
-rw-r--r--lib/librthread/rthread_file.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/librthread/rthread_file.c b/lib/librthread/rthread_file.c
index 50693b61aeb..e9572ea117b 100644
--- a/lib/librthread/rthread_file.c
+++ b/lib/librthread/rthread_file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_file.c,v 1.7 2013/11/21 17:45:10 fgsch Exp $ */
+/* $OpenBSD: rthread_file.c,v 1.8 2016/05/07 19:05:22 guenther Exp $ */
/*
* Copyright (c) 1995 John Birrell <jb@cimlogic.com.au>.
* All rights reserved.
@@ -43,6 +43,7 @@
#include <sys/queue.h>
#include <pthread.h>
#include "rthread.h"
+#include "rthread_cb.h"
/*
* The FILE lock structure. The FILE *fp is locked if the owner is
@@ -167,7 +168,7 @@ do_lock(int idx, FILE *fp)
}
void
-(flockfile)(FILE * fp)
+_thread_flockfile(FILE * fp)
{
int idx = file_idx(fp);
struct file_lock *p;
@@ -215,7 +216,7 @@ void
}
int
-(ftrylockfile)(FILE * fp)
+_thread_ftrylockfile(FILE * fp)
{
int ret = -1;
int idx = file_idx(fp);
@@ -264,7 +265,7 @@ int
}
void
-(funlockfile)(FILE * fp)
+_thread_funlockfile(FILE * fp)
{
int idx = file_idx(fp);
struct file_lock *p;