WARNS level 4 cleanup.
This commit is contained in:
parent
9d9b92aaf4
commit
37a6356bbe
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=157457
@ -16,8 +16,8 @@ global:
|
|||||||
__pthread_cond_wait;
|
__pthread_cond_wait;
|
||||||
__pthread_mutex_init;
|
__pthread_mutex_init;
|
||||||
__pthread_mutex_lock;
|
__pthread_mutex_lock;
|
||||||
__pthread_mutex_trylock;
|
|
||||||
__pthread_mutex_timedlock;
|
__pthread_mutex_timedlock;
|
||||||
|
__pthread_mutex_trylock;
|
||||||
__read;
|
__read;
|
||||||
__readv;
|
__readv;
|
||||||
__recvfrom;
|
__recvfrom;
|
||||||
@ -26,6 +26,9 @@ global:
|
|||||||
__sendmsg;
|
__sendmsg;
|
||||||
__sendto;
|
__sendto;
|
||||||
__sigsuspend;
|
__sigsuspend;
|
||||||
|
__sigtimedwait;
|
||||||
|
__sigwait;
|
||||||
|
__sigwaitinfo;
|
||||||
__wait4;
|
__wait4;
|
||||||
__write;
|
__write;
|
||||||
__writev;
|
__writev;
|
||||||
@ -43,7 +46,6 @@ global:
|
|||||||
_pthread_barrierattr_getpshared;
|
_pthread_barrierattr_getpshared;
|
||||||
_pthread_barrierattr_init;
|
_pthread_barrierattr_init;
|
||||||
_pthread_barrierattr_setpshared;
|
_pthread_barrierattr_setpshared;
|
||||||
_pthread_attr_default;
|
|
||||||
_pthread_attr_destroy;
|
_pthread_attr_destroy;
|
||||||
_pthread_attr_get_np;
|
_pthread_attr_get_np;
|
||||||
_pthread_attr_getdetachstate;
|
_pthread_attr_getdetachstate;
|
||||||
@ -75,7 +77,6 @@ global:
|
|||||||
_pthread_cond_signal;
|
_pthread_cond_signal;
|
||||||
_pthread_cond_timedwait;
|
_pthread_cond_timedwait;
|
||||||
_pthread_cond_wait;
|
_pthread_cond_wait;
|
||||||
_pthread_condattr_default;
|
|
||||||
_pthread_condattr_destroy;
|
_pthread_condattr_destroy;
|
||||||
_pthread_condattr_getclock;
|
_pthread_condattr_getclock;
|
||||||
_pthread_condattr_getpshared;
|
_pthread_condattr_getpshared;
|
||||||
@ -104,7 +105,6 @@ global:
|
|||||||
_pthread_mutex_timedlock;
|
_pthread_mutex_timedlock;
|
||||||
_pthread_mutex_trylock;
|
_pthread_mutex_trylock;
|
||||||
_pthread_mutex_unlock;
|
_pthread_mutex_unlock;
|
||||||
_pthread_mutexattr_default;
|
|
||||||
_pthread_mutexattr_destroy;
|
_pthread_mutexattr_destroy;
|
||||||
_pthread_mutexattr_getkind_np;
|
_pthread_mutexattr_getkind_np;
|
||||||
_pthread_mutexattr_getprioceiling;
|
_pthread_mutexattr_getprioceiling;
|
||||||
@ -156,21 +156,18 @@ global:
|
|||||||
_pthread_timedjoin_np;
|
_pthread_timedjoin_np;
|
||||||
_pthread_yield;
|
_pthread_yield;
|
||||||
_raise;
|
_raise;
|
||||||
_sem_close;
|
|
||||||
_sem_destroy;
|
_sem_destroy;
|
||||||
_sem_getvalue;
|
_sem_getvalue;
|
||||||
_sem_init;
|
_sem_init;
|
||||||
_sem_open;
|
|
||||||
_sem_post;
|
_sem_post;
|
||||||
_sem_timedwait;
|
_sem_timedwait;
|
||||||
_sem_trywait;
|
_sem_trywait;
|
||||||
_sem_unlink;
|
|
||||||
_sem_wait;
|
_sem_wait;
|
||||||
_sigaction;
|
_sigaction;
|
||||||
_sigprocmask;
|
_sigprocmask;
|
||||||
_sigsuspend;
|
_sigsuspend;
|
||||||
_sigwait;
|
|
||||||
_sigtimedwait;
|
_sigtimedwait;
|
||||||
|
_sigwait;
|
||||||
_sigwaitinfo;
|
_sigwaitinfo;
|
||||||
_sleep;
|
_sleep;
|
||||||
_spinlock;
|
_spinlock;
|
||||||
@ -181,7 +178,10 @@ global:
|
|||||||
_usleep;
|
_usleep;
|
||||||
_vfork;
|
_vfork;
|
||||||
_wait;
|
_wait;
|
||||||
|
_wait4;
|
||||||
_waitpid;
|
_waitpid;
|
||||||
|
_write;
|
||||||
|
_writev;
|
||||||
accept;
|
accept;
|
||||||
aio_suspend;
|
aio_suspend;
|
||||||
close;
|
close;
|
||||||
@ -320,21 +320,16 @@ global:
|
|||||||
recvfrom;
|
recvfrom;
|
||||||
recvmsg;
|
recvmsg;
|
||||||
select;
|
select;
|
||||||
sem_close;
|
|
||||||
sem_destroy;
|
sem_destroy;
|
||||||
sem_getvalue;
|
sem_getvalue;
|
||||||
sem_init;
|
sem_init;
|
||||||
sem_open;
|
|
||||||
sem_post;
|
sem_post;
|
||||||
sem_timedwait;
|
sem_timedwait;
|
||||||
sem_trywait;
|
sem_trywait;
|
||||||
sem_unlink;
|
|
||||||
sem_wait;
|
sem_wait;
|
||||||
sendmsg;
|
sendmsg;
|
||||||
sendto;
|
sendto;
|
||||||
sigaction;
|
sigaction;
|
||||||
sigaltstack;
|
|
||||||
sigpending;
|
|
||||||
sigprocmask;
|
sigprocmask;
|
||||||
sigsuspend;
|
sigsuspend;
|
||||||
sigwait;
|
sigwait;
|
||||||
|
@ -39,7 +39,6 @@ SRCS+= \
|
|||||||
thr_rwlockattr.c \
|
thr_rwlockattr.c \
|
||||||
thr_self.c \
|
thr_self.c \
|
||||||
thr_sem.c \
|
thr_sem.c \
|
||||||
thr_seterrno.c \
|
|
||||||
thr_setprio.c \
|
thr_setprio.c \
|
||||||
thr_setschedparam.c \
|
thr_setschedparam.c \
|
||||||
thr_sig.c \
|
thr_sig.c \
|
||||||
|
@ -96,11 +96,13 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -26,9 +26,11 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
@ -54,10 +56,12 @@ _pthread_barrier_destroy(pthread_barrier_t *barrier)
|
|||||||
|
|
||||||
int
|
int
|
||||||
_pthread_barrier_init(pthread_barrier_t *barrier,
|
_pthread_barrier_init(pthread_barrier_t *barrier,
|
||||||
const pthread_barrierattr_t *attr, int count)
|
const pthread_barrierattr_t *attr, unsigned count)
|
||||||
{
|
{
|
||||||
pthread_barrier_t bar;
|
pthread_barrier_t bar;
|
||||||
|
|
||||||
|
(void)attr;
|
||||||
|
|
||||||
if (barrier == NULL || count <= 0)
|
if (barrier == NULL || count <= 0)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
|
@ -28,9 +28,11 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -27,7 +27,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
@ -36,8 +38,6 @@ __weak_reference(_pthread_setcancelstate, pthread_setcancelstate);
|
|||||||
__weak_reference(_pthread_setcanceltype, pthread_setcanceltype);
|
__weak_reference(_pthread_setcanceltype, pthread_setcanceltype);
|
||||||
__weak_reference(_pthread_testcancel, pthread_testcancel);
|
__weak_reference(_pthread_testcancel, pthread_testcancel);
|
||||||
|
|
||||||
int _pthread_setcanceltype(int type, int *oldtype);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
_pthread_cancel(pthread_t pthread)
|
_pthread_cancel(pthread_t pthread)
|
||||||
{
|
{
|
||||||
@ -78,7 +78,7 @@ testcancel(struct pthread *curthread)
|
|||||||
|
|
||||||
newval = curthread->cancelflags;
|
newval = curthread->cancelflags;
|
||||||
if (SHOULD_CANCEL(newval) && !THR_IN_CRITICAL(curthread))
|
if (SHOULD_CANCEL(newval) && !THR_IN_CRITICAL(curthread))
|
||||||
pthread_exit(PTHREAD_CANCELED);
|
_pthread_exit(PTHREAD_CANCELED);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -32,10 +32,12 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -32,8 +32,10 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -26,17 +26,22 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prototypes
|
* Prototypes
|
||||||
*/
|
*/
|
||||||
|
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);
|
||||||
static int cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
|
static int cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
|
||||||
static int cond_wait_common(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
static int cond_wait_common(pthread_cond_t *cond, pthread_mutex_t *mutex,
|
||||||
const struct timespec *abstime, int cancel);
|
const struct timespec *abstime, int cancel);
|
||||||
|
@ -32,10 +32,12 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/signalvar.h>
|
#include <sys/signalvar.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -34,6 +35,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
@ -242,7 +244,7 @@ thread_start(struct pthread *curthread)
|
|||||||
THR_UNLOCK(curthread);
|
THR_UNLOCK(curthread);
|
||||||
|
|
||||||
/* Run the current thread's start routine with argument: */
|
/* Run the current thread's start routine with argument: */
|
||||||
pthread_exit(curthread->start_routine(curthread->arg));
|
_pthread_exit(curthread->start_routine(curthread->arg));
|
||||||
|
|
||||||
/* This point should never be reached. */
|
/* This point should never be reached. */
|
||||||
PANIC("Thread has resumed after exit");
|
PANIC("Thread has resumed after exit");
|
||||||
|
@ -28,9 +28,11 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -31,7 +31,9 @@
|
|||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
#include "namespace.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
__weak_reference(_pthread_equal, pthread_equal);
|
__weak_reference(_pthread_equal, pthread_equal);
|
||||||
|
@ -44,7 +44,7 @@ void _pthread_exit(void *status);
|
|||||||
__weak_reference(_pthread_exit, pthread_exit);
|
__weak_reference(_pthread_exit, pthread_exit);
|
||||||
|
|
||||||
void
|
void
|
||||||
_thread_exit(char *fname, int lineno, char *msg)
|
_thread_exit(const char *fname, int lineno, const char *msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Write an error message to the standard error file descriptor: */
|
/* Write an error message to the standard error file descriptor: */
|
||||||
@ -105,9 +105,7 @@ _pthread_exit(void *status)
|
|||||||
while (curthread->cleanup != NULL) {
|
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);
|
|
||||||
}
|
|
||||||
/* Check if there is thread specific data: */
|
/* Check if there is thread specific data: */
|
||||||
if (curthread->specific != NULL) {
|
if (curthread->specific != NULL) {
|
||||||
/* Run the thread-specific data destructors: */
|
/* Run the thread-specific data destructors: */
|
||||||
|
@ -60,12 +60,14 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <spinlock.h>
|
#include <spinlock.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "libc_private.h"
|
#include "libc_private.h"
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
@ -96,6 +98,8 @@ _pthread_atfork(void (*prepare)(void), void (*parent)(void),
|
|||||||
|
|
||||||
__weak_reference(_fork, fork);
|
__weak_reference(_fork, fork);
|
||||||
|
|
||||||
|
pid_t _fork(void);
|
||||||
|
|
||||||
pid_t
|
pid_t
|
||||||
_fork(void)
|
_fork(void)
|
||||||
{
|
{
|
||||||
|
@ -31,8 +31,10 @@
|
|||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
__weak_reference(_pthread_getprio, pthread_getprio);
|
__weak_reference(_pthread_getprio, pthread_getprio);
|
||||||
@ -43,7 +45,7 @@ _pthread_getprio(pthread_t pthread)
|
|||||||
int policy, ret;
|
int policy, ret;
|
||||||
struct sched_param param;
|
struct sched_param param;
|
||||||
|
|
||||||
if ((ret = pthread_getschedparam(pthread, &policy, ¶m)) == 0)
|
if ((ret = _pthread_getschedparam(pthread, &policy, ¶m)) == 0)
|
||||||
ret = param.sched_priority;
|
ret = param.sched_priority;
|
||||||
else {
|
else {
|
||||||
/* Invalid thread: */
|
/* Invalid thread: */
|
||||||
|
@ -32,8 +32,10 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -32,9 +32,12 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include "namespace.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <pthread_np.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
@ -42,7 +45,7 @@ __weak_reference(_pthread_set_name_np, pthread_set_name_np);
|
|||||||
|
|
||||||
/* Set the thread name for debug. */
|
/* Set the thread name for debug. */
|
||||||
void
|
void
|
||||||
_pthread_set_name_np(pthread_t thread, char *name)
|
_pthread_set_name_np(pthread_t thread, const char *name)
|
||||||
{
|
{
|
||||||
struct pthread *curthread = _get_curthread();
|
struct pthread *curthread = _get_curthread();
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -55,7 +55,7 @@
|
|||||||
#include "libc_private.h"
|
#include "libc_private.h"
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
void *_usrstack;
|
char *_usrstack;
|
||||||
struct pthread *_thr_initial;
|
struct pthread *_thr_initial;
|
||||||
int _thr_scope_system;
|
int _thr_scope_system;
|
||||||
int _libthr_debug;
|
int _libthr_debug;
|
||||||
@ -75,7 +75,6 @@ struct pthread_attr _pthread_attr_default = {
|
|||||||
.suspend = THR_CREATE_RUNNING,
|
.suspend = THR_CREATE_RUNNING,
|
||||||
.flags = PTHREAD_SCOPE_SYSTEM,
|
.flags = PTHREAD_SCOPE_SYSTEM,
|
||||||
.arg_attr = NULL,
|
.arg_attr = NULL,
|
||||||
.cleanup_attr = NULL,
|
|
||||||
.stackaddr_attr = NULL,
|
.stackaddr_attr = NULL,
|
||||||
.stacksize_attr = THR_STACK_DEFAULT,
|
.stacksize_attr = THR_STACK_DEFAULT,
|
||||||
.guardsize_attr = 0
|
.guardsize_attr = 0
|
||||||
@ -95,9 +94,9 @@ struct pthread_cond_attr _pthread_condattr_default = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pid_t _thr_pid;
|
pid_t _thr_pid;
|
||||||
int _thr_guard_default;
|
size_t _thr_guard_default;
|
||||||
int _thr_stack_default = THR_STACK_DEFAULT;
|
size_t _thr_stack_default = THR_STACK_DEFAULT;
|
||||||
int _thr_stack_initial = THR_STACK_INITIAL;
|
size_t _thr_stack_initial = THR_STACK_INITIAL;
|
||||||
int _thr_page_size;
|
int _thr_page_size;
|
||||||
int _gc_count;
|
int _gc_count;
|
||||||
umtx_t _mutex_static_lock;
|
umtx_t _mutex_static_lock;
|
||||||
@ -120,26 +119,10 @@ static void init_main_thread(struct pthread *thread);
|
|||||||
* This is so that static libraries will work.
|
* This is so that static libraries will work.
|
||||||
*/
|
*/
|
||||||
STATIC_LIB_REQUIRE(_accept);
|
STATIC_LIB_REQUIRE(_accept);
|
||||||
STATIC_LIB_REQUIRE(_bind);
|
|
||||||
STATIC_LIB_REQUIRE(_close);
|
STATIC_LIB_REQUIRE(_close);
|
||||||
STATIC_LIB_REQUIRE(_connect);
|
STATIC_LIB_REQUIRE(_connect);
|
||||||
STATIC_LIB_REQUIRE(_dup);
|
|
||||||
STATIC_LIB_REQUIRE(_dup2);
|
|
||||||
STATIC_LIB_REQUIRE(_execve);
|
|
||||||
STATIC_LIB_REQUIRE(_fcntl);
|
STATIC_LIB_REQUIRE(_fcntl);
|
||||||
STATIC_LIB_REQUIRE(_flock);
|
|
||||||
STATIC_LIB_REQUIRE(_flockfile);
|
|
||||||
STATIC_LIB_REQUIRE(_fstat);
|
|
||||||
STATIC_LIB_REQUIRE(_fstatfs);
|
|
||||||
STATIC_LIB_REQUIRE(_fsync);
|
STATIC_LIB_REQUIRE(_fsync);
|
||||||
STATIC_LIB_REQUIRE(_getdirentries);
|
|
||||||
STATIC_LIB_REQUIRE(_getlogin);
|
|
||||||
STATIC_LIB_REQUIRE(_getpeername);
|
|
||||||
STATIC_LIB_REQUIRE(_getsockname);
|
|
||||||
STATIC_LIB_REQUIRE(_getsockopt);
|
|
||||||
STATIC_LIB_REQUIRE(_ioctl);
|
|
||||||
STATIC_LIB_REQUIRE(_kevent);
|
|
||||||
STATIC_LIB_REQUIRE(_listen);
|
|
||||||
STATIC_LIB_REQUIRE(_nanosleep);
|
STATIC_LIB_REQUIRE(_nanosleep);
|
||||||
STATIC_LIB_REQUIRE(_open);
|
STATIC_LIB_REQUIRE(_open);
|
||||||
STATIC_LIB_REQUIRE(_pthread_getspecific);
|
STATIC_LIB_REQUIRE(_pthread_getspecific);
|
||||||
@ -162,7 +145,6 @@ STATIC_LIB_REQUIRE(_recvmsg);
|
|||||||
STATIC_LIB_REQUIRE(_select);
|
STATIC_LIB_REQUIRE(_select);
|
||||||
STATIC_LIB_REQUIRE(_sendmsg);
|
STATIC_LIB_REQUIRE(_sendmsg);
|
||||||
STATIC_LIB_REQUIRE(_sendto);
|
STATIC_LIB_REQUIRE(_sendto);
|
||||||
STATIC_LIB_REQUIRE(_setsockopt);
|
|
||||||
STATIC_LIB_REQUIRE(_sigaction);
|
STATIC_LIB_REQUIRE(_sigaction);
|
||||||
STATIC_LIB_REQUIRE(_sigprocmask);
|
STATIC_LIB_REQUIRE(_sigprocmask);
|
||||||
STATIC_LIB_REQUIRE(_sigsuspend);
|
STATIC_LIB_REQUIRE(_sigsuspend);
|
||||||
@ -332,7 +314,7 @@ _libpthread_init(struct pthread *curthread)
|
|||||||
PANIC("Can't open console");
|
PANIC("Can't open console");
|
||||||
if (setlogin("root") == -1)
|
if (setlogin("root") == -1)
|
||||||
PANIC("Can't set login to root");
|
PANIC("Can't set login to root");
|
||||||
if (__sys_ioctl(fd, TIOCSCTTY, (char *) NULL) == -1)
|
if (_ioctl(fd, TIOCSCTTY, (char *) NULL) == -1)
|
||||||
PANIC("Can't set controlling terminal");
|
PANIC("Can't set controlling terminal");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -389,7 +371,7 @@ init_main_thread(struct pthread *thread)
|
|||||||
* resource limits, so this stack needs an explicitly mapped
|
* resource limits, so this stack needs an explicitly mapped
|
||||||
* red zone to protect the thread stack that is just beyond.
|
* red zone to protect the thread stack that is just beyond.
|
||||||
*/
|
*/
|
||||||
if (mmap((void *)_usrstack - _thr_stack_initial -
|
if (mmap(_usrstack - _thr_stack_initial -
|
||||||
_thr_guard_default, _thr_guard_default, 0, MAP_ANON,
|
_thr_guard_default, _thr_guard_default, 0, MAP_ANON,
|
||||||
-1, 0) == MAP_FAILED)
|
-1, 0) == MAP_FAILED)
|
||||||
PANIC("Cannot allocate red zone for initial thread");
|
PANIC("Cannot allocate red zone for initial thread");
|
||||||
@ -403,7 +385,7 @@ init_main_thread(struct pthread *thread)
|
|||||||
* actually free() it; it just puts it in the free
|
* actually free() it; it just puts it in the free
|
||||||
* stack queue for later reuse.
|
* stack queue for later reuse.
|
||||||
*/
|
*/
|
||||||
thread->attr.stackaddr_attr = (void *)_usrstack - _thr_stack_initial;
|
thread->attr.stackaddr_attr = _usrstack - _thr_stack_initial;
|
||||||
thread->attr.stacksize_attr = _thr_stack_initial;
|
thread->attr.stacksize_attr = _thr_stack_initial;
|
||||||
thread->attr.guardsize_attr = _thr_guard_default;
|
thread->attr.guardsize_attr = _thr_guard_default;
|
||||||
thread->attr.flags |= THR_STACK_USER;
|
thread->attr.flags |= THR_STACK_USER;
|
||||||
|
@ -27,11 +27,15 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
int _pthread_timedjoin_np(pthread_t pthread, void **thread_return,
|
||||||
|
const struct timespec *abstime);
|
||||||
static int join_common(pthread_t, void **, const struct timespec *);
|
static int join_common(pthread_t, void **, const struct timespec *);
|
||||||
|
|
||||||
__weak_reference(_pthread_join, pthread_join);
|
__weak_reference(_pthread_join, pthread_join);
|
||||||
|
@ -32,9 +32,11 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -310,7 +310,8 @@ _thr_ref_delete(struct pthread *curthread, struct pthread *thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_thr_ref_delete_unlocked(struct pthread *curthread, struct pthread *thread)
|
_thr_ref_delete_unlocked(struct pthread *curthread __unused,
|
||||||
|
struct pthread *thread)
|
||||||
{
|
{
|
||||||
if (thread != NULL) {
|
if (thread != NULL) {
|
||||||
thread->refcount--;
|
thread->refcount--;
|
||||||
@ -321,7 +322,7 @@ _thr_ref_delete_unlocked(struct pthread *curthread, struct pthread *thread)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_thr_find_thread(struct pthread *curthread, struct pthread *thread,
|
_thr_find_thread(struct pthread *curthread __unused, struct pthread *thread,
|
||||||
int include_dead)
|
int include_dead)
|
||||||
{
|
{
|
||||||
struct pthread *pthread;
|
struct pthread *pthread;
|
||||||
|
@ -27,8 +27,10 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
@ -44,5 +46,5 @@ _pthread_main_np()
|
|||||||
if (!_thr_initial)
|
if (!_thr_initial)
|
||||||
return (-1);
|
return (-1);
|
||||||
else
|
else
|
||||||
return (pthread_equal(pthread_self(), _thr_initial) ? 1 : 0);
|
return (_pthread_equal(_pthread_self(), _thr_initial) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,11 @@
|
|||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
__weak_reference(_pthread_multi_np, pthread_multi_np);
|
__weak_reference(_pthread_multi_np, pthread_multi_np);
|
||||||
|
|
||||||
@ -45,6 +48,6 @@ _pthread_multi_np()
|
|||||||
* XXX - Do we want to do this?
|
* XXX - Do we want to do this?
|
||||||
* __is_threaded = 1;
|
* __is_threaded = 1;
|
||||||
*/
|
*/
|
||||||
pthread_resume_all_np();
|
_pthread_resume_all_np();
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -33,12 +33,15 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/queue.h>
|
#include <sys/queue.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
#if defined(_PTHREADS_INVARIANTS)
|
#if defined(_PTHREADS_INVARIANTS)
|
||||||
@ -64,8 +67,15 @@
|
|||||||
/*
|
/*
|
||||||
* Prototypes
|
* Prototypes
|
||||||
*/
|
*/
|
||||||
static int mutex_self_trylock(struct pthread *, pthread_mutex_t);
|
int __pthread_mutex_init(pthread_mutex_t *mutex,
|
||||||
static int mutex_self_lock(struct pthread *, pthread_mutex_t,
|
const pthread_mutexattr_t *mutex_attr);
|
||||||
|
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);
|
||||||
|
|
||||||
|
static int mutex_self_trylock(pthread_mutex_t);
|
||||||
|
static int mutex_self_lock(pthread_mutex_t,
|
||||||
const struct timespec *abstime);
|
const struct timespec *abstime);
|
||||||
static int mutex_unlock_common(pthread_mutex_t *, int);
|
static int mutex_unlock_common(pthread_mutex_t *, int);
|
||||||
|
|
||||||
@ -265,7 +275,7 @@ mutex_trylock_common(struct pthread *curthread, pthread_mutex_t *mutex)
|
|||||||
MUTEX_ASSERT_NOT_OWNED(m);
|
MUTEX_ASSERT_NOT_OWNED(m);
|
||||||
TAILQ_INSERT_TAIL(&curthread->mutexq, m, m_qe);
|
TAILQ_INSERT_TAIL(&curthread->mutexq, m, m_qe);
|
||||||
} else if (m->m_owner == curthread) {
|
} else if (m->m_owner == curthread) {
|
||||||
ret = mutex_self_trylock(curthread, m);
|
ret = mutex_self_trylock(m);
|
||||||
} /* else {} */
|
} /* else {} */
|
||||||
|
|
||||||
return (ret);
|
return (ret);
|
||||||
@ -321,7 +331,7 @@ mutex_lock_common(struct pthread *curthread, pthread_mutex_t *mutex,
|
|||||||
MUTEX_ASSERT_NOT_OWNED(m);
|
MUTEX_ASSERT_NOT_OWNED(m);
|
||||||
TAILQ_INSERT_TAIL(&curthread->mutexq, m, m_qe);
|
TAILQ_INSERT_TAIL(&curthread->mutexq, m, m_qe);
|
||||||
} else if (m->m_owner == curthread) {
|
} else if (m->m_owner == curthread) {
|
||||||
ret = mutex_self_lock(curthread, m, abstime);
|
ret = mutex_self_lock(m, abstime);
|
||||||
} else {
|
} else {
|
||||||
if (abstime == NULL) {
|
if (abstime == NULL) {
|
||||||
THR_UMTX_LOCK(curthread, &m->m_lock);
|
THR_UMTX_LOCK(curthread, &m->m_lock);
|
||||||
@ -461,7 +471,7 @@ _mutex_cv_lock(pthread_mutex_t *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m)
|
mutex_self_trylock(pthread_mutex_t m)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -489,8 +499,7 @@ mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
mutex_self_lock(struct pthread *curthread, pthread_mutex_t m,
|
mutex_self_lock(pthread_mutex_t m, const struct timespec *abstime)
|
||||||
const struct timespec *abstime)
|
|
||||||
{
|
{
|
||||||
struct timespec ts1, ts2;
|
struct timespec ts1, ts2;
|
||||||
int ret;
|
int ret;
|
||||||
@ -607,8 +616,10 @@ _pthread_mutex_getprioceiling(pthread_mutex_t *mutex,
|
|||||||
ret = EINVAL;
|
ret = EINVAL;
|
||||||
else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
|
else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
|
||||||
ret = EINVAL;
|
ret = EINVAL;
|
||||||
else
|
else {
|
||||||
ret = (*mutex)->m_prio;
|
*prioceiling = (*mutex)->m_prio;
|
||||||
|
ret = 0;
|
||||||
|
}
|
||||||
|
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
@ -624,10 +635,10 @@ _pthread_mutex_setprioceiling(pthread_mutex_t *mutex,
|
|||||||
ret = EINVAL;
|
ret = EINVAL;
|
||||||
else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
|
else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
|
||||||
ret = EINVAL;
|
ret = EINVAL;
|
||||||
else if ((ret = pthread_mutex_lock(mutex)) == 0) {
|
else if ((ret = _pthread_mutex_lock(mutex)) == 0) {
|
||||||
tmp = (*mutex)->m_prio;
|
tmp = (*mutex)->m_prio;
|
||||||
(*mutex)->m_prio = prioceiling;
|
(*mutex)->m_prio = prioceiling;
|
||||||
ret = pthread_mutex_unlock(mutex);
|
ret = _pthread_mutex_unlock(mutex);
|
||||||
|
|
||||||
/* Return the old ceiling. */
|
/* Return the old ceiling. */
|
||||||
*old_ceiling = tmp;
|
*old_ceiling = tmp;
|
||||||
|
@ -65,10 +65,14 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <pthread_np.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
__weak_reference(_pthread_mutexattr_init, pthread_mutexattr_init);
|
__weak_reference(_pthread_mutexattr_init, pthread_mutexattr_init);
|
||||||
|
@ -45,7 +45,6 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sched.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
#include <sys/thr.h>
|
#include <sys/thr.h>
|
||||||
@ -203,7 +202,7 @@ struct pthread_spinlock {
|
|||||||
*/
|
*/
|
||||||
struct pthread_cleanup {
|
struct pthread_cleanup {
|
||||||
struct pthread_cleanup *next;
|
struct pthread_cleanup *next;
|
||||||
void (*routine)();
|
void (*routine)(void *args);
|
||||||
void *routine_arg;
|
void *routine_arg;
|
||||||
int onstack;
|
int onstack;
|
||||||
};
|
};
|
||||||
@ -239,7 +238,6 @@ struct pthread_attr {
|
|||||||
#define THR_STACK_USER 0x100 /* 0xFF reserved for <pthread.h> */
|
#define THR_STACK_USER 0x100 /* 0xFF reserved for <pthread.h> */
|
||||||
int flags;
|
int flags;
|
||||||
void *arg_attr;
|
void *arg_attr;
|
||||||
void (*cleanup_attr)();
|
|
||||||
void *stackaddr_attr;
|
void *stackaddr_attr;
|
||||||
size_t stacksize_attr;
|
size_t stacksize_attr;
|
||||||
size_t guardsize_attr;
|
size_t guardsize_attr;
|
||||||
@ -596,7 +594,7 @@ extern int __isthreaded;
|
|||||||
* Global variables for the pthread kernel.
|
* Global variables for the pthread kernel.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern void *_usrstack __hidden;
|
extern char *_usrstack __hidden;
|
||||||
extern struct pthread *_thr_initial __hidden;
|
extern struct pthread *_thr_initial __hidden;
|
||||||
extern int _thr_scope_system __hidden;
|
extern int _thr_scope_system __hidden;
|
||||||
|
|
||||||
@ -625,9 +623,9 @@ extern struct pthread_mutex_attr _pthread_mutexattr_default __hidden;
|
|||||||
extern struct pthread_cond_attr _pthread_condattr_default __hidden;
|
extern struct pthread_cond_attr _pthread_condattr_default __hidden;
|
||||||
|
|
||||||
extern pid_t _thr_pid __hidden;
|
extern pid_t _thr_pid __hidden;
|
||||||
extern int _thr_guard_default __hidden;
|
extern size_t _thr_guard_default __hidden;
|
||||||
extern int _thr_stack_default __hidden;
|
extern size_t _thr_stack_default __hidden;
|
||||||
extern int _thr_stack_initial __hidden;
|
extern size_t _thr_stack_initial __hidden;
|
||||||
extern int _thr_page_size __hidden;
|
extern int _thr_page_size __hidden;
|
||||||
/* Garbage thread count. */
|
/* Garbage thread count. */
|
||||||
extern int _gc_count __hidden;
|
extern int _gc_count __hidden;
|
||||||
@ -650,37 +648,8 @@ int _mutex_reinit(pthread_mutex_t *) __hidden;
|
|||||||
void _mutex_fork(struct pthread *curthread) __hidden;
|
void _mutex_fork(struct pthread *curthread) __hidden;
|
||||||
void _mutex_unlock_private(struct pthread *) __hidden;
|
void _mutex_unlock_private(struct pthread *) __hidden;
|
||||||
void _libpthread_init(struct pthread *) __hidden;
|
void _libpthread_init(struct pthread *) __hidden;
|
||||||
void *_pthread_getspecific(pthread_key_t);
|
|
||||||
int _pthread_cond_init(pthread_cond_t *, const pthread_condattr_t *);
|
|
||||||
int _pthread_cond_destroy(pthread_cond_t *);
|
|
||||||
int _pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
|
|
||||||
int _pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *,
|
|
||||||
const struct timespec *);
|
|
||||||
int _pthread_cond_signal(pthread_cond_t *);
|
|
||||||
int _pthread_cond_broadcast(pthread_cond_t *);
|
|
||||||
int _pthread_create(pthread_t * thread, const pthread_attr_t * attr,
|
|
||||||
void *(*start_routine) (void *), void *arg);
|
|
||||||
int _pthread_key_create(pthread_key_t *, void (*) (void *));
|
|
||||||
int _pthread_key_delete(pthread_key_t);
|
|
||||||
int _pthread_mutex_destroy(pthread_mutex_t *);
|
|
||||||
int _pthread_mutex_init(pthread_mutex_t *, const pthread_mutexattr_t *);
|
|
||||||
int _pthread_mutex_lock(pthread_mutex_t *);
|
|
||||||
int _pthread_mutex_trylock(pthread_mutex_t *);
|
|
||||||
int _pthread_mutex_unlock(pthread_mutex_t *);
|
|
||||||
int _pthread_mutexattr_init(pthread_mutexattr_t *);
|
|
||||||
int _pthread_mutexattr_destroy(pthread_mutexattr_t *);
|
|
||||||
int _pthread_mutexattr_settype(pthread_mutexattr_t *, int);
|
|
||||||
int _pthread_once(pthread_once_t *, void (*) (void));
|
|
||||||
int _pthread_rwlock_init(pthread_rwlock_t *, const pthread_rwlockattr_t *);
|
|
||||||
int _pthread_rwlock_destroy (pthread_rwlock_t *);
|
|
||||||
struct pthread *_pthread_self(void);
|
|
||||||
int _pthread_setspecific(pthread_key_t, const void *);
|
|
||||||
void _pthread_testcancel(void);
|
|
||||||
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 *) __hidden;
|
struct pthread *_thr_alloc(struct pthread *) __hidden;
|
||||||
void _thread_exit(char *, int, char *) __hidden __dead2;
|
void _thread_exit(const char *, int, const char *) __hidden __dead2;
|
||||||
void _thr_exit_cleanup(void) __hidden;
|
void _thr_exit_cleanup(void) __hidden;
|
||||||
int _thr_ref_add(struct pthread *, struct pthread *, int) __hidden;
|
int _thr_ref_add(struct pthread *, struct pthread *, int) __hidden;
|
||||||
void _thr_ref_delete(struct pthread *, struct pthread *) __hidden;
|
void _thr_ref_delete(struct pthread *, struct pthread *) __hidden;
|
||||||
@ -714,32 +683,17 @@ void _thr_assert_lock_level(void) __hidden __dead2;
|
|||||||
void _thr_ast(struct pthread *) __hidden;
|
void _thr_ast(struct pthread *) __hidden;
|
||||||
void _thr_once_init(void) __hidden;
|
void _thr_once_init(void) __hidden;
|
||||||
void _thr_report_creation(struct pthread *curthread,
|
void _thr_report_creation(struct pthread *curthread,
|
||||||
struct pthread *newthread) __hidden;
|
struct pthread *newthread) __hidden;
|
||||||
void _thr_report_death(struct pthread *curthread) __hidden;
|
void _thr_report_death(struct pthread *curthread) __hidden;
|
||||||
void _thread_bp_create(void);
|
void _thread_bp_create(void);
|
||||||
void _thread_bp_death(void);
|
void _thread_bp_death(void);
|
||||||
|
|
||||||
/* #include <sys/aio.h> */
|
|
||||||
#ifdef _SYS_AIO_H_
|
|
||||||
int __sys_aio_suspend(const struct aiocb * const[], int, const struct timespec *);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* #include <fcntl.h> */
|
/* #include <fcntl.h> */
|
||||||
#ifdef _SYS_FCNTL_H_
|
#ifdef _SYS_FCNTL_H_
|
||||||
int __sys_fcntl(int, int, ...);
|
int __sys_fcntl(int, int, ...);
|
||||||
int __sys_open(const char *, int, ...);
|
int __sys_open(const char *, int, ...);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* #include <sys/ioctl.h> */
|
|
||||||
#ifdef _SYS_IOCTL_H_
|
|
||||||
int __sys_ioctl(int, unsigned long, ...);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* #inclde <sched.h> */
|
|
||||||
#ifdef _SCHED_H_
|
|
||||||
int __sys_sched_yield(void);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* #include <signal.h> */
|
/* #include <signal.h> */
|
||||||
#ifdef _SIGNAL_H_
|
#ifdef _SIGNAL_H_
|
||||||
int __sys_kill(pid_t, int);
|
int __sys_kill(pid_t, int);
|
||||||
@ -749,25 +703,10 @@ int __sys_sigprocmask(int, const sigset_t *, sigset_t *);
|
|||||||
int __sys_sigsuspend(const sigset_t *);
|
int __sys_sigsuspend(const sigset_t *);
|
||||||
int __sys_sigreturn(ucontext_t *);
|
int __sys_sigreturn(ucontext_t *);
|
||||||
int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *);
|
int __sys_sigaltstack(const struct sigaltstack *, struct sigaltstack *);
|
||||||
#endif
|
int __sys_sigwait(const sigset_t *, int *);
|
||||||
|
int __sys_sigtimedwait(const sigset_t *, siginfo_t *,
|
||||||
/* #include <sys/socket.h> */
|
const struct timespec *);
|
||||||
#ifdef _SYS_SOCKET_H_
|
int __sys_sigwaitinfo(const sigset_t *set, siginfo_t *info);
|
||||||
int __sys_accept(int, struct sockaddr *, socklen_t *);
|
|
||||||
int __sys_connect(int, const struct sockaddr *, socklen_t);
|
|
||||||
ssize_t __sys_recv(int, void *, size_t, int);
|
|
||||||
ssize_t __sys_recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *);
|
|
||||||
ssize_t __sys_recvmsg(int, struct msghdr *, int);
|
|
||||||
int __sys_sendfile(int, int, off_t, size_t, struct sf_hdtr *,
|
|
||||||
off_t *, int);
|
|
||||||
ssize_t __sys_sendmsg(int, const struct msghdr *, int);
|
|
||||||
ssize_t __sys_sendto(int, const void *,size_t, int, const struct sockaddr *, socklen_t);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* #include <sys/uio.h> */
|
|
||||||
#ifdef _SYS_UIO_H_
|
|
||||||
ssize_t __sys_readv(int, const struct iovec *, int);
|
|
||||||
ssize_t __sys_writev(int, const struct iovec *, int);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* #include <time.h> */
|
/* #include <time.h> */
|
||||||
@ -778,28 +717,11 @@ int __sys_nanosleep(const struct timespec *, struct timespec *);
|
|||||||
/* #include <unistd.h> */
|
/* #include <unistd.h> */
|
||||||
#ifdef _UNISTD_H_
|
#ifdef _UNISTD_H_
|
||||||
int __sys_close(int);
|
int __sys_close(int);
|
||||||
int __sys_execve(const char *, char * const *, char * const *);
|
|
||||||
int __sys_fork(void);
|
int __sys_fork(void);
|
||||||
int __sys_fsync(int);
|
|
||||||
pid_t __sys_getpid(void);
|
pid_t __sys_getpid(void);
|
||||||
int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
|
||||||
ssize_t __sys_read(int, void *, size_t);
|
ssize_t __sys_read(int, void *, size_t);
|
||||||
ssize_t __sys_write(int, const void *, size_t);
|
ssize_t __sys_write(int, const void *, size_t);
|
||||||
void __sys_exit(int);
|
void __sys_exit(int);
|
||||||
int __sys_sigwait(const sigset_t *, int *);
|
|
||||||
int __sys_sigtimedwait(const sigset_t *, siginfo_t *,
|
|
||||||
const struct timespec *);
|
|
||||||
int __sys_sigwaitinfo(const sigset_t *set, siginfo_t *info);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* #include <poll.h> */
|
|
||||||
#ifdef _SYS_POLL_H_
|
|
||||||
int __sys_poll(struct pollfd *, unsigned, int);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* #include <sys/mman.h> */
|
|
||||||
#ifdef _SYS_MMAN_H_
|
|
||||||
int __sys_msync(void *, size_t, int);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
@ -26,9 +26,12 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
#define SPIN_COUNT 100000
|
#define SPIN_COUNT 100000
|
||||||
|
@ -32,8 +32,11 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <pthread_np.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ _thr_rtld_lock_release(void *lock)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_thr_rtld_set_flag(int mask)
|
_thr_rtld_set_flag(int mask __unused)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* The caller's code in rtld-elf is broken, it is not signal safe,
|
* The caller's code in rtld-elf is broken, it is not signal safe,
|
||||||
@ -175,7 +175,7 @@ _thr_rtld_set_flag(int mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
_thr_rtld_clr_flag(int mask)
|
_thr_rtld_clr_flag(int mask __unused)
|
||||||
{
|
{
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ __weak_reference(_pthread_rwlock_timedwrlock, pthread_rwlock_timedwrlock);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr)
|
rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr __unused)
|
||||||
{
|
{
|
||||||
pthread_rwlock_t prwlock;
|
pthread_rwlock_t prwlock;
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -26,10 +26,12 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
__weak_reference(_pthread_rwlockattr_destroy, pthread_rwlockattr_destroy);
|
__weak_reference(_pthread_rwlockattr_destroy, pthread_rwlockattr_destroy);
|
||||||
|
@ -32,7 +32,9 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -31,7 +31,11 @@
|
|||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
__weak_reference(_pthread_setprio, pthread_setprio);
|
__weak_reference(_pthread_setprio, pthread_setprio);
|
||||||
@ -42,9 +46,9 @@ _pthread_setprio(pthread_t pthread, int prio)
|
|||||||
int ret, policy;
|
int ret, policy;
|
||||||
struct sched_param param;
|
struct sched_param param;
|
||||||
|
|
||||||
if ((ret = pthread_getschedparam(pthread, &policy, ¶m)) == 0) {
|
if ((ret = _pthread_getschedparam(pthread, &policy, ¶m)) == 0) {
|
||||||
param.sched_priority = prio;
|
param.sched_priority = prio;
|
||||||
ret = pthread_setschedparam(pthread, policy, ¶m);
|
ret = _pthread_setschedparam(pthread, policy, ¶m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Return the error status: */
|
/* Return the error status: */
|
||||||
|
@ -32,9 +32,11 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include "namespace.h"
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/signalvar.h>
|
#include <sys/signalvar.h>
|
||||||
@ -35,6 +36,7 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
@ -45,8 +47,14 @@
|
|||||||
#define DBG_MSG(x...)
|
#define DBG_MSG(x...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int __sigtimedwait(const sigset_t *set, siginfo_t *info,
|
||||||
|
const struct timespec * timeout);
|
||||||
|
int __sigwaitinfo(const sigset_t *set, siginfo_t *info);
|
||||||
|
int __sigwait(const sigset_t *set, int *sig);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sigcancel_handler(int sig, siginfo_t *info, ucontext_t *ucp)
|
sigcancel_handler(int sig __unused,
|
||||||
|
siginfo_t *info __unused, ucontext_t *ucp __unused)
|
||||||
{
|
{
|
||||||
struct pthread *curthread = _get_curthread();
|
struct pthread *curthread = _get_curthread();
|
||||||
|
|
||||||
|
@ -32,8 +32,10 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
__weak_reference(_pthread_single_np, pthread_single_np);
|
__weak_reference(_pthread_single_np, pthread_single_np);
|
||||||
|
|
||||||
@ -41,7 +43,7 @@ int _pthread_single_np()
|
|||||||
{
|
{
|
||||||
|
|
||||||
/* Enter single-threaded (non-POSIX) scheduling mode: */
|
/* Enter single-threaded (non-POSIX) scheduling mode: */
|
||||||
pthread_suspend_all_np();
|
_pthread_suspend_all_np();
|
||||||
/*
|
/*
|
||||||
* XXX - Do we want to do this?
|
* XXX - Do we want to do this?
|
||||||
* __is_threaded = 0;
|
* __is_threaded = 0;
|
||||||
|
@ -32,11 +32,13 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
@ -103,7 +105,7 @@ _thread_cleanupspecific(void)
|
|||||||
{
|
{
|
||||||
struct pthread *curthread = _get_curthread();
|
struct pthread *curthread = _get_curthread();
|
||||||
void (*destructor)( void *);
|
void (*destructor)( void *);
|
||||||
void *data = NULL;
|
const void *data = NULL;
|
||||||
int key;
|
int key;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -122,8 +124,7 @@ _thread_cleanupspecific(void)
|
|||||||
(curthread->specific[key].data != NULL)) {
|
(curthread->specific[key].data != NULL)) {
|
||||||
if (curthread->specific[key].seqno ==
|
if (curthread->specific[key].seqno ==
|
||||||
_thread_keytable[key].seqno) {
|
_thread_keytable[key].seqno) {
|
||||||
data = (void *)
|
data = curthread->specific[key].data;
|
||||||
curthread->specific[key].data;
|
|
||||||
destructor = _thread_keytable[key].destructor;
|
destructor = _thread_keytable[key].destructor;
|
||||||
}
|
}
|
||||||
curthread->specific[key].data = NULL;
|
curthread->specific[key].data = NULL;
|
||||||
@ -140,7 +141,7 @@ _thread_cleanupspecific(void)
|
|||||||
* destructor:
|
* destructor:
|
||||||
*/
|
*/
|
||||||
THR_LOCK_RELEASE(curthread, &_keytable_lock);
|
THR_LOCK_RELEASE(curthread, &_keytable_lock);
|
||||||
destructor(data);
|
destructor(__DECONST(void *, data));
|
||||||
THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
|
THR_LOCK_ACQUIRE(curthread, &_keytable_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -203,7 +204,7 @@ void *
|
|||||||
_pthread_getspecific(pthread_key_t key)
|
_pthread_getspecific(pthread_key_t key)
|
||||||
{
|
{
|
||||||
struct pthread *pthread;
|
struct pthread *pthread;
|
||||||
void *data;
|
const void *data;
|
||||||
|
|
||||||
/* Point to the running thread: */
|
/* Point to the running thread: */
|
||||||
pthread = _get_curthread();
|
pthread = _get_curthread();
|
||||||
@ -214,7 +215,7 @@ _pthread_getspecific(pthread_key_t key)
|
|||||||
if (_thread_keytable[key].allocated &&
|
if (_thread_keytable[key].allocated &&
|
||||||
(pthread->specific[key].seqno == _thread_keytable[key].seqno)) {
|
(pthread->specific[key].seqno == _thread_keytable[key].seqno)) {
|
||||||
/* Return the value: */
|
/* Return the value: */
|
||||||
data = (void *) pthread->specific[key].data;
|
data = pthread->specific[key].data;
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* This key has not been used before, so return NULL
|
* This key has not been used before, so return NULL
|
||||||
@ -225,5 +226,5 @@ _pthread_getspecific(pthread_key_t key)
|
|||||||
} else
|
} else
|
||||||
/* No specific data has been created, so just return NULL: */
|
/* No specific data has been created, so just return NULL: */
|
||||||
data = NULL;
|
data = NULL;
|
||||||
return (data);
|
return (__DECONST(void *, data));
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ static void init_spinlock(spinlock_t *lck);
|
|||||||
void
|
void
|
||||||
_spinunlock(spinlock_t *lck)
|
_spinunlock(spinlock_t *lck)
|
||||||
{
|
{
|
||||||
THR_UMTX_UNLOCK(_get_curthread(), (umtx_t *)&lck->access_lock);
|
THR_UMTX_UNLOCK(_get_curthread(), (volatile umtx_t *)&lck->access_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -77,11 +77,11 @@ _spinlock(spinlock_t *lck)
|
|||||||
PANIC("Spinlocks not initialized.");
|
PANIC("Spinlocks not initialized.");
|
||||||
if (lck->fname == NULL)
|
if (lck->fname == NULL)
|
||||||
init_spinlock(lck);
|
init_spinlock(lck);
|
||||||
THR_UMTX_LOCK(_get_curthread(), (umtx_t *)&lck->access_lock);
|
THR_UMTX_LOCK(_get_curthread(), (volatile umtx_t *)&lck->access_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_spinlock_debug(spinlock_t *lck, char *fname, int lineno)
|
_spinlock_debug(spinlock_t *lck, char *fname __unused, int lineno __unused)
|
||||||
{
|
{
|
||||||
_spinlock(lck);
|
_spinlock(lck);
|
||||||
}
|
}
|
||||||
@ -118,7 +118,8 @@ _thr_spinlock_init(void)
|
|||||||
* it is better to do pthread_atfork in libc.
|
* it is better to do pthread_atfork in libc.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < spinlock_count; i++)
|
for (i = 0; i < spinlock_count; i++)
|
||||||
_thr_umtx_init((umtx_t *)&extra[i].owner->access_lock);
|
_thr_umtx_init((volatile umtx_t *)
|
||||||
|
&extra[i].owner->access_lock);
|
||||||
} else {
|
} else {
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ static LIST_HEAD(, stack) mstackq = LIST_HEAD_INITIALIZER(mstackq);
|
|||||||
* high memory
|
* high memory
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static void *last_stack = NULL;
|
static char *last_stack = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Round size up to the nearest multiple of
|
* Round size up to the nearest multiple of
|
||||||
@ -236,8 +236,9 @@ _thr_stack_free(struct pthread_attr *attr)
|
|||||||
|
|
||||||
if ((attr != NULL) && ((attr->flags & THR_STACK_USER) == 0)
|
if ((attr != NULL) && ((attr->flags & THR_STACK_USER) == 0)
|
||||||
&& (attr->stackaddr_attr != NULL)) {
|
&& (attr->stackaddr_attr != NULL)) {
|
||||||
spare_stack = (attr->stackaddr_attr + attr->stacksize_attr
|
spare_stack = (struct stack *)
|
||||||
- sizeof(struct stack));
|
((char *)attr->stackaddr_attr +
|
||||||
|
attr->stacksize_attr - sizeof(struct stack));
|
||||||
spare_stack->stacksize = round_up(attr->stacksize_attr);
|
spare_stack->stacksize = round_up(attr->stacksize_attr);
|
||||||
spare_stack->guardsize = round_up(attr->guardsize_attr);
|
spare_stack->guardsize = round_up(attr->guardsize_attr);
|
||||||
spare_stack->stackaddr = attr->stackaddr_attr;
|
spare_stack->stackaddr = attr->stackaddr_attr;
|
||||||
|
@ -32,8 +32,11 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <pthread_np.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
|
@ -32,9 +32,11 @@
|
|||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <pthread_np.h>
|
#include <pthread_np.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
@ -43,13 +45,13 @@ __weak_reference(_pthread_switch_add_np, pthread_switch_add_np);
|
|||||||
__weak_reference(_pthread_switch_delete_np, pthread_switch_delete_np);
|
__weak_reference(_pthread_switch_delete_np, pthread_switch_delete_np);
|
||||||
|
|
||||||
int
|
int
|
||||||
_pthread_switch_add_np(pthread_switch_routine_t routine)
|
_pthread_switch_add_np(pthread_switch_routine_t routine __unused)
|
||||||
{
|
{
|
||||||
return (ENOTSUP);
|
return (ENOTSUP);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
_pthread_switch_delete_np(pthread_switch_routine_t routine)
|
_pthread_switch_delete_np(pthread_switch_routine_t routine __unused)
|
||||||
{
|
{
|
||||||
return (ENOTSUP);
|
return (ENOTSUP);
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -87,22 +88,75 @@
|
|||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
#include "thr_private.h"
|
#include "thr_private.h"
|
||||||
|
|
||||||
extern int __creat(const char *, mode_t);
|
extern int __creat(const char *, mode_t);
|
||||||
extern int __pause(void);
|
extern int __pause(void);
|
||||||
extern int __pselect(int count, fd_set *rfds, fd_set *wfds, fd_set *efds,
|
extern int __pselect(int, fd_set *, fd_set *, fd_set *,
|
||||||
const struct timespec *timo, const sigset_t *mask);
|
const struct timespec *, const sigset_t *);
|
||||||
extern unsigned int __sleep(unsigned int);
|
extern unsigned __sleep(unsigned int);
|
||||||
extern int __system(const char *);
|
extern int __system(const char *);
|
||||||
extern int __tcdrain(int);
|
extern int __tcdrain(int);
|
||||||
extern int __usleep(useconds_t);
|
extern int __usleep(useconds_t);
|
||||||
extern pid_t __wait(int *);
|
extern pid_t __wait(int *);
|
||||||
extern pid_t __sys_wait4(pid_t, int *, int, struct rusage *);
|
extern pid_t __waitpid(pid_t, int *, int);
|
||||||
extern pid_t __waitpid(pid_t, int *, int);
|
extern int __sys_aio_suspend(const struct aiocb * const[], int,
|
||||||
|
const struct timespec *);
|
||||||
|
extern int __sys_accept(int, struct sockaddr *, socklen_t *);
|
||||||
|
extern int __sys_connect(int, const struct sockaddr *, socklen_t);
|
||||||
|
extern int __sys_fsync(int);
|
||||||
|
extern int __sys_msync(void *, size_t, int);
|
||||||
|
extern int __sys_poll(struct pollfd *, unsigned, int);
|
||||||
|
extern ssize_t __sys_recv(int, void *, size_t, int);
|
||||||
|
extern ssize_t __sys_recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *);
|
||||||
|
extern ssize_t __sys_recvmsg(int, struct msghdr *, int);
|
||||||
|
extern int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||||
|
extern int __sys_sendfile(int, int, off_t, size_t, struct sf_hdtr *,
|
||||||
|
off_t *, int);
|
||||||
|
extern ssize_t __sys_sendmsg(int, const struct msghdr *, int);
|
||||||
|
extern ssize_t __sys_sendto(int, const void *,size_t, int, const struct sockaddr *, socklen_t);
|
||||||
|
extern ssize_t __sys_readv(int, const struct iovec *, int);
|
||||||
|
extern pid_t __sys_wait4(pid_t, int *, int, struct rusage *);
|
||||||
|
extern ssize_t __sys_writev(int, const struct iovec *, int);
|
||||||
|
|
||||||
|
int ___creat(const char *, mode_t);
|
||||||
|
int __accept(int, struct sockaddr *, socklen_t *);
|
||||||
|
int __close(int);
|
||||||
|
int __connect(int, const struct sockaddr *, socklen_t);
|
||||||
|
int __fcntl(int, int,...);
|
||||||
|
int __fsync(int);
|
||||||
|
int __msync(void *, size_t, int);
|
||||||
|
int __nanosleep(const struct timespec *, struct timespec *);
|
||||||
|
int __open(const char *, int,...);
|
||||||
|
int __poll(struct pollfd *, unsigned int, int);
|
||||||
|
ssize_t __read(int, void *buf, size_t);
|
||||||
|
ssize_t __readv(int, const struct iovec *, int);
|
||||||
|
ssize_t __recvfrom(int, void *, size_t, int f, struct sockaddr *, socklen_t *);
|
||||||
|
ssize_t __recvmsg(int, struct msghdr *, int);
|
||||||
|
int __select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
||||||
|
ssize_t __sendmsg(int, const struct msghdr *, int);
|
||||||
|
ssize_t __sendto(int, const void *, size_t, int,
|
||||||
|
const struct sockaddr *, socklen_t);
|
||||||
|
pid_t __wait4(pid_t, int *, int, struct rusage *);
|
||||||
|
ssize_t __write(int, const void *, size_t);
|
||||||
|
ssize_t __writev(int, const struct iovec *, int);
|
||||||
|
int _aio_suspend(const struct aiocb * const iocbs[], int,
|
||||||
|
const struct timespec *);
|
||||||
|
int _pause(void);
|
||||||
|
int _pselect(int, fd_set *, fd_set *, fd_set *,
|
||||||
|
const struct timespec *, const sigset_t *);
|
||||||
|
int _raise(int);
|
||||||
|
unsigned _sleep(unsigned);
|
||||||
|
int _system(const char *);
|
||||||
|
int _tcdrain(int);
|
||||||
|
int _vfork(void);
|
||||||
|
pid_t _wait(int *);
|
||||||
|
|
||||||
|
|
||||||
__weak_reference(__accept, accept);
|
__weak_reference(__accept, accept);
|
||||||
|
|
||||||
int
|
int
|
||||||
__accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
__accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,8 @@
|
|||||||
int
|
int
|
||||||
__thr_umtx_lock(volatile umtx_t *mtx, long id)
|
__thr_umtx_lock(volatile umtx_t *mtx, long id)
|
||||||
{
|
{
|
||||||
while (_umtx_op((struct umtx *)mtx, UMTX_OP_LOCK, id, 0, 0))
|
while (_umtx_op(__DEVOLATILE(struct umtx *, mtx),
|
||||||
|
UMTX_OP_LOCK, id, 0, 0))
|
||||||
;
|
;
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -45,8 +46,8 @@ __thr_umtx_timedlock(volatile umtx_t *mtx, long id,
|
|||||||
if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 &&
|
if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 &&
|
||||||
timeout->tv_nsec <= 0)))
|
timeout->tv_nsec <= 0)))
|
||||||
return (ETIMEDOUT);
|
return (ETIMEDOUT);
|
||||||
if (_umtx_op((struct umtx *)mtx, UMTX_OP_LOCK, id, 0,
|
if (_umtx_op(__DEVOLATILE(struct umtx *, mtx), UMTX_OP_LOCK, id, 0,
|
||||||
(void *)timeout) == 0)
|
__DECONST(void *, timeout)) == 0)
|
||||||
return (0);
|
return (0);
|
||||||
return (errno);
|
return (errno);
|
||||||
}
|
}
|
||||||
@ -54,7 +55,8 @@ __thr_umtx_timedlock(volatile umtx_t *mtx, long id,
|
|||||||
int
|
int
|
||||||
__thr_umtx_unlock(volatile umtx_t *mtx, long id)
|
__thr_umtx_unlock(volatile umtx_t *mtx, long id)
|
||||||
{
|
{
|
||||||
if (_umtx_op((struct umtx *)mtx, UMTX_OP_UNLOCK, id, 0, 0) == 0)
|
if (_umtx_op(__DEVOLATILE(struct umtx *, mtx), UMTX_OP_UNLOCK,
|
||||||
|
id, 0, 0) == 0)
|
||||||
return (0);
|
return (0);
|
||||||
return (errno);
|
return (errno);
|
||||||
}
|
}
|
||||||
@ -65,8 +67,8 @@ _thr_umtx_wait(volatile umtx_t *mtx, long id, const struct timespec *timeout)
|
|||||||
if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 &&
|
if (timeout && (timeout->tv_sec < 0 || (timeout->tv_sec == 0 &&
|
||||||
timeout->tv_nsec <= 0)))
|
timeout->tv_nsec <= 0)))
|
||||||
return (ETIMEDOUT);
|
return (ETIMEDOUT);
|
||||||
if (_umtx_op((struct umtx *)mtx, UMTX_OP_WAIT, id, 0,
|
if (_umtx_op(__DEVOLATILE(struct umtx *, mtx), UMTX_OP_WAIT, id, 0,
|
||||||
(void*) timeout) == 0)
|
__DECONST(void*, timeout)) == 0)
|
||||||
return (0);
|
return (0);
|
||||||
return (errno);
|
return (errno);
|
||||||
}
|
}
|
||||||
@ -74,7 +76,8 @@ _thr_umtx_wait(volatile umtx_t *mtx, long id, const struct timespec *timeout)
|
|||||||
int
|
int
|
||||||
_thr_umtx_wake(volatile umtx_t *mtx, int nr_wakeup)
|
_thr_umtx_wake(volatile umtx_t *mtx, int nr_wakeup)
|
||||||
{
|
{
|
||||||
if (_umtx_op((struct umtx *)mtx, UMTX_OP_WAKE, nr_wakeup, 0, 0) == 0)
|
if (_umtx_op(__DEVOLATILE(struct umtx *, mtx), UMTX_OP_WAKE,
|
||||||
|
nr_wakeup, 0, 0) == 0)
|
||||||
return (0);
|
return (0);
|
||||||
return (errno);
|
return (errno);
|
||||||
}
|
}
|
||||||
|
@ -31,8 +31,11 @@
|
|||||||
*
|
*
|
||||||
* $FreeBSD$
|
* $FreeBSD$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "namespace.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "thr_private.h"
|
#include <sched.h>
|
||||||
|
#include "un-namespace.h"
|
||||||
|
|
||||||
__weak_reference(_pthread_yield, pthread_yield);
|
__weak_reference(_pthread_yield, pthread_yield);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user