From owner-cvs-src@FreeBSD.ORG Tue Mar 28 21:34:26 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5AFDA16A43A; Tue, 28 Mar 2006 21:34:26 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.FreeBSD.org (Postfix) with ESMTP id 95ABB43D49; Tue, 28 Mar 2006 21:34:24 +0000 (GMT) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 19C3E2096; Tue, 28 Mar 2006 23:34:18 +0200 (CEST) X-Spam-Tests: AWL,BAYES_00,FORGED_RCVD_HELO X-Spam-Learn: ham X-Spam-Score: -2.4/3.0 X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on tim.des.no Received: from xps.des.no (des.no [80.203.243.180]) by tim.des.no (Postfix) with ESMTP id 862552081; Tue, 28 Mar 2006 23:34:17 +0200 (CEST) Received: by xps.des.no (Postfix, from userid 1001) id 630D733CB7; Tue, 28 Mar 2006 23:34:17 +0200 (CEST) From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Daniel Eischen References: <200603282108.k2SL80cV066804@repoman.freebsd.org> Date: Tue, 28 Mar 2006 23:34:17 +0200 In-Reply-To: <200603282108.k2SL80cV066804@repoman.freebsd.org> (Daniel Eischen's message of "Tue, 28 Mar 2006 21:08:00 +0000 (UTC)") Message-ID: <86mzfauucm.fsf@xps.des.no> User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libpthread/thread thr_barrier.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Mar 2006 21:34:26 -0000 --=-=-= Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Daniel Eischen 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 #include +#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) { --=-=-=--