RtsUtils.h 1.37 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
extern void *stgMallocBytes(int n, char *msg)
    GNUC3_ATTRIBUTE(__malloc__);
18

19
extern void *stgReallocBytes(void *p, int n, char *msg);
20

21
22
extern void *stgCallocBytes(int n, int m, char *msg)
     GNUC3_ATTRIBUTE(__malloc__);
23

sof's avatar
sof committed
24
extern void stgFree(void* p);
25

26
27
28
/* -----------------------------------------------------------------------------
 * Misc other utilities
 * -------------------------------------------------------------------------- */
29
30
31

extern void heapOverflow(void);

32
33
extern void setNonBlockingFd(int fd);
extern void resetNonBlockingFd(int fd);
34

35
36
extern nat stg_strlen(char *str);

37
38
extern char *time_str(void);
extern char *ullong_format_string(ullong, char *, rtsBool);
39

sof's avatar
sof committed
40
#ifdef PAR
41
extern ullong msTime(void);
sof's avatar
sof committed
42
#endif
43

sof's avatar
sof committed
44
45
46
#ifdef DEBUG
extern void heapCheckFail( void );
#endif
47
48
49

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

51
#endif /* RTSUTILS_H */