mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
WARNS=3'ify.
This commit is contained in:
parent
0442ae6dc7
commit
eb63e604ea
120 changed files with 532 additions and 159 deletions
|
|
@ -28,12 +28,11 @@ CFLAGS+=-I${.CURDIR}/sys
|
|||
CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf
|
||||
CFLAGS+=-I${.CURDIR}/../../libexec/rtld-elf/${MACHINE_ARCH}
|
||||
CFLAGS+=-fno-builtin
|
||||
CFLAGS+=-fno-strict-aliasing
|
||||
|
||||
# Uncomment this if you want libkse to contain debug information for
|
||||
# thread locking.
|
||||
CFLAGS+=-D_LOCK_DEBUG
|
||||
WARNS?=2
|
||||
WARNS?=3
|
||||
|
||||
# Uncomment this if you want to build a 1:1 threading mode library
|
||||
# however it is no longer strictly conformed to POSIX
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
* void atomic_swap64(intptr_t *dst, intptr_t val, intptr_t *res);
|
||||
*/
|
||||
static inline void
|
||||
atomic_swap64(intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
atomic_swap64(volatile intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
{
|
||||
__asm __volatile(
|
||||
"xchgq %2, %1; movq %2, %0"
|
||||
|
|
@ -44,7 +44,7 @@ atomic_swap64(intptr_t *dst, intptr_t val, intptr_t *res)
|
|||
}
|
||||
|
||||
static inline void
|
||||
atomic_swap_int(int *dst, int val, int *res)
|
||||
atomic_swap_int(volatile int *dst, int val, int *res)
|
||||
{
|
||||
__asm __volatile(
|
||||
"xchgl %2, %1; movl %2, %0"
|
||||
|
|
@ -52,6 +52,6 @@ atomic_swap_int(int *dst, int val, int *res)
|
|||
}
|
||||
|
||||
#define atomic_swap_ptr(d, v, r) \
|
||||
atomic_swap64((intptr_t *)(d), (intptr_t)(v), (intptr_t *)(r))
|
||||
atomic_swap64((volatile intptr_t *)(d), (intptr_t)(v), (intptr_t *)(r))
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -250,7 +250,7 @@ _thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
|
|||
_amd64_restore_context(
|
||||
&tcb->tcb_tmbx.tm_context.uc_mcontext,
|
||||
(intptr_t)&tcb->tcb_tmbx,
|
||||
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
|
||||
(intptr_t *)(void *)&kcb->kcb_kmbx.km_curthread);
|
||||
else
|
||||
_amd64_restore_context(
|
||||
&tcb->tcb_tmbx.tm_context.uc_mcontext,
|
||||
|
|
|
|||
|
|
@ -39,15 +39,15 @@
|
|||
* void atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res);
|
||||
*/
|
||||
static inline void
|
||||
atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
atomic_swap32(volatile intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
{
|
||||
*res = __swp(val, dst);
|
||||
}
|
||||
|
||||
#define atomic_swap_ptr(d, v, r) \
|
||||
atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
atomic_swap32((volatile intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
|
||||
#define atomic_swap_int(d, v, r) \
|
||||
atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
atomic_swap32((volatile intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
* void atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res);
|
||||
*/
|
||||
static inline void
|
||||
atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
atomic_swap32(volatile intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
{
|
||||
__asm __volatile(
|
||||
"xchgl %2, %1; movl %2, %0"
|
||||
|
|
@ -44,8 +44,8 @@ atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
|
|||
}
|
||||
|
||||
#define atomic_swap_ptr(d, v, r) \
|
||||
atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
atomic_swap32((volatile intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
|
||||
#define atomic_swap_int(d, v, r) \
|
||||
atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
atomic_swap32((volatile intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -246,7 +246,7 @@ _thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
|
|||
if (setmbox != 0)
|
||||
_thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
|
||||
(intptr_t)&tcb->tcb_tmbx,
|
||||
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
|
||||
(intptr_t *)(void *)&kcb->kcb_kmbx.km_curthread);
|
||||
else
|
||||
_thr_setcontext(&tcb->tcb_tmbx.tm_context.uc_mcontext,
|
||||
0, NULL);
|
||||
|
|
|
|||
|
|
@ -30,18 +30,18 @@
|
|||
#define _ATOMIC_OPS_H_
|
||||
|
||||
static inline void
|
||||
atomic_swap_int(int *dst, int val, int *res)
|
||||
atomic_swap_int(volatile int *dst, int val, int *res)
|
||||
{
|
||||
__asm("xchg4 %0=[%2],%1" : "=r"(*res) : "r"(val), "r"(dst));
|
||||
}
|
||||
|
||||
static inline void
|
||||
atomic_swap_long(long *dst, long val, long *res)
|
||||
atomic_swap_long(volatile long *dst, long val, long *res)
|
||||
{
|
||||
__asm("xchg8 %0=[%2],%1" : "=r"(*res) : "r"(val), "r"(dst));
|
||||
}
|
||||
|
||||
#define atomic_swap_ptr(d,v,r) \
|
||||
atomic_swap_long((long*)d, (long)v, (long*)r)
|
||||
atomic_swap_long((volatile long *)d, (long)v, (long *)r)
|
||||
|
||||
#endif /* _ATOMIC_OPS_H_ */
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
* void atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res);
|
||||
*/
|
||||
static inline void
|
||||
atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
atomic_swap32(volatile intptr_t *dst, intptr_t val, intptr_t *res)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
|
|
@ -55,8 +55,8 @@ atomic_swap32(intptr_t *dst, intptr_t val, intptr_t *res)
|
|||
}
|
||||
|
||||
#define atomic_swap_ptr(d, v, r) \
|
||||
atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
atomic_swap32((volatile intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
|
||||
#define atomic_swap_int(d, v, r) \
|
||||
atomic_swap32((intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
atomic_swap32((volatile intptr_t *)d, (intptr_t)v, (intptr_t *)r)
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@ _thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
|
|||
tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
|
||||
if (setmbox)
|
||||
_ppc32_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
|
||||
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
|
||||
(intptr_t *)(void *)&kcb->kcb_kmbx.km_curthread);
|
||||
else
|
||||
_ppc32_setcontext(mc, 0, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
* void atomic_swap_long(long *dst, long val, long *res);
|
||||
*/
|
||||
static __inline void
|
||||
atomic_swap_long(long *dst, long val, long *res)
|
||||
atomic_swap_long(volatile long *dst, long val, long *res)
|
||||
{
|
||||
long tmp;
|
||||
long r;
|
||||
|
|
@ -54,7 +54,7 @@ atomic_swap_long(long *dst, long val, long *res)
|
|||
}
|
||||
|
||||
static __inline void
|
||||
atomic_swap_int(int *dst, int val, int *res)
|
||||
atomic_swap_int(volatile int *dst, int val, int *res)
|
||||
{
|
||||
int tmp;
|
||||
int r;
|
||||
|
|
@ -70,6 +70,6 @@ atomic_swap_int(int *dst, int val, int *res)
|
|||
}
|
||||
|
||||
#define atomic_swap_ptr(dst, val, res) \
|
||||
atomic_swap_long((long *)dst, (long)val, (long *)res)
|
||||
atomic_swap_long((volatile long *)dst, (long)val, (long *)res)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ _thread_switch(struct kcb *kcb, struct tcb *tcb, int setmbox)
|
|||
tcb->tcb_tmbx.tm_lwp = kcb->kcb_kmbx.km_lwp;
|
||||
if (setmbox)
|
||||
_thr_setcontext(mc, (intptr_t)&tcb->tcb_tmbx,
|
||||
(intptr_t *)&kcb->kcb_kmbx.km_curthread);
|
||||
(intptr_t *)(void *)&kcb->kcb_kmbx.km_curthread);
|
||||
else
|
||||
_thr_setcontext(mc, 0, NULL);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -178,11 +178,12 @@ _lock_acquire(struct lock *lck, struct lockuser *lu, int prio)
|
|||
* Atomically swap the head of the lock request with
|
||||
* this request.
|
||||
*/
|
||||
atomic_swap_ptr(&lck->l_head, lu->lu_myreq, &lu->lu_watchreq);
|
||||
atomic_swap_ptr((void *)&lck->l_head, lu->lu_myreq,
|
||||
(void *)&lu->lu_watchreq);
|
||||
|
||||
if (lu->lu_watchreq->lr_locked != 0) {
|
||||
atomic_store_rel_ptr
|
||||
((volatile uintptr_t *)&lu->lu_watchreq->lr_watcher,
|
||||
((volatile uintptr_t *)(void *)&lu->lu_watchreq->lr_watcher,
|
||||
(uintptr_t)lu);
|
||||
if ((lck->l_wait == NULL) ||
|
||||
((lck->l_type & LCK_ADAPTIVE) == 0)) {
|
||||
|
|
@ -214,7 +215,7 @@ _lock_acquire(struct lock *lck, struct lockuser *lu, int prio)
|
|||
if (lu->lu_watchreq->lr_active == 0)
|
||||
break;
|
||||
}
|
||||
atomic_swap_int((int *)&lu->lu_watchreq->lr_locked,
|
||||
atomic_swap_int(&lu->lu_watchreq->lr_locked,
|
||||
2, &lval);
|
||||
if (lval == 0)
|
||||
lu->lu_watchreq->lr_locked = 0;
|
||||
|
|
@ -253,18 +254,19 @@ _lock_release(struct lock *lck, struct lockuser *lu)
|
|||
|
||||
/* Update tail if our request is last. */
|
||||
if (lu->lu_watchreq->lr_owner == NULL) {
|
||||
atomic_store_rel_ptr((volatile uintptr_t *)&lck->l_tail,
|
||||
atomic_store_rel_ptr((volatile uintptr_t *)
|
||||
(void *)&lck->l_tail,
|
||||
(uintptr_t)lu->lu_myreq);
|
||||
atomic_store_rel_ptr
|
||||
((volatile uintptr_t *)&lu->lu_myreq->lr_owner,
|
||||
atomic_store_rel_ptr((volatile uintptr_t *)
|
||||
(void *)&lu->lu_myreq->lr_owner,
|
||||
(uintptr_t)NULL);
|
||||
} else {
|
||||
/* Remove ourselves from the list. */
|
||||
atomic_store_rel_ptr((volatile uintptr_t *)
|
||||
&lu->lu_myreq->lr_owner,
|
||||
(void *)&lu->lu_myreq->lr_owner,
|
||||
(uintptr_t)lu->lu_watchreq->lr_owner);
|
||||
atomic_store_rel_ptr((volatile uintptr_t *)
|
||||
&lu->lu_watchreq->lr_owner->lu_myreq,
|
||||
(void *)&lu->lu_watchreq->lr_owner->lu_myreq,
|
||||
(uintptr_t)lu->lu_myreq);
|
||||
}
|
||||
/*
|
||||
|
|
@ -293,7 +295,7 @@ _lock_release(struct lock *lck, struct lockuser *lu)
|
|||
/* Give the lock to the highest priority user. */
|
||||
if (lck->l_wakeup != NULL) {
|
||||
atomic_swap_int(
|
||||
(int *)&lu_h->lu_watchreq->lr_locked,
|
||||
&lu_h->lu_watchreq->lr_locked,
|
||||
0, &lval);
|
||||
if (lval == 2)
|
||||
/* Notify the sleeper */
|
||||
|
|
@ -305,7 +307,7 @@ _lock_release(struct lock *lck, struct lockuser *lu)
|
|||
&lu_h->lu_watchreq->lr_locked, 0);
|
||||
} else {
|
||||
if (lck->l_wakeup != NULL) {
|
||||
atomic_swap_int((int *)&myreq->lr_locked,
|
||||
atomic_swap_int(&myreq->lr_locked,
|
||||
0, &lval);
|
||||
if (lval == 2)
|
||||
/* Notify the sleeper */
|
||||
|
|
@ -326,7 +328,7 @@ _lock_release(struct lock *lck, struct lockuser *lu)
|
|||
lu->lu_watchreq = NULL;
|
||||
lu->lu_myreq->lr_locked = 1;
|
||||
if (lck->l_wakeup) {
|
||||
atomic_swap_int((int *)&myreq->lr_locked, 0, &lval);
|
||||
atomic_swap_int(&myreq->lr_locked, 0, &lval);
|
||||
if (lval == 2)
|
||||
/* Notify the sleeper */
|
||||
lck->l_wakeup(lck, myreq->lr_watcher);
|
||||
|
|
@ -339,7 +341,7 @@ _lock_release(struct lock *lck, struct lockuser *lu)
|
|||
}
|
||||
|
||||
void
|
||||
_lock_grant(struct lock *lck /* unused */, struct lockuser *lu)
|
||||
_lock_grant(struct lock *lck __unused /* unused */, struct lockuser *lu)
|
||||
{
|
||||
atomic_store_rel_int(&lu->lu_watchreq->lr_locked, 3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "libc_private.h"
|
||||
#include "thr_private.h"
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ __FBSDID("$FreeBSD$");
|
|||
LT10_COMPAT_PRIVATE(__accept);
|
||||
LT10_COMPAT_DEFAULT(accept);
|
||||
|
||||
int __accept(int s, struct sockaddr *addr, socklen_t *addrlen);
|
||||
|
||||
|
||||
__weak_reference(__accept, accept);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@
|
|||
LT10_COMPAT_PRIVATE(_aio_suspend);
|
||||
LT10_COMPAT_DEFAULT(aio_suspend);
|
||||
|
||||
|
||||
int
|
||||
_aio_suspend(const struct aiocb * const iocbs[], int niocb, const struct
|
||||
timespec *timeout);
|
||||
|
||||
__weak_reference(_aio_suspend, aio_suspend);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/queue.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_atfork);
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_destroy);
|
||||
|
|
|
|||
|
|
@ -25,10 +25,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include <pthread_np.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_get_np);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,10 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_getdetachstate);
|
||||
|
|
|
|||
|
|
@ -29,8 +29,10 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_getguardsize);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_getinheritsched);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_getschedparam);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_getschedpolicy);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_getscope);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_getstack);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_getstackaddr);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_getstacksize);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_init);
|
||||
|
|
|
|||
|
|
@ -28,13 +28,18 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setcreatesuspend_np);
|
||||
LT10_COMPAT_DEFAULT(pthread_attr_setcreatesuspend_np);
|
||||
|
||||
int _pthread_attr_setcreatesuspend_np(pthread_attr_t *attr);
|
||||
|
||||
__weak_reference(_pthread_attr_setcreatesuspend_np, pthread_attr_setcreatesuspend_np);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setdetachstate);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,11 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setguardsize);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setinheritsched);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setschedparam);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setschedpolicy);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setscope);
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setstack);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setstackaddr);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_attr_setstacksize);
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
|
@ -65,7 +65,7 @@ _pthread_barrier_destroy(pthread_barrier_t *barrier)
|
|||
|
||||
int
|
||||
_pthread_barrier_init(pthread_barrier_t *barrier,
|
||||
const pthread_barrierattr_t *attr, unsigned count)
|
||||
const pthread_barrierattr_t *attr __unused, unsigned count)
|
||||
{
|
||||
pthread_barrier_t bar;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_barrierattr_destroy);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,10 @@
|
|||
* David Leonard <d@openbsd.org>, 1999. Public domain.
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include "namespace.h"
|
||||
#include <sys/errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_cancel);
|
||||
|
|
@ -53,7 +55,7 @@ testcancel(struct pthread *curthread)
|
|||
THR_THREAD_UNLOCK(curthread, curthread);
|
||||
|
||||
_thr_exit_cleanup();
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
_pthread_exit(PTHREAD_CANCELED);
|
||||
PANIC("cancel");
|
||||
}
|
||||
}
|
||||
|
|
@ -214,7 +216,7 @@ _pthread_setcancelstate(int state, int *oldstate)
|
|||
THR_THREAD_UNLOCK(curthread, curthread);
|
||||
if (need_exit != 0) {
|
||||
_thr_exit_cleanup();
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
_pthread_exit(PTHREAD_CANCELED);
|
||||
PANIC("cancel");
|
||||
}
|
||||
if (ret == 0 && oldstate != NULL)
|
||||
|
|
@ -252,7 +254,7 @@ _pthread_setcanceltype(int type, int *oldtype)
|
|||
THR_THREAD_UNLOCK(curthread, curthread);
|
||||
if (need_exit != 0) {
|
||||
_thr_exit_cleanup();
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
_pthread_exit(PTHREAD_CANCELED);
|
||||
PANIC("cancel");
|
||||
}
|
||||
if (ret == 0 && oldtype != NULL)
|
||||
|
|
@ -293,7 +295,7 @@ _thr_cancel_leave(struct pthread *thread, int check)
|
|||
}
|
||||
|
||||
void
|
||||
_thr_finish_cancellation(void *arg)
|
||||
_thr_finish_cancellation(void *arg __unused)
|
||||
{
|
||||
struct pthread *curthread = _get_curthread();
|
||||
|
||||
|
|
@ -305,7 +307,7 @@ _thr_finish_cancellation(void *arg)
|
|||
curthread->cancelflags &= ~THR_CANCEL_NEEDED;
|
||||
THR_THREAD_UNLOCK(curthread, curthread);
|
||||
_thr_exit_cleanup();
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
_pthread_exit(PTHREAD_CANCELED);
|
||||
}
|
||||
THR_THREAD_UNLOCK(curthread, curthread);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_cleanup_push);
|
||||
|
|
|
|||
|
|
@ -28,17 +28,22 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(__close);
|
||||
LT10_COMPAT_DEFAULT(close);
|
||||
|
||||
int __close(int fd);
|
||||
|
||||
__weak_reference(__close, close);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -26,10 +26,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include "un-namespace.h"
|
||||
|
||||
#include "thr_private.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(__pthread_cond_wait);
|
||||
|
|
@ -63,6 +66,10 @@ static void cond_wait_backout(void *);
|
|||
static inline void check_continuation(struct pthread *,
|
||||
struct pthread_cond *, pthread_mutex_t *);
|
||||
|
||||
int __pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
|
||||
int __pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||
const struct timespec *abstime);
|
||||
|
||||
/*
|
||||
* Double underscore versions are cancellation points. Single underscore
|
||||
* versions are not and are provided for libc internal usage (which
|
||||
|
|
@ -197,7 +204,7 @@ _pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
|
|||
* perform the dynamic initialization:
|
||||
*/
|
||||
if (*cond == NULL &&
|
||||
(rval = pthread_cond_init(cond, NULL)) != 0)
|
||||
(rval = _pthread_cond_init(cond, NULL)) != 0)
|
||||
return (rval);
|
||||
|
||||
if (!_kse_isthreaded())
|
||||
|
|
@ -395,7 +402,7 @@ _pthread_cond_timedwait(pthread_cond_t * cond, pthread_mutex_t * mutex,
|
|||
* If the condition variable is statically initialized, perform dynamic
|
||||
* initialization.
|
||||
*/
|
||||
if (*cond == NULL && (rval = pthread_cond_init(cond, NULL)) != 0)
|
||||
if (*cond == NULL && (rval = _pthread_cond_init(cond, NULL)) != 0)
|
||||
return (rval);
|
||||
|
||||
if (!_kse_isthreaded())
|
||||
|
|
@ -596,7 +603,7 @@ _pthread_cond_signal(pthread_cond_t * cond)
|
|||
* If the condition variable is statically initialized, perform dynamic
|
||||
* initialization.
|
||||
*/
|
||||
else if (*cond != NULL || (rval = pthread_cond_init(cond, NULL)) == 0) {
|
||||
else if (*cond != NULL || (rval = _pthread_cond_init(cond, NULL)) == 0) {
|
||||
/* Lock the condition variable structure: */
|
||||
THR_LOCK_ACQUIRE(curthread, &(*cond)->c_lock);
|
||||
|
||||
|
|
@ -665,7 +672,7 @@ _pthread_cond_broadcast(pthread_cond_t * cond)
|
|||
* If the condition variable is statically initialized, perform dynamic
|
||||
* initialization.
|
||||
*/
|
||||
else if (*cond != NULL || (rval = pthread_cond_init(cond, NULL)) == 0) {
|
||||
else if (*cond != NULL || (rval = _pthread_cond_init(cond, NULL)) == 0) {
|
||||
/* Lock the condition variable structure: */
|
||||
THR_LOCK_ACQUIRE(curthread, &(*cond)->c_lock);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,9 +28,12 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_condattr_destroy);
|
||||
|
|
|
|||
|
|
@ -28,10 +28,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_condattr_init);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@
|
|||
#include <errno.h>
|
||||
#include "thr_private.h"
|
||||
|
||||
int _pthread_condattr_getpshared(const pthread_condattr_t *attr, int *pshared);
|
||||
int _pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared);
|
||||
|
||||
__weak_reference(_pthread_condattr_getpshared, pthread_condattr_getpshared);
|
||||
__weak_reference(_pthread_condattr_setpshared, pthread_condattr_setpshared);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ __FBSDID("$FreeBSD$");
|
|||
LT10_COMPAT_PRIVATE(__connect);
|
||||
LT10_COMPAT_DEFAULT(connect);
|
||||
|
||||
int __connect(int fd, const struct sockaddr *name, socklen_t namelen);
|
||||
|
||||
__weak_reference(__connect, connect);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -29,8 +29,10 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(___creat);
|
||||
|
|
@ -38,6 +40,8 @@ LT10_COMPAT_DEFAULT(creat);
|
|||
|
||||
extern int __creat(const char *, mode_t);
|
||||
|
||||
int ___creat(const char *path, mode_t mode);
|
||||
|
||||
__weak_reference(___creat, creat);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -29,6 +29,8 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
@ -38,6 +40,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <machine/reg.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
#include "libc_private.h"
|
||||
|
||||
|
|
@ -334,11 +337,11 @@ free_stack(struct pthread_attr *pattr)
|
|||
}
|
||||
|
||||
static void
|
||||
thread_start(struct pthread *curthread, void *(*start_routine) (void *),
|
||||
thread_start(struct pthread *curthread __unused, void *(*start_routine) (void *),
|
||||
void *arg)
|
||||
{
|
||||
/* Run the current thread's start routine with argument: */
|
||||
pthread_exit(start_routine(arg));
|
||||
_pthread_exit(start_routine(arg));
|
||||
|
||||
/* This point should never be reached. */
|
||||
PANIC("Thread has resumed after exit");
|
||||
|
|
|
|||
|
|
@ -28,10 +28,12 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <machine/atomic.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_detach);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_equal);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,11 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_execve);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -35,6 +37,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_exit);
|
||||
|
|
@ -45,7 +48,7 @@ void _pthread_exit(void *status);
|
|||
__weak_reference(_pthread_exit, pthread_exit);
|
||||
|
||||
void
|
||||
_thr_exit(char *fname, int lineno, char *msg)
|
||||
_thr_exit(const char *fname, int lineno, const char *msg)
|
||||
{
|
||||
|
||||
/* Write an error message to the standard error file descriptor: */
|
||||
|
|
@ -122,7 +125,7 @@ _pthread_exit(void *status)
|
|||
/* Save the return value: */
|
||||
curthread->ret = status;
|
||||
while (curthread->cleanup != NULL) {
|
||||
pthread_cleanup_pop(1);
|
||||
_pthread_cleanup_pop(1);
|
||||
}
|
||||
if (curthread->attr.cleanup_attr != NULL) {
|
||||
curthread->attr.cleanup_attr(curthread->attr.arg_attr);
|
||||
|
|
|
|||
|
|
@ -28,16 +28,19 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include "un-namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(__fcntl);
|
||||
LT10_COMPAT_DEFAULT(fcntl);
|
||||
|
||||
int __fcntl(int fd, int cmd,...);
|
||||
|
||||
__weak_reference(__fcntl, fcntl);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -29,8 +29,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -36,6 +38,7 @@
|
|||
#include <pthread.h>
|
||||
#include <spinlock.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include "un-namespace.h"
|
||||
|
||||
#include "libc_private.h"
|
||||
#include "thr_private.h"
|
||||
|
|
@ -43,6 +46,8 @@
|
|||
LT10_COMPAT_PRIVATE(_fork);
|
||||
LT10_COMPAT_DEFAULT(fork);
|
||||
|
||||
pid_t _fork(void);
|
||||
|
||||
__weak_reference(_fork, fork);
|
||||
|
||||
pid_t
|
||||
|
|
|
|||
|
|
@ -28,13 +28,18 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(__fsync);
|
||||
LT10_COMPAT_DEFAULT(fsync);
|
||||
|
||||
int __fsync(int fd);
|
||||
|
||||
__weak_reference(__fsync, fsync);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -31,8 +31,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_getschedparam);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -35,6 +37,7 @@
|
|||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include <errno.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
#ifndef NELEMENTS
|
||||
|
|
@ -45,12 +48,13 @@ LT10_COMPAT_PRIVATE(_pthread_set_name_np);
|
|||
LT10_COMPAT_DEFAULT(pthread_set_name_np);
|
||||
|
||||
static void dump_thread(int fd, pthread_t pthread, int long_version);
|
||||
void _pthread_set_name_np(pthread_t thread, char *name);
|
||||
|
||||
__weak_reference(_pthread_set_name_np, pthread_set_name_np);
|
||||
|
||||
struct s_thread_info {
|
||||
enum pthread_state state;
|
||||
char *name;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
/* Static variables: */
|
||||
|
|
@ -72,15 +76,15 @@ static const struct s_thread_info thread_info[] = {
|
|||
void
|
||||
_thread_dump_info(void)
|
||||
{
|
||||
char s[512], tmpfile[128];
|
||||
char s[512], tempfile[128];
|
||||
pthread_t pthread;
|
||||
int fd, i;
|
||||
|
||||
for (i = 0; i < 100000; i++) {
|
||||
snprintf(tmpfile, sizeof(tmpfile), "/tmp/pthread.dump.%u.%i",
|
||||
snprintf(tempfile, sizeof(tempfile), "/tmp/pthread.dump.%u.%i",
|
||||
getpid(), i);
|
||||
/* Open the dump file for append and create it if necessary: */
|
||||
if ((fd = __sys_open(tmpfile, O_RDWR | O_CREAT | O_EXCL,
|
||||
if ((fd = __sys_open(tempfile, O_RDWR | O_CREAT | O_EXCL,
|
||||
0666)) < 0) {
|
||||
/* Can't open the dump file. */
|
||||
if (errno == EEXIST)
|
||||
|
|
@ -140,7 +144,7 @@ dump_thread(int fd, pthread_t pthread, int long_version)
|
|||
int i;
|
||||
|
||||
/* Find the state: */
|
||||
for (i = 0; i < NELEMENTS(thread_info) - 1; i++)
|
||||
for (i = 0; i < (int)NELEMENTS(thread_info) - 1; i++)
|
||||
if (thread_info[i].state == pthread->state)
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -370,8 +370,8 @@ init_main_thread(struct pthread *thread)
|
|||
* resource limits, so this stack needs an explicitly mapped
|
||||
* red zone to protect the thread stack that is just beyond.
|
||||
*/
|
||||
if (mmap((void *)_usrstack - _thr_stack_initial -
|
||||
_thr_guard_default, _thr_guard_default, 0, MAP_ANON,
|
||||
if (mmap((void *)((uintptr_t)_usrstack - _thr_stack_initial -
|
||||
_thr_guard_default), _thr_guard_default, 0, MAP_ANON,
|
||||
-1, 0) == MAP_FAILED)
|
||||
PANIC("Cannot allocate red zone for initial thread");
|
||||
|
||||
|
|
@ -384,7 +384,8 @@ init_main_thread(struct pthread *thread)
|
|||
* actually free() it; it just puts it in the free
|
||||
* stack queue for later reuse.
|
||||
*/
|
||||
thread->attr.stackaddr_attr = (void *)_usrstack - _thr_stack_initial;
|
||||
thread->attr.stackaddr_attr = (void *)((uintptr_t)_usrstack -
|
||||
_thr_stack_initial);
|
||||
thread->attr.stacksize_attr = _thr_stack_initial;
|
||||
thread->attr.guardsize_attr = _thr_guard_default;
|
||||
thread->attr.flags |= THR_STACK_USER;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_join);
|
||||
|
|
@ -143,7 +146,7 @@ _pthread_join(pthread_t pthread, void **thread_return)
|
|||
THR_SCHED_UNLOCK(curthread, pthread);
|
||||
_thr_ref_delete(curthread, pthread);
|
||||
}
|
||||
pthread_exit(PTHREAD_CANCELED);
|
||||
_pthread_exit(PTHREAD_CANCELED);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -28,9 +28,12 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_kill);
|
||||
|
|
|
|||
|
|
@ -27,8 +27,10 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include <pthread_np.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_main_np);
|
||||
|
|
@ -46,5 +48,5 @@ _pthread_main_np()
|
|||
if (!_thr_initial)
|
||||
return (-1);
|
||||
else
|
||||
return (pthread_equal(pthread_self(), _thr_initial) ? 1 : 0);
|
||||
return (_pthread_equal(_pthread_self(), _thr_initial) ? 1 : 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,10 +31,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_mutexattr_init);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_mutexattr_setkind_np);
|
||||
|
|
@ -41,6 +44,9 @@ LT10_COMPAT_DEFAULT(pthread_mutexattr_gettype);
|
|||
LT10_COMPAT_PRIVATE(_pthread_mutexattr_settype);
|
||||
LT10_COMPAT_DEFAULT(pthread_mutexattr_settype);
|
||||
|
||||
int _pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
|
||||
int _pthread_mutexattr_getkind_np(pthread_mutexattr_t attr);
|
||||
|
||||
__weak_reference(_pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np);
|
||||
__weak_reference(_pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np);
|
||||
__weak_reference(_pthread_mutexattr_gettype, pthread_mutexattr_gettype);
|
||||
|
|
|
|||
|
|
@ -27,9 +27,16 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int _pthread_mutexattr_getpshared(const pthread_mutexattr_t *attr,
|
||||
int *pshared);
|
||||
int _pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int pshared);
|
||||
|
||||
|
||||
__weak_reference(_pthread_mutexattr_getpshared, pthread_mutexattr_getpshared);
|
||||
__weak_reference(_pthread_mutexattr_setpshared, pthread_mutexattr_setpshared);
|
||||
|
||||
|
|
|
|||
|
|
@ -6,14 +6,18 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(__msync);
|
||||
LT10_COMPAT_DEFAULT(msync);
|
||||
|
||||
int __msync(void *addr, size_t len, int flags);
|
||||
|
||||
__weak_reference(__msync, msync);
|
||||
|
||||
int
|
||||
|
|
@ -32,5 +36,5 @@ __msync(void *addr, size_t len, int flags)
|
|||
ret = __sys_msync(addr, len, flags);
|
||||
_thr_cancel_leave(curthread, 1);
|
||||
|
||||
return ret;
|
||||
return (ret);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,9 +28,11 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include <pthread_np.h>
|
||||
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_multi_np);
|
||||
|
|
@ -47,6 +49,6 @@ _pthread_multi_np()
|
|||
* XXX - Do we want to do this?
|
||||
* __is_threaded = 1;
|
||||
*/
|
||||
pthread_resume_all_np();
|
||||
_pthread_resume_all_np();
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,15 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
#if defined(_PTHREADS_INVARIANTS)
|
||||
|
|
@ -73,7 +76,7 @@
|
|||
*/
|
||||
static struct kse_mailbox *mutex_handoff(struct pthread *,
|
||||
struct pthread_mutex *);
|
||||
static inline int mutex_self_trylock(struct pthread *, pthread_mutex_t);
|
||||
static inline int mutex_self_trylock(pthread_mutex_t);
|
||||
static inline int mutex_self_lock(struct pthread *, pthread_mutex_t);
|
||||
static int mutex_unlock_common(pthread_mutex_t *, int);
|
||||
static void mutex_priority_adjust(struct pthread *, pthread_mutex_t);
|
||||
|
|
@ -84,6 +87,16 @@ static inline void mutex_queue_remove(pthread_mutex_t, pthread_t);
|
|||
static inline void mutex_queue_enq(pthread_mutex_t, pthread_t);
|
||||
static void mutex_lock_backout(void *arg);
|
||||
|
||||
int __pthread_mutex_init(pthread_mutex_t *mutex,
|
||||
const pthread_mutexattr_t *mutex_attr);
|
||||
int __pthread_mutex_trylock(pthread_mutex_t *mutex);
|
||||
int __pthread_mutex_lock(pthread_mutex_t *m);
|
||||
int __pthread_mutex_timedlock(pthread_mutex_t *m,
|
||||
const struct timespec *abs_timeout);
|
||||
int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
|
||||
void *(calloc_cb)(size_t, size_t));
|
||||
|
||||
|
||||
static struct pthread_mutex_attr static_mutex_attr =
|
||||
PTHREAD_MUTEXATTR_STATIC_INITIALIZER;
|
||||
static pthread_mutexattr_t static_mattr = &static_mutex_attr;
|
||||
|
|
@ -328,7 +341,7 @@ init_static(struct pthread *thread, pthread_mutex_t *mutex)
|
|||
THR_LOCK_ACQUIRE(thread, &_mutex_static_lock);
|
||||
|
||||
if (*mutex == NULL)
|
||||
ret = pthread_mutex_init(mutex, NULL);
|
||||
ret = _pthread_mutex_init(mutex, NULL);
|
||||
else
|
||||
ret = 0;
|
||||
|
||||
|
|
@ -345,7 +358,7 @@ init_static_private(struct pthread *thread, pthread_mutex_t *mutex)
|
|||
THR_LOCK_ACQUIRE(thread, &_mutex_static_lock);
|
||||
|
||||
if (*mutex == NULL)
|
||||
ret = pthread_mutex_init(mutex, &static_mattr);
|
||||
ret = _pthread_mutex_init(mutex, &static_mattr);
|
||||
else
|
||||
ret = 0;
|
||||
|
||||
|
|
@ -391,7 +404,7 @@ mutex_trylock_common(struct pthread *curthread, pthread_mutex_t *mutex)
|
|||
TAILQ_INSERT_TAIL(&curthread->mutexq,
|
||||
(*mutex), m_qe);
|
||||
} else if ((*mutex)->m_owner == curthread)
|
||||
ret = mutex_self_trylock(curthread, *mutex);
|
||||
ret = mutex_self_trylock(*mutex);
|
||||
else
|
||||
/* Return a busy error: */
|
||||
ret = EBUSY;
|
||||
|
|
@ -423,7 +436,7 @@ mutex_trylock_common(struct pthread *curthread, pthread_mutex_t *mutex)
|
|||
TAILQ_INSERT_TAIL(&curthread->mutexq,
|
||||
(*mutex), m_qe);
|
||||
} else if ((*mutex)->m_owner == curthread)
|
||||
ret = mutex_self_trylock(curthread, *mutex);
|
||||
ret = mutex_self_trylock(*mutex);
|
||||
else
|
||||
/* Return a busy error: */
|
||||
ret = EBUSY;
|
||||
|
|
@ -460,7 +473,7 @@ mutex_trylock_common(struct pthread *curthread, pthread_mutex_t *mutex)
|
|||
TAILQ_INSERT_TAIL(&curthread->mutexq,
|
||||
(*mutex), m_qe);
|
||||
} else if ((*mutex)->m_owner == curthread)
|
||||
ret = mutex_self_trylock(curthread, *mutex);
|
||||
ret = mutex_self_trylock(*mutex);
|
||||
else
|
||||
/* Return a busy error: */
|
||||
ret = EBUSY;
|
||||
|
|
@ -987,7 +1000,7 @@ _mutex_cv_lock(pthread_mutex_t *m)
|
|||
}
|
||||
|
||||
static inline int
|
||||
mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m)
|
||||
mutex_self_trylock(pthread_mutex_t m)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
|
|
@ -1601,7 +1614,7 @@ _mutex_unlock_private(pthread_t pthread)
|
|||
for (m = TAILQ_FIRST(&pthread->mutexq); m != NULL; m = m_next) {
|
||||
m_next = TAILQ_NEXT(m, m_qe);
|
||||
if ((m->m_flags & MUTEX_FLAGS_PRIVATE) != 0)
|
||||
pthread_mutex_unlock(&m);
|
||||
_pthread_mutex_unlock(&m);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_mutexattr_getprioceiling);
|
||||
|
|
@ -91,10 +94,11 @@ _pthread_mutex_getprioceiling(pthread_mutex_t *mutex,
|
|||
ret = EINVAL;
|
||||
else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
|
||||
ret = EINVAL;
|
||||
else
|
||||
ret = (*mutex)->m_prio;
|
||||
|
||||
return(ret);
|
||||
else {
|
||||
*prioceiling = (*mutex)->m_prio;
|
||||
ret = 0;
|
||||
}
|
||||
return (ret);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -109,13 +113,13 @@ _pthread_mutex_setprioceiling(pthread_mutex_t *mutex,
|
|||
else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
|
||||
ret = EINVAL;
|
||||
/* Lock the mutex: */
|
||||
else if ((ret = pthread_mutex_lock(mutex)) == 0) {
|
||||
else if ((ret = _pthread_mutex_lock(mutex)) == 0) {
|
||||
tmp = (*mutex)->m_prio;
|
||||
/* Set the new ceiling: */
|
||||
(*mutex)->m_prio = prioceiling;
|
||||
|
||||
/* Unlock the mutex: */
|
||||
ret = pthread_mutex_unlock(mutex);
|
||||
ret = _pthread_mutex_unlock(mutex);
|
||||
|
||||
/* Return the old ceiling: */
|
||||
*old_ceiling = tmp;
|
||||
|
|
|
|||
|
|
@ -31,10 +31,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_mutexattr_getprotocol);
|
||||
|
|
|
|||
|
|
@ -28,9 +28,12 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_mutexattr_destroy);
|
||||
|
|
|
|||
|
|
@ -28,11 +28,17 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int __nanosleep(const struct timespec *time_to_sleep,
|
||||
struct timespec *time_remaining);
|
||||
|
||||
LT10_COMPAT_PRIVATE(__nanosleep);
|
||||
LT10_COMPAT_PRIVATE(_nanosleep);
|
||||
LT10_COMPAT_DEFAULT(nanosleep);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
|
|
|
|||
|
|
@ -29,14 +29,19 @@
|
|||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int __open(const char *path, int flags,...);
|
||||
|
||||
LT10_COMPAT_PRIVATE(__open);
|
||||
LT10_COMPAT_DEFAULT(open);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,10 +29,14 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int _pause(void);
|
||||
|
||||
extern int __pause(void);
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pause);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
|
@ -39,11 +41,14 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(__poll);
|
||||
LT10_COMPAT_DEFAULT(poll);
|
||||
|
||||
int __poll(struct pollfd *fds, unsigned int nfds, int timeout);
|
||||
|
||||
__weak_reference(__poll, poll);
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -31,10 +31,13 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <stdlib.h>
|
||||
#include <sys/queue.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
/* Prototypes: */
|
||||
|
|
|
|||
|
|
@ -637,15 +637,18 @@ struct join_status {
|
|||
};
|
||||
|
||||
struct pthread_specific_elem {
|
||||
const void *data;
|
||||
int seqno;
|
||||
void *data;
|
||||
int seqno;
|
||||
};
|
||||
|
||||
typedef void (*const_key_destructor_t)(const void *);
|
||||
typedef void (*key_destructor_t)(void *);
|
||||
|
||||
struct pthread_key {
|
||||
volatile int allocated;
|
||||
volatile int count;
|
||||
int seqno;
|
||||
void (*destructor) (void *);
|
||||
key_destructor_t destructor;
|
||||
};
|
||||
|
||||
#define MAX_THR_LOCKLEVEL 5
|
||||
|
|
@ -867,7 +870,7 @@ struct pthread {
|
|||
|
||||
/* Cleanup handlers Link List */
|
||||
struct pthread_cleanup *cleanup;
|
||||
char *fname; /* Ptr to source file name */
|
||||
const char *fname; /* Ptr to source file name */
|
||||
int lineno; /* Source line number. */
|
||||
};
|
||||
|
||||
|
|
@ -1110,9 +1113,9 @@ SCLASS struct lock _mutex_static_lock;
|
|||
SCLASS struct lock _rwlock_static_lock;
|
||||
SCLASS struct lock _keytable_lock;
|
||||
SCLASS struct lock _thread_list_lock;
|
||||
SCLASS int _thr_guard_default;
|
||||
SCLASS int _thr_stack_default;
|
||||
SCLASS int _thr_stack_initial;
|
||||
SCLASS size_t _thr_guard_default;
|
||||
SCLASS size_t _thr_stack_default;
|
||||
SCLASS size_t _thr_stack_initial;
|
||||
SCLASS int _thr_page_size;
|
||||
SCLASS pthread_t _thr_sig_daemon;
|
||||
SCLASS int _thr_debug_flags SCLASS_PRESET(0);
|
||||
|
|
@ -1173,7 +1176,7 @@ void _pthread_yield(void);
|
|||
void _pthread_cleanup_push(void (*routine) (void *), void *routine_arg);
|
||||
void _pthread_cleanup_pop(int execute);
|
||||
struct pthread *_thr_alloc(struct pthread *);
|
||||
void _thr_exit(char *, int, char *);
|
||||
void _thr_exit(const char *, int, const char *) __dead2;
|
||||
void _thr_exit_cleanup(void);
|
||||
void _thr_lock_wait(struct lock *lock, struct lockuser *lu);
|
||||
void _thr_lock_wakeup(struct lock *lock, struct lockuser *lu);
|
||||
|
|
@ -1201,7 +1204,7 @@ void _thr_sched_switch(struct pthread *);
|
|||
void _thr_sched_switch_unlocked(struct pthread *);
|
||||
void _thr_set_timeout(const struct timespec *);
|
||||
void _thr_seterrno(struct pthread *, int);
|
||||
void _thr_sig_handler(int, siginfo_t *, ucontext_t *);
|
||||
void _thr_sig_handler(int, siginfo_t *, void *);
|
||||
void _thr_sig_check_pending(struct pthread *);
|
||||
void _thr_sig_rundown(struct pthread *, ucontext_t *);
|
||||
void _thr_sig_send(struct pthread *pthread, int sig);
|
||||
|
|
@ -1301,7 +1304,7 @@ ssize_t __sys_read(int, void *, size_t);
|
|||
ssize_t __sys_write(int, const void *, size_t);
|
||||
void __sys_exit(int);
|
||||
int __sys_sigwait(const sigset_t *, int *);
|
||||
int __sys_sigtimedwait(sigset_t *, siginfo_t *, struct timespec *);
|
||||
int __sys_sigtimedwait(const sigset_t *, siginfo_t *, const struct timespec *);
|
||||
#endif
|
||||
|
||||
/* #include <poll.h> */
|
||||
|
|
|
|||
|
|
@ -28,17 +28,21 @@
|
|||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/select.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
|
||||
#include "thr_private.h"
|
||||
|
||||
extern int __pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
|
||||
const struct timespec *timo, const sigset_t *mask);
|
||||
extern int __pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
|
||||
const struct timespec *timo, const sigset_t *mask);
|
||||
|
||||
int _pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
|
||||
const struct timespec *timo, const sigset_t *mask);
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pselect);
|
||||
LT10_COMPAT_DEFAULT(pselect);
|
||||
|
|
|
|||
|
|
@ -26,11 +26,13 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include "un-namespace.h"
|
||||
|
||||
#include "atomic_ops.h"
|
||||
#include "thr_private.h"
|
||||
|
|
@ -106,7 +108,7 @@ _pthread_spin_trylock(pthread_spinlock_t *lock)
|
|||
else if (lck->s_lock != 0)
|
||||
ret = EBUSY;
|
||||
else {
|
||||
atomic_swap_int((int *)&(lck)->s_lock, 1, &oldval);
|
||||
atomic_swap_int(&(lck)->s_lock, 1, &oldval);
|
||||
if (oldval)
|
||||
ret = EBUSY;
|
||||
else {
|
||||
|
|
@ -141,7 +143,7 @@ _pthread_spin_lock(pthread_spinlock_t *lock)
|
|||
_pthread_yield();
|
||||
}
|
||||
}
|
||||
atomic_swap_int((int *)&(lck)->s_lock, 1, &oldval);
|
||||
atomic_swap_int(&(lck)->s_lock, 1, &oldval);
|
||||
} while (oldval);
|
||||
|
||||
lck->s_owner = self;
|
||||
|
|
@ -164,7 +166,7 @@ _pthread_spin_unlock(pthread_spinlock_t *lock)
|
|||
ret = EPERM;
|
||||
else {
|
||||
lck->s_owner = NULL;
|
||||
atomic_swap_int((int *)&lck->s_lock, 0, &ret);
|
||||
atomic_swap_int(&lck->s_lock, 0, &ret);
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,14 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <pthread.h>
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int _raise(int sig);
|
||||
|
||||
LT10_COMPAT_PRIVATE(_raise);
|
||||
LT10_COMPAT_DEFAULT(raise);
|
||||
|
||||
|
|
@ -46,7 +50,7 @@ _raise(int sig)
|
|||
if (!_kse_isthreaded())
|
||||
ret = kill(getpid(), sig);
|
||||
else {
|
||||
ret = pthread_kill(pthread_self(), sig);
|
||||
ret = _pthread_kill(_pthread_self(), sig);
|
||||
if (ret != 0) {
|
||||
errno = ret;
|
||||
ret = -1;
|
||||
|
|
|
|||
|
|
@ -29,14 +29,19 @@
|
|||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
ssize_t __read(int fd, void *buf, size_t nbytes);
|
||||
|
||||
LT10_COMPAT_PRIVATE(__read);
|
||||
LT10_COMPAT_DEFAULT(read);
|
||||
|
||||
|
|
|
|||
|
|
@ -29,14 +29,19 @@
|
|||
* $FreeBSD$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <sys/uio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
ssize_t __readv(int fd, const struct iovec *iov, int iovcnt);
|
||||
|
||||
LT10_COMPAT_PRIVATE(__readv);
|
||||
LT10_COMPAT_DEFAULT(readv);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,10 +28,16 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int _pthread_resume_np(pthread_t thread);
|
||||
void _pthread_resume_all_np(void);
|
||||
|
||||
static struct kse_mailbox *resume_common(struct pthread *);
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_resume_np);
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ _thr_rtld_lock_create(void)
|
|||
}
|
||||
|
||||
static void
|
||||
_thr_rtld_lock_destroy(void *lock)
|
||||
_thr_rtld_lock_destroy(void *lock __unused)
|
||||
{
|
||||
/* XXX We really can not free memory after a fork() */
|
||||
#if 0
|
||||
|
|
@ -268,13 +268,13 @@ _thr_rtld_lock_release(void *lock)
|
|||
|
||||
|
||||
static int
|
||||
_thr_rtld_set_flag(int mask)
|
||||
_thr_rtld_set_flag(int mask __unused)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
_thr_rtld_clr_flag(int mask)
|
||||
_thr_rtld_clr_flag(int mask __unused)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,11 +26,10 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
|
@ -115,7 +114,8 @@ _pthread_rwlock_destroy (pthread_rwlock_t *rwlock)
|
|||
}
|
||||
|
||||
int
|
||||
_pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
|
||||
_pthread_rwlock_init (pthread_rwlock_t *rwlock,
|
||||
const pthread_rwlockattr_t *attr __unused)
|
||||
{
|
||||
pthread_rwlock_t prwlock;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -26,10 +26,11 @@
|
|||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_rwlockattr_destroy);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <poll.h>
|
||||
|
|
@ -38,8 +40,12 @@
|
|||
#include <sys/time.h>
|
||||
#include <sys/fcntl.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int __select(int numfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
|
||||
LT10_COMPAT_PRIVATE(__select);
|
||||
LT10_COMPAT_DEFAULT(select);
|
||||
|
||||
|
|
@ -55,11 +61,11 @@ __select(int numfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
|||
|
||||
if (numfds == 0 && timeout != NULL) {
|
||||
TIMEVAL_TO_TIMESPEC(timeout, &ts);
|
||||
return nanosleep(&ts, NULL);
|
||||
ret = _nanosleep(&ts, NULL);
|
||||
} else {
|
||||
_thr_cancel_enter(curthread);
|
||||
ret = __sys_select(numfds, readfds, writefds, exceptfds, timeout);
|
||||
_thr_cancel_leave(curthread, 1);
|
||||
}
|
||||
return ret;
|
||||
return (ret);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_self);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,10 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
/*
|
||||
|
|
@ -40,6 +43,8 @@
|
|||
#endif
|
||||
extern int errno;
|
||||
|
||||
void _thread_seterrno(pthread_t thread, int error);
|
||||
|
||||
void
|
||||
_thread_seterrno(pthread_t thread, int error)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,9 +28,14 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int _pthread_setprio(pthread_t pthread, int prio);
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_setprio);
|
||||
LT10_COMPAT_DEFAULT(pthread_setprio);
|
||||
|
||||
|
|
@ -42,9 +47,9 @@ _pthread_setprio(pthread_t pthread, int prio)
|
|||
int ret, policy;
|
||||
struct sched_param param;
|
||||
|
||||
if ((ret = pthread_getschedparam(pthread, &policy, ¶m)) == 0) {
|
||||
if ((ret = _pthread_getschedparam(pthread, &policy, ¶m)) == 0) {
|
||||
param.sched_priority = prio;
|
||||
ret = pthread_setschedparam(pthread, policy, ¶m);
|
||||
ret = _pthread_setschedparam(pthread, policy, ¶m);
|
||||
}
|
||||
|
||||
/* Return the error status: */
|
||||
|
|
|
|||
|
|
@ -31,9 +31,12 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <sys/param.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_setschedparam);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signalvar.h>
|
||||
|
|
@ -37,6 +39,7 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
/* Prototypes: */
|
||||
|
|
@ -169,7 +172,7 @@ static int sigproptbl[NSIG] = {
|
|||
#ifndef SYSTEM_SCOPE_ONLY
|
||||
|
||||
static void *
|
||||
sig_daemon(void *arg /* Unused */)
|
||||
sig_daemon(void *arg __unused)
|
||||
{
|
||||
int i;
|
||||
kse_critical_t crit;
|
||||
|
|
@ -224,15 +227,15 @@ _thr_start_sig_daemon(void)
|
|||
sigset_t sigset, oldset;
|
||||
|
||||
SIGFILLSET(sigset);
|
||||
pthread_sigmask(SIG_SETMASK, &sigset, &oldset);
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
||||
_pthread_sigmask(SIG_SETMASK, &sigset, &oldset);
|
||||
_pthread_attr_init(&attr);
|
||||
_pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
|
||||
attr->flags |= THR_SIGNAL_THREAD;
|
||||
/* sigmask will be inherited */
|
||||
if (pthread_create(&_thr_sig_daemon, &attr, sig_daemon, NULL))
|
||||
if (_pthread_create(&_thr_sig_daemon, &attr, sig_daemon, NULL))
|
||||
PANIC("can not create signal daemon thread!\n");
|
||||
pthread_attr_destroy(&attr);
|
||||
pthread_sigmask(SIG_SETMASK, &oldset, NULL);
|
||||
_pthread_attr_destroy(&attr);
|
||||
_pthread_sigmask(SIG_SETMASK, &oldset, NULL);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
@ -296,16 +299,18 @@ typedef void (*ohandler)(int sig, int code,
|
|||
struct sigcontext *scp, char *addr, __sighandler_t *catcher);
|
||||
|
||||
void
|
||||
_thr_sig_handler(int sig, siginfo_t *info, ucontext_t *ucp)
|
||||
_thr_sig_handler(int sig, siginfo_t *info, void *ucp_arg)
|
||||
{
|
||||
struct pthread_sigframe psf;
|
||||
__siginfohandler_t *sigfunc;
|
||||
struct pthread *curthread;
|
||||
struct kse *curkse;
|
||||
ucontext_t *ucp;
|
||||
struct sigaction act;
|
||||
int sa_flags, err_save;
|
||||
|
||||
err_save = errno;
|
||||
ucp = (ucontext_t *)ucp_arg;
|
||||
|
||||
DBG_MSG(">>> _thr_sig_handler(%d)\n", sig);
|
||||
|
||||
|
|
@ -644,7 +649,7 @@ _thr_getprocsig_unlocked(int sig, siginfo_t *siginfo)
|
|||
* with upcalls disabled.
|
||||
*/
|
||||
struct pthread *
|
||||
thr_sig_find(struct kse *curkse, int sig, siginfo_t *info)
|
||||
thr_sig_find(struct kse *curkse, int sig, siginfo_t *info __unused)
|
||||
{
|
||||
struct kse_mailbox *kmbx = NULL;
|
||||
struct pthread *pthread;
|
||||
|
|
|
|||
|
|
@ -28,9 +28,12 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_sigaction);
|
||||
|
|
@ -86,7 +89,7 @@ _sigaction(int sig, const struct sigaction * act, struct sigaction * oact)
|
|||
* Specify the thread kernel signal
|
||||
* handler:
|
||||
*/
|
||||
newact.sa_handler = (void (*) ())_thr_sig_handler;
|
||||
newact.sa_sigaction = _thr_sig_handler;
|
||||
}
|
||||
/*
|
||||
* Install libpthread signal handler wrapper
|
||||
|
|
@ -95,8 +98,7 @@ _sigaction(int sig, const struct sigaction * act, struct sigaction * oact)
|
|||
* SIG_DFL or SIG_IGN.
|
||||
*/
|
||||
if (sig == SIGINFO && _thr_dump_enabled()) {
|
||||
newact.sa_handler =
|
||||
(void (*) ())_thr_sig_handler;
|
||||
newact.sa_sigaction = _thr_sig_handler;
|
||||
}
|
||||
/* Change the signal action in the kernel: */
|
||||
if (__sys_sigaction(sig, &newact, NULL) != 0) {
|
||||
|
|
|
|||
|
|
@ -27,10 +27,14 @@
|
|||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include "namespace.h"
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int _sigaltstack(stack_t *_ss, stack_t *_oss);
|
||||
|
||||
LT10_COMPAT_PRIVATE(_sigaltstack);
|
||||
LT10_COMPAT_DEFAULT(sigaltstack);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signalvar.h>
|
||||
|
|
@ -35,6 +37,7 @@
|
|||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
LT10_COMPAT_PRIVATE(_pthread_sigmask);
|
||||
|
|
|
|||
|
|
@ -31,14 +31,19 @@
|
|||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include "namespace.h"
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include "un-namespace.h"
|
||||
#include "thr_private.h"
|
||||
|
||||
int _sigpending(sigset_t *set);
|
||||
|
||||
LT10_COMPAT_PRIVATE(_sigpending);
|
||||
LT10_COMPAT_DEFAULT(sigpending);
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue