RtsUtils.h 1.44 KB
Newer Older
1
/* -----------------------------------------------------------------------------
2
 *
3
 * (c) The GHC Team, 1998-2005
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
 * -------------------------------------------------------------------------- */

16
17
18
extern void initAllocator(void);
extern void shutdownAllocator(void);

19
20
extern void *stgMallocBytes(int n, char *msg)
    GNUC3_ATTRIBUTE(__malloc__);
21

22
extern void *stgReallocBytes(void *p, int n, char *msg);
23

24
25
extern void *stgCallocBytes(int n, int m, char *msg)
     GNUC3_ATTRIBUTE(__malloc__);
26

sof's avatar
sof committed
27
extern void stgFree(void* p);
28

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

extern void heapOverflow(void);

35
36
extern void setNonBlockingFd(int fd);
extern void resetNonBlockingFd(int fd);
37

38
39
extern nat stg_strlen(char *str);

40
41
extern char *time_str(void);
extern char *ullong_format_string(ullong, char *, rtsBool);
42

sof's avatar
sof committed
43
#ifdef PAR
44
extern ullong msTime(void);
sof's avatar
sof committed
45
#endif
46

sof's avatar
sof committed
47
48
49
#ifdef DEBUG
extern void heapCheckFail( void );
#endif
50
51
52

extern void* __hscore_get_saved_termios(int fd);
extern void __hscore_set_saved_termios(int fd, void* ts);
53

54
#endif /* RTSUTILS_H */