[project @ 2004-09-06 11:10:32 by simonmar]
[ghc-hetmet.git] / ghc / rts / RtsUtils.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 1998-2004
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 *stgMallocBytes(int n, char *msg)
17     GNUC3_ATTRIBUTE(__malloc__);
18
19 extern void *stgReallocBytes(void *p, int n, char *msg);
20
21 extern void *stgCallocBytes(int n, int m, char *msg)
22      GNUC3_ATTRIBUTE(__malloc__);
23
24 extern void stgFree(void* p);
25
26 /* -----------------------------------------------------------------------------
27  * Misc other utilities
28  * -------------------------------------------------------------------------- */
29
30 extern void _stgAssert (char *filename, unsigned int linenum);
31
32 extern void heapOverflow(void);
33
34 extern void setNonBlockingFd(int fd);
35 extern void resetNonBlockingFd(int fd);
36
37 extern nat stg_strlen(char *str);
38
39 extern char *time_str(void);
40 extern char *ullong_format_string(ullong, char *, rtsBool);
41
42 #ifdef PAR
43 extern ullong msTime(void);
44 #endif
45
46 #ifdef DEBUG
47 extern void heapCheckFail( void );
48 #endif
49
50 extern void* __hscore_get_saved_termios(int fd);
51 extern void __hscore_set_saved_termios(int fd, void* ts);
52
53 #endif // RTSUTILS_H