diff options
Diffstat (limited to 'lib/libthr')
| -rw-r--r-- | lib/libthr/Makefile | 2 | ||||
| -rw-r--r-- | lib/libthr/arch/aarch64/include/pthread_md.h | 2 | ||||
| -rw-r--r-- | lib/libthr/arch/arm/include/pthread_md.h | 2 | ||||
| -rw-r--r-- | lib/libthr/arch/mips/include/pthread_md.h | 2 | ||||
| -rw-r--r-- | lib/libthr/arch/powerpc/include/pthread_md.h | 2 | ||||
| -rw-r--r-- | lib/libthr/arch/riscv/include/pthread_md.h | 2 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_exit.c | 8 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_kern.c | 2 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_list.c | 2 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_mutex.c | 3 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_private.h | 41 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_sig.c | 4 |
12 files changed, 38 insertions, 34 deletions
diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index 60cb420cb8c4..ffdb7b86b834 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -16,8 +16,8 @@ MK_SSP= no LIB=thr SHLIB_MAJOR= 3 -WARNS?= 3 NO_WTHREAD_SAFETY=1 +NO_WCAST_ALIGN.gcc=1 # for gcc 4.2 CFLAGS+=-DPTHREAD_KERNEL CFLAGS+=-I${SRCTOP}/lib/libc/include -I${.CURDIR}/thread \ -I${SRCTOP}/include diff --git a/lib/libthr/arch/aarch64/include/pthread_md.h b/lib/libthr/arch/aarch64/include/pthread_md.h index 14c18939e979..d14bce244f8f 100644 --- a/lib/libthr/arch/aarch64/include/pthread_md.h +++ b/lib/libthr/arch/aarch64/include/pthread_md.h @@ -72,8 +72,6 @@ _tcb_get(void) return (tcb); } -extern struct pthread *_thr_initial; - static __inline struct pthread * _get_curthread(void) { diff --git a/lib/libthr/arch/arm/include/pthread_md.h b/lib/libthr/arch/arm/include/pthread_md.h index 9a6b5233e515..4ae797170e5f 100644 --- a/lib/libthr/arch/arm/include/pthread_md.h +++ b/lib/libthr/arch/arm/include/pthread_md.h @@ -75,8 +75,6 @@ _tcb_get(void) #endif } -extern struct pthread *_thr_initial; - static __inline struct pthread * _get_curthread(void) { diff --git a/lib/libthr/arch/mips/include/pthread_md.h b/lib/libthr/arch/mips/include/pthread_md.h index d27ecf073056..ebb6b36e6a1a 100644 --- a/lib/libthr/arch/mips/include/pthread_md.h +++ b/lib/libthr/arch/mips/include/pthread_md.h @@ -120,8 +120,6 @@ _tcb_get(void) # endif /* ! __mips_n64 */ #endif /* ! TLS_USE_SYSARCH */ -extern struct pthread *_thr_initial; - static __inline struct pthread * _get_curthread(void) { diff --git a/lib/libthr/arch/powerpc/include/pthread_md.h b/lib/libthr/arch/powerpc/include/pthread_md.h index 544ee1c5d5fc..699233e175e5 100644 --- a/lib/libthr/arch/powerpc/include/pthread_md.h +++ b/lib/libthr/arch/powerpc/include/pthread_md.h @@ -80,8 +80,6 @@ _tcb_get(void) return ((struct tcb *)(_tp - TP_OFFSET)); } -extern struct pthread *_thr_initial; - static __inline struct pthread * _get_curthread(void) { diff --git a/lib/libthr/arch/riscv/include/pthread_md.h b/lib/libthr/arch/riscv/include/pthread_md.h index 3f5107815de3..499da5f5a8f8 100644 --- a/lib/libthr/arch/riscv/include/pthread_md.h +++ b/lib/libthr/arch/riscv/include/pthread_md.h @@ -78,8 +78,6 @@ _tcb_get(void) return ((struct tcb *)(_tp - TP_OFFSET)); } -extern struct pthread *_thr_initial; - static __inline struct pthread * _get_curthread(void) { diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index decc2f2983b7..0df0b8c2c8d0 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -46,8 +46,6 @@ __FBSDID("$FreeBSD$"); #include "libc_private.h" #include "thr_private.h" -void _pthread_exit(void *status); - static void exit_thread(void) __dead2; __weak_reference(_pthread_exit, pthread_exit); @@ -72,7 +70,7 @@ static void thread_uw_init(void) { static int inited = 0; - Dl_info dlinfo; + Dl_info dli; void *handle; void *forcedunwind, *getcfa; @@ -80,12 +78,12 @@ thread_uw_init(void) return; handle = RTLD_DEFAULT; if ((forcedunwind = dlsym(handle, "_Unwind_ForcedUnwind")) != NULL) { - if (dladdr(forcedunwind, &dlinfo)) { + if (dladdr(forcedunwind, &dli)) { /* * Make sure the address is always valid by holding the library, * also assume functions are in same library. */ - if ((handle = dlopen(dlinfo.dli_fname, RTLD_LAZY)) != NULL) { + if ((handle = dlopen(dli.dli_fname, RTLD_LAZY)) != NULL) { forcedunwind = dlsym(handle, "_Unwind_ForcedUnwind"); getcfa = dlsym(handle, "_Unwind_GetCFA"); if (forcedunwind != NULL && getcfa != NULL) { diff --git a/lib/libthr/thread/thr_kern.c b/lib/libthr/thread/thr_kern.c index 6463f1d1ad01..64128b4382d7 100644 --- a/lib/libthr/thread/thr_kern.c +++ b/lib/libthr/thread/thr_kern.c @@ -62,7 +62,7 @@ _thr_setthreaded(int threaded) } void -_thr_assert_lock_level() +_thr_assert_lock_level(void) { PANIC("locklevel <= 0"); } diff --git a/lib/libthr/thread/thr_list.c b/lib/libthr/thread/thr_list.c index ae1f124416b7..70b85bc80f7d 100644 --- a/lib/libthr/thread/thr_list.c +++ b/lib/libthr/thread/thr_list.c @@ -35,8 +35,8 @@ __FBSDID("$FreeBSD$"); #include <string.h> #include <pthread.h> -#include "thr_private.h" #include "libc_private.h" +#include "thr_private.h" /*#define DEBUG_THREAD_LIST */ #ifdef DEBUG_THREAD_LIST diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index 877bd37fe88b..4ab7720b665b 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -70,8 +70,6 @@ int __pthread_mutex_trylock(pthread_mutex_t *mutex); int __pthread_mutex_lock(pthread_mutex_t *mutex); int __pthread_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *abstime); -int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex, - void *(calloc_cb)(size_t, size_t)); int _pthread_mutex_getspinloops_np(pthread_mutex_t *mutex, int *count); int _pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count); int __pthread_mutex_setspinloops_np(pthread_mutex_t *mutex, int count); @@ -712,6 +710,7 @@ mutex_lock_common(struct pthread_mutex *m, const struct timespec *abstime, struct pthread *curthread; int ret, robust; + robust = 0; /* pacify gcc */ curthread = _get_curthread(); if (!cvattach && m->m_flags & PMUTEX_FLAG_PRIVATE) THR_CRITICAL_ENTER(curthread); diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index 56ecdb441310..4c9245e7b050 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -69,6 +69,9 @@ __NULLABILITY_PRAGMA_PUSH WEAK_REF(func, SYM_FBP10(sym)); \ SYM_DEFAULT(sym, SYM_FBP10(sym), FBSDprivate_1.0) +struct pthread; +extern struct pthread *_thr_initial __hidden; + #include "pthread_md.h" #include "thr_umtx.h" #include "thread_db.h" @@ -701,14 +704,16 @@ do { \ (curthr->report_events && \ (((curthr)->event_mask | _thread_event_mask ) & e) != 0) +#ifndef __LIBC_ISTHREADED_DECLARED +#define __LIBC_ISTHREADED_DECLARED extern int __isthreaded; +#endif /* * Global variables for the pthread kernel. */ extern char *_usrstack __hidden; -extern struct pthread *_thr_initial __hidden; /* For debugger */ extern int _libthr_debug; @@ -835,8 +840,10 @@ int _sched_yield(void); void _pthread_cleanup_push(void (*)(void *), void *); void _pthread_cleanup_pop(int); void _pthread_exit_mask(void *status, sigset_t *mask) __dead2 __hidden; +#ifndef _LIBC_PRIVATE_H_ void _pthread_cancel_enter(int maycancel); void _pthread_cancel_leave(int maycancel); +#endif int _pthread_mutex_consistent(pthread_mutex_t * _Nonnull); int _pthread_mutexattr_getrobust(pthread_mutexattr_t * _Nonnull __restrict, int * _Nonnull __restrict); @@ -844,46 +851,56 @@ int _pthread_mutexattr_setrobust(pthread_mutexattr_t * _Nonnull, int); /* #include <fcntl.h> */ #ifdef _SYS_FCNTL_H_ +#ifndef _LIBC_PRIVATE_H_ int __sys_fcntl(int, int, ...); int __sys_openat(int, const char *, int, ...); -#endif +#endif /* _LIBC_PRIVATE_H_ */ +#endif /* _SYS_FCNTL_H_ */ /* #include <signal.h> */ #ifdef _SIGNAL_H_ int __sys_kill(pid_t, int); -int __sys_sigaction(int, const struct sigaction *, struct sigaction *); +int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *); int __sys_sigpending(sigset_t *); +int __sys_sigreturn(const ucontext_t *); +#ifndef _LIBC_PRIVATE_H_ +int __sys_sigaction(int, const struct sigaction *, struct sigaction *); int __sys_sigprocmask(int, const sigset_t *, sigset_t *); int __sys_sigsuspend(const sigset_t *); -int __sys_sigreturn(const ucontext_t *); -int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *); -int __sys_sigwait(const sigset_t *, int *); int __sys_sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *); +int __sys_sigwait(const sigset_t *, int *); int __sys_sigwaitinfo(const sigset_t *set, siginfo_t *info); -#endif +#endif /* _LIBC_PRIVATE_H_ */ +#endif /* _SYS_FCNTL_H_ */ /* #include <time.h> */ #ifdef _TIME_H_ +#ifndef _LIBC_PRIVATE_H_ int __sys_clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *); int __sys_nanosleep(const struct timespec *, struct timespec *); -#endif +#endif /* _LIBC_PRIVATE_H_ */ +#endif /* _SYS_FCNTL_H_ */ /* #include <sys/ucontext.h> */ #ifdef _SYS_UCONTEXT_H_ +#ifndef _LIBC_PRIVATE_H_ int __sys_setcontext(const ucontext_t *ucp); int __sys_swapcontext(ucontext_t *oucp, const ucontext_t *ucp); -#endif +#endif /* _LIBC_PRIVATE_H_ */ +#endif /* _SYS_FCNTL_H_ */ /* #include <unistd.h> */ #ifdef _UNISTD_H_ +void __sys_exit(int); +pid_t __sys_getpid(void); +#ifndef _LIBC_PRIVATE_H_ int __sys_close(int); int __sys_fork(void); -pid_t __sys_getpid(void); ssize_t __sys_read(int, void *, size_t); -void __sys_exit(int); -#endif +#endif /* _LIBC_PRIVATE_H_ */ +#endif /* _SYS_FCNTL_H_ */ static inline int _thr_isthreaded(void) diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index 3329a82159b6..978ae61eca6f 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -736,8 +736,8 @@ __thr_setcontext(const ucontext_t *ucp) errno = EINVAL; return (-1); } - if (!SIGISMEMBER(uc.uc_sigmask, SIGCANCEL)) - return __sys_setcontext(ucp); + if (!SIGISMEMBER(ucp->uc_sigmask, SIGCANCEL)) + return (__sys_setcontext(ucp)); (void) memcpy(&uc, ucp, sizeof(uc)); SIGDELSET(uc.uc_sigmask, SIGCANCEL); return (__sys_setcontext(&uc)); |
