Windows: give a better error message when running out of memory
[ghc.git] / rts / RtsUtils.h
1 /* -----------------------------------------------------------------------------
2 *
3 * (c) The GHC Team, 1998-2005
4 *
5 * General utility functions used in the RTS.
6 *
7 * ---------------------------------------------------------------------------*/
8
9 #ifndef RTSUTILS_H
10 #define RTSUTILS_H
11
12 /* -----------------------------------------------------------------------------
13 * (Checked) dynamic allocation
14 * -------------------------------------------------------------------------- */
15
16 extern void initAllocator(void);
17 extern void shutdownAllocator(void);
18
19 extern void *stgMallocBytes(int n, char *msg)
20 GNUC3_ATTRIBUTE(__malloc__);
21
22 extern void *stgReallocBytes(void *p, int n, char *msg);
23
24 extern void *stgCallocBytes(int n, int m, char *msg)
25 GNUC3_ATTRIBUTE(__malloc__);
26
27 extern void stgFree(void* p);
28
29 /* -----------------------------------------------------------------------------
30 * Misc other utilities
31 * -------------------------------------------------------------------------- */
32
33 extern void heapOverflow(void);
34
35 extern void setNonBlockingFd(int fd);
36 extern void resetNonBlockingFd(int fd);
37
38 extern nat stg_strlen(char *str);
39
40 extern char *time_str(void);
41 extern char *ullong_format_string(ullong, char *, rtsBool);
42
43 #ifdef PAR
44 extern ullong msTime(void);
45 #endif
46
47 #ifdef DEBUG
48 extern void heapCheckFail( void );
49 #endif
50
51 extern void* __hscore_get_saved_termios(int fd);
52 extern void __hscore_set_saved_termios(int fd, void* ts);
53
54 void printRtsInfo(void);
55
56 #endif /* RTSUTILS_H */