X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsUtils.c;h=a8ce114fae5ce808c40db2d0707f91aaa7d2173d;hb=fcfe16433bd582d0e00404ea652806d13d14103c;hp=2b929c9dfb374be5794a12dba35e8b7c9a1a7dee;hpb=dd4c28a9c706cce09ecc2c6f532969efa925532f;p=ghc-hetmet.git diff --git a/ghc/rts/RtsUtils.c b/ghc/rts/RtsUtils.c index 2b929c9..a8ce114 100644 --- a/ghc/rts/RtsUtils.c +++ b/ghc/rts/RtsUtils.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsUtils.c,v 1.14 2000/03/31 03:09:36 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) { @@ -230,7 +244,7 @@ static ullong startTime = 0; 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) {