X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsUtils.c;h=a8ce114fae5ce808c40db2d0707f91aaa7d2173d;hb=b8341ac79de539aadc0bc69d45396ebe7e0cadc5;hp=5e53b7db625f20ede22caba6b8068c34a9d8fbb0;hpb=1b28d4e1f43185ad8c8e7407c66413e1b358402b;p=ghc-hetmet.git diff --git a/ghc/rts/RtsUtils.c b/ghc/rts/RtsUtils.c index 5e53b7d..a8ce114 100644 --- a/ghc/rts/RtsUtils.c +++ b/ghc/rts/RtsUtils.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsUtils.c,v 1.13 2000/01/13 14:34:04 hwloidl Exp $ + * $Id: RtsUtils.c,v 1.22 2001/08/29 15:02:02 sewardj Exp $ * * (c) The GHC Team, 1998-1999 * @@ -7,6 +7,9 @@ * * ---------------------------------------------------------------------------*/ +/* gettimeofday isn't POSIX */ +/* #include "PosixSource.h" */ + #include "Rts.h" #include "RtsTypes.h" #include "RtsAPI.h" @@ -109,11 +112,22 @@ stgReallocWords (void *p, int n, char *msg) return(stgReallocBytes(p, n * sizeof(W_), msg)); } +void * +stgCallocBytes (int n, int m, char *msg) +{ + int i; + int sz = n * m; + char* p = stgMallocBytes(sz, msg); + for (i = 0; i < sz; i++) p[i] = 0; + return p; +} + void -_stgAssert (char *filename, nat linenum) +_stgAssert (char *filename, unsigned int linenum) { - /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ + fflush(stdout); fprintf(stderr, "ASSERTION FAILED: file %s, line %u\n", filename, linenum); + fflush(stderr); abort(); } @@ -215,7 +229,7 @@ resetNonBlockingFd(int fd) { long fd_flags; -#if !defined(_WIN32) || defined(__CYGWIN__) || defined(__CYGWIN32__) +#if !defined(mingw32_TARGET_OS) /* clear the non-blocking flag on this file descriptor */ fd_flags = fcntl(fd, F_GETFL); if (fd_flags & O_NONBLOCK) { @@ -224,14 +238,13 @@ resetNonBlockingFd(int fd) #endif } -#if 0 static ullong startTime = 0; /* used in a parallel setup */ ullong msTime(void) { -# if defined(HAVE_GETCLOCK) && !defined(alpha_TARGET_ARCH) +# if defined(HAVE_GETCLOCK) && !defined(alpha_TARGET_ARCH) && !defined(hppa1_1_TARGET_ARCH) struct timespec tv; if (getclock(TIMEOFDAY, &tv) != 0) { @@ -259,8 +272,6 @@ msTime(void) return t * LL(1000) - startTime; # endif } -#endif - /* ----------------------------------------------------------------------------- Print large numbers, with punctuation.