diff options
| author | Mike Makonnen <mtm@FreeBSD.org> | 2003-05-23 09:48:20 +0000 | 
|---|---|---|
| committer | Mike Makonnen <mtm@FreeBSD.org> | 2003-05-23 09:48:20 +0000 | 
| commit | 7d9d7ca2ed3e3d630e63482c41f2d26194129c2c (patch) | |
| tree | a5c7ab227f8b7ea35430bf21cc7cafe1b6b756f3 /lib | |
| parent | 4e3f7b6ede53e15c4423d42f0cb5bce693a14246 (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libthr/Makefile | 2 | ||||
| -rw-r--r-- | lib/libthr/arch/i386/i386/_setcurthread.c | 5 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_autoinit.c | 4 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_cancel.c | 1 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_create.c | 1 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_detach.c | 1 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_exit.c | 3 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_init.c | 3 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_kern.c | 2 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_mutex.c | 6 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_printf.c | 1 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_private.h | 2 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_resume_np.c | 1 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_setschedparam.c | 5 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_sig.c | 4 | ||||
| -rw-r--r-- | lib/libthr/thread/thr_syscalls.c | 10 | 
16 files changed, 41 insertions, 10 deletions
diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile index 6bfa593b7144..de4307eb3755 100644 --- a/lib/libthr/Makefile +++ b/lib/libthr/Makefile @@ -20,6 +20,8 @@ CFLAGS+=-D_PTHREADS_INVARIANTS  AINC=	-I${.CURDIR}/../libc/${MACHINE_ARCH} -I${.CURDIR}/thread  PRECIOUSLIB=	yes +WARNS?=	2 +  .include "${.CURDIR}/thread/Makefile.inc"  .include "${.CURDIR}/sys/Makefile.inc"  .include "${.CURDIR}/arch/${MACHINE_ARCH}/Makefile.inc" diff --git a/lib/libthr/arch/i386/i386/_setcurthread.c b/lib/libthr/arch/i386/i386/_setcurthread.c index b561f3fc4d3c..69a5e8f4de98 100644 --- a/lib/libthr/arch/i386/i386/_setcurthread.c +++ b/lib/libthr/arch/i386/i386/_setcurthread.c @@ -31,6 +31,8 @@  #include <pthread.h>  #include <stdio.h> +#include <stdlib.h> +#include <string.h>  #include <machine/sysarch.h>  #include <machine/segments.h> @@ -48,6 +50,9 @@ static spinlock_t ldt_lock = _SPINLOCK_INITIALIZER;  static void ldt_init(void); +/* in _curthread.S */ +extern void _set_gs(int); +  /*   * Initialize the array of ldt_entries and the next free slot.   * This routine must be called with the global ldt lock held. diff --git a/lib/libthr/thread/thr_autoinit.c b/lib/libthr/thread/thr_autoinit.c index 31e2d489d7c0..c425569c226e 100644 --- a/lib/libthr/thread/thr_autoinit.c +++ b/lib/libthr/thread/thr_autoinit.c @@ -33,6 +33,10 @@   * $FreeBSD$   */ +#include <pthread.h> + +#include "thr_private.h" +  /*   * This module uses GCC extentions to initialize the   * threads package at program start-up time. diff --git a/lib/libthr/thread/thr_cancel.c b/lib/libthr/thread/thr_cancel.c index 2d6d765ed6b4..ec2bfb674c45 100644 --- a/lib/libthr/thread/thr_cancel.c +++ b/lib/libthr/thread/thr_cancel.c @@ -4,6 +4,7 @@   */  #include <sys/errno.h>  #include <pthread.h> +#include <stdlib.h>  #include "thr_private.h"  /* diff --git a/lib/libthr/thread/thr_create.c b/lib/libthr/thread/thr_create.c index 4fb29cb9a719..334dc12a1901 100644 --- a/lib/libthr/thread/thr_create.c +++ b/lib/libthr/thread/thr_create.c @@ -62,7 +62,6 @@ int  _pthread_create(pthread_t * thread, const pthread_attr_t * attr,  	       void *(*start_routine) (void *), void *arg)  { -	struct itimerval itimer;  	int		f_gc = 0;  	int             ret = 0;  	pthread_t       gc_thread; diff --git a/lib/libthr/thread/thr_detach.c b/lib/libthr/thread/thr_detach.c index b60dc5cba0ed..b11728e44c23 100644 --- a/lib/libthr/thread/thr_detach.c +++ b/lib/libthr/thread/thr_detach.c @@ -33,6 +33,7 @@   */  #include <errno.h>  #include <pthread.h> +#include <stdlib.h>  #include "thr_private.h"  __weak_reference(_pthread_detach, pthread_detach); diff --git a/lib/libthr/thread/thr_exit.c b/lib/libthr/thread/thr_exit.c index e39432493db7..118876fbefd4 100644 --- a/lib/libthr/thread/thr_exit.c +++ b/lib/libthr/thread/thr_exit.c @@ -42,6 +42,9 @@  __weak_reference(_pthread_exit, pthread_exit); +/* thr_exit() */ +extern int _thr_exit(void); +  void  _thread_exit(char *fname, int lineno, char *string)  { diff --git a/lib/libthr/thread/thr_init.c b/lib/libthr/thread/thr_init.c index 64a1315a65b5..3b59da457fbf 100644 --- a/lib/libthr/thread/thr_init.c +++ b/lib/libthr/thread/thr_init.c @@ -158,7 +158,6 @@ _thread_init(void)  {  	struct pthread	*pthread;  	int		fd; -	int             flags;  	int             i;  	size_t		len;  	int		mib[2]; @@ -328,7 +327,7 @@ _thread_init(void)  	/* Initialise the garbage collector mutex and condition variable. */  	if (_pthread_mutex_init(&_gc_mutex,NULL) != 0 || -	    pthread_cond_init(&_gc_cond,NULL) != 0) +	    _pthread_cond_init(&_gc_cond,NULL) != 0)  		PANIC("Failed to initialise garbage collector mutex or condvar");  } diff --git a/lib/libthr/thread/thr_kern.c b/lib/libthr/thread/thr_kern.c index 2945cc35f55e..7d10c5fe5540 100644 --- a/lib/libthr/thread/thr_kern.c +++ b/lib/libthr/thread/thr_kern.c @@ -33,6 +33,7 @@  #include <sys/timespec.h>  #include <pthread.h>  #include <signal.h> +#include <stdlib.h>  #include <errno.h>  #include <unistd.h> @@ -80,7 +81,6 @@ void  _thread_critical_exit(pthread_t pthread)  {  	sigset_t set; -	int error;  	/*  	 * restore is protected by giant.  We could restore our signal state diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c index c6c80b4b199a..aa3a96fe62b2 100644 --- a/lib/libthr/thread/thr_mutex.c +++ b/lib/libthr/thread/thr_mutex.c @@ -64,6 +64,7 @@   */  static int		get_muncontested(pthread_mutex_t, int);  static void		get_mcontested(pthread_mutex_t); +static int		mutex_lock_common(pthread_mutex_t *, int);  static inline int	mutex_self_trylock(pthread_mutex_t);  static inline int	mutex_self_lock(pthread_mutex_t);  static inline int	mutex_unlock_common(pthread_mutex_t *, int); @@ -1381,13 +1382,14 @@ mutex_queue_enq(pthread_mutex_t mutex, pthread_t pthread)  static int  get_muncontested(pthread_mutex_t mutexp, int nonblock)  { -	if (mutexp->m_owner != NULL && mutexp->m_owner != curthread) +	if (mutexp->m_owner != NULL && mutexp->m_owner != curthread) {  		return (-1); -	else if (mutexp->m_owner == curthread) +	} else if (mutexp->m_owner == curthread) {  		if (nonblock)  			return (mutex_self_trylock(mutexp));  		else  			return (mutex_self_lock(mutexp)); +	}  	/*  	 * The mutex belongs to this thread now. Mark it as diff --git a/lib/libthr/thread/thr_printf.c b/lib/libthr/thread/thr_printf.c index 0da9ae52213c..3a120e87eb40 100644 --- a/lib/libthr/thread/thr_printf.c +++ b/lib/libthr/thread/thr_printf.c @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");  #include <sys/uio.h>  #include <errno.h>  #include <stdarg.h> +#include <string.h>  #include <unistd.h>  #include <pthread.h> diff --git a/lib/libthr/thread/thr_private.h b/lib/libthr/thread/thr_private.h index 81623095acb9..f0cfd561668d 100644 --- a/lib/libthr/thread/thr_private.h +++ b/lib/libthr/thread/thr_private.h @@ -718,7 +718,7 @@ void    *_thread_cleanup(pthread_t);  void    _thread_cleanupspecific(void);  void    _thread_dump_info(void);  void    _thread_init(void); -void	_thread_sig_wrapper(int sig, siginfo_t *info, ucontext_t *context); +void	_thread_sig_wrapper(int sig, siginfo_t *info, void *context);  void	_thread_printf(int fd, const char *, ...);  void    _thread_start(void);  void	_thread_seterrno(pthread_t, int); diff --git a/lib/libthr/thread/thr_resume_np.c b/lib/libthr/thread/thr_resume_np.c index 4d499fd10349..26b4d072df4b 100644 --- a/lib/libthr/thread/thr_resume_np.c +++ b/lib/libthr/thread/thr_resume_np.c @@ -33,6 +33,7 @@   */  #include <errno.h>  #include <pthread.h> +#include <stdlib.h>  #include "thr_private.h"  static void	resume_common(struct pthread *); diff --git a/lib/libthr/thread/thr_setschedparam.c b/lib/libthr/thread/thr_setschedparam.c index 7746383d772c..04786a7b40de 100644 --- a/lib/libthr/thread/thr_setschedparam.c +++ b/lib/libthr/thread/thr_setschedparam.c @@ -42,7 +42,10 @@ int  _pthread_setschedparam(pthread_t pthread, int policy,   	const struct sched_param *param)  { -	int old_prio, in_readyq = 0, ret = 0; +	int old_prio, ret = 0; +#if 0 +	int in_readyq = 0; +#endif  	if ((param == NULL) || (policy < SCHED_FIFO) || (policy > SCHED_RR))  		return (EINVAL); diff --git a/lib/libthr/thread/thr_sig.c b/lib/libthr/thread/thr_sig.c index 51479af3efcb..a9f7f832c43d 100644 --- a/lib/libthr/thread/thr_sig.c +++ b/lib/libthr/thread/thr_sig.c @@ -113,7 +113,7 @@ _pthread_kill(pthread_t pthread, int sig)   * User thread signal handler wrapper.   */  void -_thread_sig_wrapper(int sig, siginfo_t *info, ucontext_t *context) +_thread_sig_wrapper(int sig, siginfo_t *info, void *context)  {  	struct pthread_state_data psd;  	__siginfohandler_t *handler; @@ -149,7 +149,7 @@ _thread_sig_wrapper(int sig, siginfo_t *info, ucontext_t *context)  		GIANT_UNLOCK(curthread);  		handler = (__siginfohandler_t *)  			_thread_sigact[sig - 1].sa_handler; -		handler(sig, info, context); +		handler(sig, info, (ucontext_t *)context);  		GIANT_LOCK(curthread);  	} diff --git a/lib/libthr/thread/thr_syscalls.c b/lib/libthr/thread/thr_syscalls.c index d8fa348fc40d..f5c609a1baff 100644 --- a/lib/libthr/thread/thr_syscalls.c +++ b/lib/libthr/thread/thr_syscalls.c @@ -90,6 +90,16 @@  #include "thr_private.h" +extern int __creat(const char *, mode_t); +extern int __sleep(unsigned int); +extern int __sys_nanosleep(const struct timespec *, struct timespec *); +extern int __sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *); +extern int __system(const char *); +extern int __tcdrain(int); +extern pid_t __wait(int *); +extern pid_t _wait4(pid_t, int *, int, struct rusage *); +extern pid_t __waitpid(pid_t, int *, int); +  __weak_reference(_aio_suspend, aio_suspend);  int  | 
