X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Frts%2FRtsUtils.c;h=6ff4f72109efd14f8caab9e0ed869c0eaefa1fff;hb=19c26e39936644d9c401b31904cedb52349a0efc;hp=64b7758d356807e50b652c76052aa8d13f049a10;hpb=fbe64026eac8b559693868f38e6a9e6dad8a8ec6;p=ghc-hetmet.git diff --git a/ghc/rts/RtsUtils.c b/ghc/rts/RtsUtils.c index 64b7758..6ff4f72 100644 --- a/ghc/rts/RtsUtils.c +++ b/ghc/rts/RtsUtils.c @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: RtsUtils.c,v 1.30 2003/03/19 18:41:19 sof Exp $ + * $Id: RtsUtils.c,v 1.36 2003/10/21 11:51:15 stolz Exp $ * * (c) The GHC Team, 1998-2002 * @@ -42,8 +42,8 @@ barf(char *s, ...) va_list ap; va_start(ap,s); /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ - if (prog_argv != NULL && prog_argv[0] != NULL) { - fprintf(stderr, "%s: internal error: ", prog_argv[0]); + if (prog_argv != NULL && prog_name != NULL) { + fprintf(stderr, "%s: internal error: ", prog_name); } else { fprintf(stderr, "internal error: "); } @@ -61,8 +61,8 @@ prog_belch(char *s, ...) va_list ap; va_start(ap,s); /* don't fflush(stdout); WORKAROUND bug in Linux glibc */ - if (prog_argv != NULL && prog_argv[0] != NULL) { - fprintf(stderr, "%s: ", prog_argv[0]); + if (prog_argv != NULL && prog_name != NULL) { + fprintf(stderr, "%s: ", prog_name); } vfprintf(stderr, s, ap); fprintf(stderr, "\n"); @@ -109,18 +109,6 @@ stgReallocBytes (void *p, int n, char *msg) } void * -stgMallocWords (int n, char *msg) -{ - return(stgMallocBytes(n * sizeof(W_), msg)); -} - -void * -stgReallocWords (void *p, int n, char *msg) -{ - return(stgReallocBytes(p, n * sizeof(W_), msg)); -} - -void * stgCallocBytes (int n, int m, char *msg) { int i; @@ -130,6 +118,15 @@ stgCallocBytes (int n, int m, char *msg) return p; } +/* To simplify changing the underlying allocator used + * by stgMallocBytes(), provide stgFree() as well. + */ +void +stgFree(void* p) +{ + free(p); +} + void _stgAssert (char *filename, unsigned int linenum) { @@ -252,14 +249,19 @@ setNonBlockingFd(int fd) /* clear the non-blocking flag on this file descriptor */ fd_flags = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, fd_flags | O_NONBLOCK); + if (!(fd_flags & O_NONBLOCK)) { + fcntl(fd, F_SETFL, fd_flags | O_NONBLOCK); + } } #else -/* Don't support non-blocking FDs (yet) on mingw */ +/* Stub defns -- async / non-blocking IO is not done + * via O_NONBLOCK and select() under Win32. + */ void resetNonBlockingFd(int fd STG_UNUSED) {} void setNonBlockingFd(int fd STG_UNUSED) {} #endif +#ifdef PAR static ullong startTime = 0; /* used in a parallel setup */ @@ -294,6 +296,7 @@ msTime(void) return t * LL(1000) - startTime; # endif } +#endif /* PAR */ /* ----------------------------------------------------------------------------- Print large numbers, with punctuation.