@@ -34,16 +34,19 @@ unsigned long strtoul (const char *__restrict, char **__restrict, int);
3434long long strtoll (const char *__restrict, char **__restrict, int );
3535unsigned long long strtoull (const char *__restrict, char **__restrict, int );
3636
37- int rand (void );
38- void srand (unsigned );
39-
37+ // These 5 functions are implemented in rust in hyperlight_guest
38+ _Noreturn void abort (void );
4039void *malloc (size_t );
4140void *calloc (size_t , size_t );
4241void *realloc (void *, size_t );
4342void free (void *);
43+
44+ #ifndef HYPERLIGHT
45+ int rand (void );
46+ void srand (unsigned );
47+
4448void *aligned_alloc (size_t , size_t );
4549
46- _Noreturn void abort (void );
4750int atexit (void (*) (void ));
4851_Noreturn void exit (int );
4952_Noreturn void _Exit (int );
@@ -53,6 +56,7 @@ _Noreturn void quick_exit (int);
5356char *getenv (const char *);
5457
5558int system (const char *);
59+ #endif // HYPERLIGHT
5660
5761void *bsearch (const void *, const void *, size_t , size_t , int (*)(const void *, const void *));
5862void qsort (void *, size_t , size_t , int (*)(const void *, const void *));
@@ -84,9 +88,9 @@ size_t __ctype_get_mb_cur_max(void);
8488#define RAND_MAX (0x7fffffff )
8589
8690
87- #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
91+ #if ( defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
8892 || defined (_XOPEN_SOURCE) || defined (_GNU_SOURCE) \
89- || defined (_BSD_SOURCE)
93+ || defined (_BSD_SOURCE)) && ! defined (HYPERLIGHT)
9094
9195#define WNOHANG 1
9296#define WUNTRACED 2
@@ -110,8 +114,8 @@ int rand_r (unsigned *);
110114#endif
111115
112116
113- #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
114- || defined (_BSD_SOURCE)
117+ #if ( defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
118+ || defined (_BSD_SOURCE)) && ! defined (HYPERLIGHT)
115119char *realpath (const char *__restrict, char *__restrict);
116120long int random (void );
117121void srandom (unsigned int );
@@ -136,8 +140,8 @@ unsigned short *seed48 (unsigned short [3]);
136140void lcong48 (unsigned short [7 ]);
137141#endif
138142
139- #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
140143#include < alloca.h>
144+ #if (defined(_GNU_SOURCE) || defined(_BSD_SOURCE)) && !defined(HYPERLIGHT)
141145char *mktemp (char *);
142146int mkstemps (char *, int );
143147int mkostemps (char *, int , int );
0 commit comments