RTS tidyup sweep, first phase
[ghc-hetmet.git] / rts / RtsUtils.h
1 /* -----------------------------------------------------------------------------
2  *
3  * (c) The GHC Team, 1998-2009
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 void initAllocator(void);
17 void shutdownAllocator(void);
18
19 void *stgMallocBytes(int n, char *msg)
20     GNUC3_ATTRIBUTE(__malloc__);
21
22 void *stgReallocBytes(void *p, int n, char *msg);
23
24 void *stgCallocBytes(int n, int m, char *msg)
25      GNUC3_ATTRIBUTE(__malloc__);
26
27 void stgFree(void* p);
28
29 /* -----------------------------------------------------------------------------
30  * Misc other utilities
31  * -------------------------------------------------------------------------- */
32
33 void heapOverflow(void);
34
35 char *time_str(void);
36 char *ullong_format_string(ullong, char *, rtsBool);
37
38 #ifdef DEBUG
39 void heapCheckFail( void );
40 #endif
41
42 // XXX shouldn't be here
43 void* __hscore_get_saved_termios(int fd);
44 void  __hscore_set_saved_termios(int fd, void* ts);
45
46 void printRtsInfo(void);
47
48 HsInt genSymZh(void);
49 HsInt resetGenSymZh(void);
50
51 /* Alternate to raise(3) for threaded rts, for OpenBSD */
52 int genericRaise(int sig);
53
54 int rts_isProfiled(void);
55
56 #endif /* RTSUTILS_H */