RtsUtils.h 1.3 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
#pragma GCC visibility push(hidden)

14
/* -----------------------------------------------------------------------------
15
 * (Checked) dynamic allocation
16
17
 * -------------------------------------------------------------------------- */

Simon Marlow's avatar
Simon Marlow committed
18
19
void initAllocator(void);
void shutdownAllocator(void);
20

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

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

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

Simon Marlow's avatar
Simon Marlow committed
29
void stgFree(void* p);
30

31
32
33
/* -----------------------------------------------------------------------------
 * Misc other utilities
 * -------------------------------------------------------------------------- */
34

Simon Marlow's avatar
Simon Marlow committed
35
void heapOverflow(void);
36

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

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

44
45
void printRtsInfo(void);

Simon Marlow's avatar
Simon Marlow committed
46
47
48
/* Alternate to raise(3) for threaded rts, for OpenBSD */
int genericRaise(int sig);

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

51
52
#pragma GCC visibility pop

53
#endif /* RTSUTILS_H */