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
This commit is contained in:
parent
4e3f7b6ede
commit
7d9d7ca2ed
@ -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"
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -4,6 +4,7 @@
|
||||
*/
|
||||
#include <sys/errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include "thr_private.h"
|
||||
|
||||
/*
|
||||
|
@ -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;
|
||||
|
@ -33,6 +33,7 @@
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include "thr_private.h"
|
||||
|
||||
__weak_reference(_pthread_detach, pthread_detach);
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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>
|
||||
|
||||
|
@ -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);
|
||||
|
@ -33,6 +33,7 @@
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include "thr_private.h"
|
||||
|
||||
static void resume_common(struct pthread *);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user