summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authormtm <mtm@FreeBSD.org>2003-05-23 09:48:20 +0000
committermtm <mtm@FreeBSD.org>2003-05-23 09:48:20 +0000
commit6356a9c88e04455186a9b6d683ace14dadb891b7 (patch)
treea5c7ab227f8b7ea35430bf21cc7cafe1b6b756f3 /lib/libthr
parent7f8de979fc762dc4b610f5f1bc9b9845a9c638a2 (diff)
downloadFreeBSD-src-6356a9c88e04455186a9b6d683ace14dadb891b7.zip
FreeBSD-src-6356a9c88e04455186a9b6d683ace14dadb891b7.tar.gz
Make WARNS2 clean. The fixes mostly included:
o removed unused variables o explicit inclusion of header files o prototypes for externally defined functions Approved by: re/blanket libthr
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/Makefile2
-rw-r--r--lib/libthr/arch/i386/i386/_setcurthread.c5
-rw-r--r--lib/libthr/thread/thr_autoinit.c4
-rw-r--r--lib/libthr/thread/thr_cancel.c1
-rw-r--r--lib/libthr/thread/thr_create.c1
-rw-r--r--lib/libthr/thread/thr_detach.c1
-rw-r--r--lib/libthr/thread/thr_exit.c3
-rw-r--r--lib/libthr/thread/thr_init.c3
-rw-r--r--lib/libthr/thread/thr_kern.c2
-rw-r--r--lib/libthr/thread/thr_mutex.c6
-rw-r--r--lib/libthr/thread/thr_printf.c1
-rw-r--r--lib/libthr/thread/thr_private.h2
-rw-r--r--lib/libthr/thread/thr_resume_np.c1
-rw-r--r--lib/libthr/thread/thr_setschedparam.c5
-rw-r--r--lib/libthr/thread/thr_sig.c4
-rw-r--r--lib/libthr/thread/thr_syscalls.c10
16 files changed, 41 insertions, 10 deletions
diff --git a/lib/libthr/Makefile b/lib/libthr/Makefile
index 6bfa593..de4307e 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 b561f3f..69a5e8f 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 31e2d48..c425569 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 2d6d765..ec2bfb6 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 4fb29cb..334dc12 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 b60dc5c..b11728e 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 e394324..118876f 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 64a1315..3b59da4 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 2945cc3..7d10c5f 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 c6c80b4..aa3a96f 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 0da9ae5..3a120e8 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 8162309..f0cfd56 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 4d499fd..26b4d07 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 7746383..04786a7 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 51479af..a9f7f83 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 d8fa348..f5c609a 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
OpenPOWER on IntegriCloud