Date: Tue, 28 Mar 2006 23:34:17 +0200 From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Daniel Eischen <deischen@FreeBSD.org> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libpthread/thread thr_barrier.c Message-ID: <86mzfauucm.fsf@xps.des.no> In-Reply-To: <200603282108.k2SL80cV066804@repoman.freebsd.org> (Daniel Eischen's message of "Tue, 28 Mar 2006 21:08:00 %2B0000 (UTC)") References: <200603282108.k2SL80cV066804@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Daniel Eischen <deischen@FreeBSD.org> writes: > Log: > Use the correct type for and argument. Recent changes to namespace.h > exposed this bug. You beat me to it... The attached patch brings libpthread up to WARNS level 2. More work is required for level 3 or higher (missing prototypes for syscall wrappers, mostly). DES --=20 Dag-Erling Sm=F8rgrav - des@des.no --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=libpthread.diff Index: Makefile =================================================================== RCS file: /home/ncvs/src/lib/libpthread/Makefile,v retrieving revision 1.56 diff -u -r1.56 Makefile --- Makefile 16 Mar 2006 15:17:47 -0000 1.56 +++ Makefile 28 Mar 2006 21:32:13 -0000 @@ -25,7 +25,7 @@ # Uncomment this if you want libpthread to contain debug information for # thread locking. CFLAGS+=-D_LOCK_DEBUG -#CFLAGS+= -g +WARNS?=2 # Uncomment this if you want to build a 1:1 threading mode library # however it is no longer strictly conformed to POSIX Index: thread/thr_getprio.c =================================================================== RCS file: /home/ncvs/src/lib/libpthread/thread/thr_getprio.c,v retrieving revision 1.10 diff -u -r1.10 thr_getprio.c --- thread/thr_getprio.c 13 Mar 2006 00:59:51 -0000 1.10 +++ thread/thr_getprio.c 28 Mar 2006 21:32:13 -0000 @@ -31,8 +31,12 @@ * * $FreeBSD: src/lib/libpthread/thread/thr_getprio.c,v 1.10 2006/03/13 00:59:51 deischen Exp $ */ + +#include "namespace.h" #include <errno.h> #include <pthread.h> +#include "un-namespace.h" + #include "thr_private.h" LT10_COMPAT_PRIVATE(_pthread_getprio); @@ -46,7 +50,7 @@ int policy, ret; struct sched_param param; - if ((ret = pthread_getschedparam(pthread, &policy, ¶m)) == 0) + if ((ret = _pthread_getschedparam(pthread, &policy, ¶m)) == 0) ret = param.sched_priority; else { /* Invalid thread: */ Index: thread/thr_private.h =================================================================== RCS file: /home/ncvs/src/lib/libpthread/thread/thr_private.h,v retrieving revision 1.125 diff -u -r1.125 thr_private.h --- thread/thr_private.h 13 Mar 2006 00:59:51 -0000 1.125 +++ thread/thr_private.h 28 Mar 2006 21:32:13 -0000 @@ -107,12 +107,16 @@ /* * Kernel fatal error handler macro. */ -#define PANIC(string) _thr_exit(__FILE__,__LINE__,string) +#define PANIC(string) _thr_exit(__FILE__, __LINE__, string) /* Output debug messages like this: */ -#define stdout_debug(args...) _thread_printf(STDOUT_FILENO, ##args) -#define stderr_debug(args...) _thread_printf(STDOUT_FILENO, ##args) +#ifdef STDOUT_FILENO +#define stdout_debug(...) _thread_printf(STDOUT_FILENO, __VA_ARGS__) +#endif +#ifdef STDERR_FILENO +#define stderr_debug(...) _thread_printf(STDERR_FILENO, __VA_ARGS__) +#endif #define DBG_MUTEX 0x0001 #define DBG_SIG 0x0002 @@ -449,7 +453,7 @@ */ struct pthread_cleanup { struct pthread_cleanup *next; - void (*routine) (); + void (*routine) (void *); void *routine_arg; int onstack; }; @@ -486,7 +490,7 @@ #define THR_SIGNAL_THREAD 0x200 /* This is a signal thread */ int flags; void *arg_attr; - void (*cleanup_attr) (); + void (*cleanup_attr) (void *); void *stackaddr_attr; size_t stacksize_attr; size_t guardsize_attr; @@ -1131,7 +1135,7 @@ void _kse_critical_leave(kse_critical_t); int _kse_in_critical(void); void _kse_free(struct pthread *, struct kse *); -void _kse_init(); +void _kse_init(void); struct kse_group *_kseg_alloc(struct pthread *); void _kse_lock_wait(struct lock *, struct lockuser *lu); void _kse_lock_wakeup(struct lock *, struct lockuser *lu); Index: thread/thr_sem.c =================================================================== RCS file: /home/ncvs/src/lib/libpthread/thread/thr_sem.c,v retrieving revision 1.18 diff -u -r1.18 thr_sem.c --- thread/thr_sem.c 13 Mar 2006 00:59:51 -0000 1.18 +++ thread/thr_sem.c 28 Mar 2006 21:32:13 -0000 @@ -52,10 +52,6 @@ LT10_COMPAT_PRIVATE(_sem_post); LT10_COMPAT_DEFAULT(sem_post); -extern int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *); -extern int pthread_cond_timedwait(pthread_cond_t *, pthread_mutex_t *, - struct timespec *); - __weak_reference(_sem_init, sem_init); __weak_reference(_sem_wait, sem_wait); __weak_reference(_sem_timedwait, sem_timedwait); @@ -161,13 +157,13 @@ _thr_cancel_leave(curthread, retval != 0); } else { - pthread_testcancel(); + _pthread_testcancel(); _pthread_mutex_lock(&(*sem)->lock); while ((*sem)->count <= 0) { (*sem)->nwaiters++; THR_CLEANUP_PUSH(curthread, decrease_nwaiters, sem); - pthread_cond_wait(&(*sem)->gtzero, &(*sem)->lock); + _pthread_cond_wait(&(*sem)->gtzero, &(*sem)->lock); THR_CLEANUP_POP(curthread, 0); (*sem)->nwaiters--; } @@ -182,7 +178,7 @@ int _sem_timedwait(sem_t * __restrict sem, - struct timespec * __restrict abs_timeout) + const struct timespec * __restrict abs_timeout) { struct pthread *curthread; int retval; @@ -205,7 +201,7 @@ * segfault on an invalid address doesn't end * up leaving the mutex locked. */ - pthread_testcancel(); + _pthread_testcancel(); timeout_invalid = (abs_timeout->tv_nsec >= 1000000000) || (abs_timeout->tv_nsec < 0); _pthread_mutex_lock(&(*sem)->lock); @@ -217,10 +213,10 @@ return (-1); } (*sem)->nwaiters++; - pthread_cleanup_push(decrease_nwaiters, sem); - pthread_cond_timedwait(&(*sem)->gtzero, + _pthread_cleanup_push(decrease_nwaiters, sem); + _pthread_cond_timedwait(&(*sem)->gtzero, &(*sem)->lock, abs_timeout); - pthread_cleanup_pop(0); + _pthread_cleanup_pop(0); (*sem)->nwaiters--; } if ((*sem)->count == 0) { --=-=-=--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86mzfauucm.fsf>