PatchSet 6654 Date: 2005/06/21 16:11:48 Author: guilhem Branch: HEAD Tag: (none) Log: Fixed a few warnings.
* m4/ax_create_stdint_h.m4: Removed some broken & unused m4 code line. * configure: Regenerated. * config/config-std.h, kaffe/kaffevm/lerrno.h: Moved definition of ENOTSUP to prevent redefinition. * kaffe/kaffevm/debug.c, kaffe/kaffevm/systems/unix-pthreads/lock-impl.c, kaffe/kaffevm/systems/unix-pthreads/signal.c, kaffe/kaffevm/systems/unix-pthreads/thread-impl.c: Use lerrno.h instead of errno.h Members: ChangeLog:1.4180->1.4181 configure:1.462->1.463 config/config-std.h:INITIAL->1.16 kaffe/kaffevm/debug.c:1.64->1.65 kaffe/kaffevm/lerrno.h:1.1->1.2 kaffe/kaffevm/systems/unix-pthreads/lock-impl.c:INITIAL->1.23 kaffe/kaffevm/systems/unix-pthreads/signal.c:1.22->1.23 kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.84->1.85 m4/ax_create_stdint_h.m4:1.3->1.4 Index: kaffe/ChangeLog diff -u kaffe/ChangeLog:1.4180 kaffe/ChangeLog:1.4181 --- kaffe/ChangeLog:1.4180 Tue Jun 21 15:17:03 2005 +++ kaffe/ChangeLog Tue Jun 21 16:11:48 2005 @@ -1,5 +1,21 @@ 2005-06-21 Guilhem Lavaux <[EMAIL PROTECTED]> + * m4/ax_create_stdint_h.m4: Removed some broken & unused m4 code line. + + * configure: Regenerated. + + * config/config-std.h, + kaffe/kaffevm/lerrno.h: Moved definition of ENOTSUP to prevent + redefinition. + + * kaffe/kaffevm/debug.c, + kaffe/kaffevm/systems/unix-pthreads/lock-impl.c, + kaffe/kaffevm/systems/unix-pthreads/signal.c, + kaffe/kaffevm/systems/unix-pthreads/thread-impl.c: Use lerrno.h + instead of errno.h + +2005-06-21 Guilhem Lavaux <[EMAIL PROTECTED]> + * config/sparc/atomic-sparc64.h, config/mips/atomic.h: Removed gcc specific hacks. Moved into config-hacks.h Index: kaffe/configure diff -u kaffe/configure:1.462 kaffe/configure:1.463 --- kaffe/configure:1.462 Tue Jun 21 15:17:06 2005 +++ kaffe/configure Tue Jun 21 16:11:42 2005 @@ -34349,8 +34349,7 @@ and64="" fi - stdint.h inttypes.h sys/inttypes.h $inttype_headers - break + break done echo "$as_me:$LINENO: checking for stdint uintptr_t" >&5 echo $ECHO_N "checking for stdint uintptr_t... $ECHO_C" >&6 @@ -34500,8 +34499,6 @@ and64="" fi - inttypes.h sys/inttypes.h stdint.h $inttype_headers - break break; done echo "$as_me:$LINENO: checking for stdint uint32_t" >&5 @@ -34654,8 +34651,6 @@ and64="" fi - sys/types.h inttypes.h sys/inttypes.h $inttype_headers - break break; done echo "$as_me:$LINENO: checking for stdint u_int32_t" >&5 =================================================================== Checking out kaffe/config/config-std.h RCS: /home/cvs/kaffe/kaffe/config/config-std.h,v VERS: 1.16 *************** --- /dev/null Sun Aug 4 19:57:58 2002 +++ kaffe/config/config-std.h Tue Jun 21 16:18:44 2005 @@ -0,0 +1,71 @@ +/* + * config-std.h + * + * Copyright (c) 1996, 1997 + * Transvirtual Technologies, Inc. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution + * of this file. + */ + + +#include "config.h" +#ifndef __config_std_h +#define __config_std_h + +#include <stdio.h> +#include <stdlib.h> +#include <assert.h> + +#include "config.h" + +#if defined(HAVE_STRING_H) +#include <string.h> +#endif +#if defined(HAVE_UNISTD_H) +#include <unistd.h> +#endif +#if defined (HAVE_TIME_H) +#include <time.h> +#endif +#if defined(HAVE_SYS_TIME_H) +#include <sys/time.h> +#endif +#if defined(HAVE_SYS_TYPES_H) +#include <sys/types.h> +#endif +#if defined(HAVE_SYS_RESOURCE_H) +#include <sys/resource.h> +#endif +#if !defined (__CYGWIN__) +#if !defined(HAVE_WINDOWS_H) && defined(HAVE_WINNT_H) +#include <winnt.h> +#endif +#if defined(HAVE_WINTYPES_H) +#include <wintypes.h> +#endif +#endif /* ! __CYGWIN__ */ +#if defined(HAVE_BSD_LIBC_H) +#include <bsd/libc.h> +#endif +#if defined(HAVE_KERNEL_OS_H) +#include <kernel/OS.h> +#endif + +#undef __UNUSED__ +#if defined(__GNUC__) +#define __UNUSED__ __attribute__((__unused__)) +#else +#define __UNUSED__ +#endif + +/* SunOS has on_exit only */ +#if !defined(HAVE_ATEXIT) && defined(HAVE_ON_EXIT) +#define atexit(x) on_exit(x, 0) +#endif + +#if defined(WITH_DMALLOC) +# include <dmalloc.h> +#endif + +#endif Index: kaffe/kaffe/kaffevm/debug.c diff -u kaffe/kaffe/kaffevm/debug.c:1.64 kaffe/kaffe/kaffevm/debug.c:1.65 --- kaffe/kaffe/kaffevm/debug.c:1.64 Sat May 14 21:46:31 2005 +++ kaffe/kaffe/kaffevm/debug.c Tue Jun 21 16:11:55 2005 @@ -26,7 +26,7 @@ #include <stdio.h> -#include <errno.h> +#include "lerrno.h" #include "config.h" #include "config-std.h" #include "config-mem.h" Index: kaffe/kaffe/kaffevm/lerrno.h diff -u kaffe/kaffe/kaffevm/lerrno.h:1.1 kaffe/kaffe/kaffevm/lerrno.h:1.2 --- kaffe/kaffe/kaffevm/lerrno.h:1.1 Tue Mar 31 19:10:53 1998 +++ kaffe/kaffe/kaffevm/lerrno.h Tue Jun 21 16:11:55 2005 @@ -34,5 +34,13 @@ #if !defined(EISCONN) #define EISCONN NOERRNO #endif +#if !defined(EOPNOTSUPP) +#define EOPNOTSUPP NOERRNO +#endif + +/* This is for NetBSD */ +#if !defined(ENOTSUP) +#define ENOTSUP EOPNOTSUPP +#endif #endif =================================================================== Checking out kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.c RCS: /home/cvs/kaffe/kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.c,v VERS: 1.23 *************** --- /dev/null Sun Aug 4 19:57:58 2002 +++ kaffe/kaffe/kaffevm/systems/unix-pthreads/lock-impl.c Tue Jun 21 16:18:44 2005 @@ -0,0 +1,183 @@ +/* + * lock-impl.c - pthread-based LockInterface implementation (Posix style) + * + * Copyright (c) 1998 + * Transvirtual Technologies, Inc. All rights reserved. + * + * See the file "license.terms" for information on usage and redistribution + * of this file. + */ + +#include "config.h" +#include "config-std.h" +#include "lerrno.h" +#include "debug.h" + +#include "jthread.h" +/* For NOTIMEOUT */ +#include "jsyscall.h" +#ifdef KAFFE_BOEHM_GC +#include "boehm-gc/boehm/include/gc.h" +#endif +#include <signal.h> + +static +void +setBlockState(jthread_t cur, unsigned int newState, void *sp, sigset_t *old_mask) +{ + int suspendSig; + sigset_t suspendMask, pendingMask; + + suspendSig = KaffePThread_getSuspendSignal(); + sigemptyset(&suspendMask); + sigaddset(&suspendMask, suspendSig); + pthread_sigmask(SIG_BLOCK, &suspendMask, old_mask); + + pthread_mutex_lock(&cur->suspendLock); + cur->blockState |= newState; + cur->stackCur = sp; + pthread_mutex_unlock(&cur->suspendLock); + + /* This thread is protected against suspendall. So if a signal has been + * received it is just before the mutex_lock and after pthread_sigmask. + * We must acknowledge and go in WaitForResume. + */ + sigpending(&pendingMask); + if (sigismember(&pendingMask, suspendSig)) + { + KaffePThread_AckAndWaitForResume(cur, newState); + } +} + +void KaffePThread_setBlockingCall(void *sigdata) +{ + jthread_t cur = jthread_current(); + + setBlockState(cur, BS_SYSCALL, (void*)&cur, (sigset_t*)sigdata); +} + +static inline void +clearBlockState(jthread_t cur, unsigned int newState, sigset_t *old_mask) +{ + pthread_mutex_lock(&cur->suspendLock); + cur->blockState &= ~newState; + if (cur->suspendState == SS_SUSPENDED) + { + DBG(JTHREADDETAIL, dprintf("Changing blockstate of %p to %d while in suspend, block again\n", cur, newState)); + + KaffePThread_WaitForResume(true, 0); + } + else + { + cur->stackCur = NULL; + pthread_mutex_unlock(&cur->suspendLock); + } + + /* Catch an interrupt event sent while we were being killed. + * This is needed for Darwin's pthreads. + */ + if (cur->status == THREAD_KILL && ((cur->blockState & BS_THREAD) == 0)) + { + /* Mark the thread as inactive now to acknowledge the shutdown. */ + cur->active = 0; + pthread_exit(NULL); + } + + pthread_sigmask(SIG_SETMASK, old_mask, NULL); + /* Here the state is not SS_PENDING_SUSPEND so releasing the signal will + * not trigger a deadlock. + */ +} + +void KaffePThread_clearBlockingCall(void *sigdata) +{ + jthread_t cur = jthread_current(); + + clearBlockState(cur, BS_SYSCALL, (sigset_t *)sigdata); +} + +void +jmutex_lock(jmutex* lk ) +{ + jthread_t cur = jthread_current (); + sigset_t oldmask; + + setBlockState(cur, BS_MUTEX, (void*)&cur, &oldmask); + pthread_mutex_lock( lk ); + clearBlockState(cur, BS_MUTEX, &oldmask); +} + + +static inline int +ThreadCondWait(jthread_t cur, jcondvar *cv, jmutex *mux) +{ + int status = 0; + sigset_t oldmask; + + setBlockState(cur, BS_CV, (void*)&status, &oldmask); + status = pthread_cond_wait( cv, mux ); + clearBlockState(cur, BS_CV, &oldmask); + + return status; +} + +/* + * Wait on the condvar with a given relative timeout in ms (which we + * have to convert into a absolute timespec now) + */ +jboolean +jcondvar_wait (jcondvar* cv, jmutex *mux, jlong timeout ) +{ + jthread_t cur = jthread_current(); + int status = 0; + + /* + * If a thread trying to get a heavy lock is interrupted, we may get here + * with the interrupted flag set (because the thread didn't get the heavy + * lock and has to wait again). Therefore, we must not clear the interrupted + * flag here. + */ + + if ( timeout == NOTIMEOUT ) + { + /* we handle this as "wait forever" */ + status = ThreadCondWait(cur, cv, mux); + } + else + { + sigset_t oldmask; + struct timespec abst; + struct timeval now; + /* timeout is in millisecs, timeval in microsecs, and timespec in nanosecs */ + gettimeofday( &now, NULL); + abst.tv_sec = now.tv_sec + (timeout / 1000); + if( abst.tv_sec < now.tv_sec ) + { + /* huge timeout value, we handle this as "wait forever" */ + status = ThreadCondWait(cur, cv, mux); + } + else + { + abst.tv_nsec = (now.tv_usec * 1000) + (timeout % 1000) * 1000000; + + if (abst.tv_nsec > 1000000000) + { + abst.tv_sec += 1; + abst.tv_nsec -= 1000000000; + } + + setBlockState(cur, BS_CV_TO, (void*)&status, &oldmask); + status = pthread_cond_timedwait( cv, mux, &abst); + clearBlockState(cur, BS_CV_TO, &oldmask); + } + } + + /* + * Since we interrupt a thread blocked on a condition variable by signaling that + * condition variable, we cannot set the interrupted flag based on the value of + * 'signal'. Therefore, we have to rely on the interrupting thread to set the + * flag. + */ + + return (status == 0); +} Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c:1.22 kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c:1.23 --- kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c:1.22 Tue May 31 17:55:49 2005 +++ kaffe/kaffe/kaffevm/systems/unix-pthreads/signal.c Tue Jun 21 16:11:56 2005 @@ -22,7 +22,7 @@ #include "thread-internal.h" #include "files.h" #include "kaffe/jmalloc.h" -#include <errno.h> +#include "lerrno.h" #ifdef KAFFE_BOEHM_GC #include "boehm-gc/boehm/include/gc.h" #endif Index: kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c diff -u kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.84 kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.85 --- kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c:1.84 Mon May 30 09:24:01 2005 +++ kaffe/kaffe/kaffevm/systems/unix-pthreads/thread-impl.c Tue Jun 21 16:11:56 2005 @@ -12,7 +12,7 @@ * of this file. */ -#include <errno.h> +#include "lerrno.h" #include <limits.h> #include "config.h" Index: kaffe/m4/ax_create_stdint_h.m4 diff -u kaffe/m4/ax_create_stdint_h.m4:1.3 kaffe/m4/ax_create_stdint_h.m4:1.4 --- kaffe/m4/ax_create_stdint_h.m4:1.3 Sun Jun 19 13:47:28 2005 +++ kaffe/m4/ax_create_stdint_h.m4 Tue Jun 21 16:11:57 2005 @@ -30,7 +30,7 @@ dnl file will include it directly. No need for fuzzy HAVE_STDINT_H things... dnl dnl @, (status: used on new platforms) (see http://ac-archive.sf.net/gstdint/) -dnl @version $Id: ax_create_stdint_h.m4,v 1.3 2005/06/19 13:47:28 guilhem Exp $ +dnl @version $Id: ax_create_stdint_h.m4,v 1.4 2005/06/21 16:11:57 guilhem Exp $ dnl @author Guido Draheim <[EMAIL PROTECTED]> AC_DEFUN([AX_CHECK_DATA_MODEL],[ @@ -80,7 +80,7 @@ unset ac_cv_type_uint64_t AC_CHECK_TYPE(uintptr_t,[ac_cv_header_stdint_x=$i],continue,[#include <$i>]) AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) - m4_ifvaln([$1],[$1]) break + break done AC_MSG_CHECKING([for stdint uintptr_t]) ]) @@ -95,7 +95,6 @@ unset ac_cv_type_uint64_t AC_CHECK_TYPE(uint32_t,[ac_cv_header_stdint_o=$i],continue,[#include <$i>]) AC_CHECK_TYPE(uint64_t,[and64="/uint64_t"],[and64=""],[#include<$i>]) - m4_ifvaln([$1],[$1]) break break; done AC_MSG_CHECKING([for stdint uint32_t]) @@ -111,7 +110,6 @@ unset ac_cv_type_u_int64_t AC_CHECK_TYPE(u_int32_t,[ac_cv_header_stdint_u=$i],continue,[#include <$i>]) AC_CHECK_TYPE(u_int64_t,[and64="/u_int64_t"],[and64=""],[#include<$i>]) - m4_ifvaln([$1],[$1]) break break; done AC_MSG_CHECKING([for stdint u_int32_t]) _______________________________________________ kaffe mailing list kaffe@kaffe.org http://kaffe.org/cgi-bin/mailman/listinfo/kaffe