RtsUtils.h 1.29 KB
Newer Older
1
/* -----------------------------------------------------------------------------
2
 *
Simon Marlow's avatar
Simon Marlow committed
3
 * (c) The GHC Team, 1998-2009
4
5
6
7
8
 *
 * General utility functions used in the RTS.
 *
 * ---------------------------------------------------------------------------*/

9
10
11
#ifndef RTSUTILS_H
#define RTSUTILS_H

12
/* -----------------------------------------------------------------------------
13
 * (Checked) dynamic allocation
14
15
 * -------------------------------------------------------------------------- */

Simon Marlow's avatar
Simon Marlow committed
16
17
void initAllocator(void);
void shutdownAllocator(void);
18

Simon Marlow's avatar
Simon Marlow committed
19
void *stgMallocBytes(int n, char *msg)
20
    GNUC3_ATTRIBUTE(__malloc__);
21

Simon Marlow's avatar
Simon Marlow committed
22
void *stgReallocBytes(void *p, int n, char *msg);
23

Simon Marlow's avatar
Simon Marlow committed
24
void *stgCallocBytes(int n, int m, char *msg)
25
     GNUC3_ATTRIBUTE(__malloc__);
26

Simon Marlow's avatar
Simon Marlow committed
27
void stgFree(void* p);
28

29
30
31
/* -----------------------------------------------------------------------------
 * Misc other utilities
 * -------------------------------------------------------------------------- */
32

Simon Marlow's avatar
Simon Marlow committed
33
void heapOverflow(void);
34

Simon Marlow's avatar
Simon Marlow committed
35
36
char *time_str(void);
char *ullong_format_string(ullong, char *, rtsBool);
37

sof's avatar
sof committed
38
#ifdef DEBUG
Simon Marlow's avatar
Simon Marlow committed
39
void heapCheckFail( void );
sof's avatar
sof committed
40
#endif
41

42
43
void printRtsInfo(void);

Simon Marlow's avatar
Simon Marlow committed
44
45
46
47
48
49
HsInt genSymZh(void);
HsInt resetGenSymZh(void);

/* Alternate to raise(3) for threaded rts, for OpenBSD */
int genericRaise(int sig);

Simon Marlow's avatar
Simon Marlow committed
50
51
int rts_isProfiled(void);

52
#endif /* RTSUTILS_H */