4 FILE_LICENCE ( GPL2_OR_LATER
);
9 /*****************************************************************************
13 ****************************************************************************
16 extern unsigned long strtoul ( const char *p
, char **endp
, int base
);
18 /*****************************************************************************
22 ****************************************************************************
25 extern void * __malloc
malloc ( size_t size
);
26 extern void * realloc ( void *old_ptr
, size_t new_size
);
27 extern void free ( void *ptr
);
28 extern void * __malloc
zalloc ( size_t len
);
31 * Allocate cleared memory
33 * @v nmemb Number of members
34 * @v size Size of each member
35 * @ret ptr Allocated memory
37 * Allocate memory as per malloc(), and zero it.
39 * This is implemented as a static inline, with the body of the
40 * function in zalloc(), since in most cases @c nmemb will be 1 and
41 * doing the multiply is just wasteful.
43 static inline void * __malloc
calloc ( size_t nmemb
, size_t size
) {
44 return zalloc ( nmemb
* size
);
47 /*****************************************************************************
49 * Random number generation
51 ****************************************************************************
54 extern long int random ( void );
55 extern void srandom ( unsigned int seed
);
57 static inline int rand ( void ) {
61 static inline void srand ( unsigned int seed
) {
65 /*****************************************************************************
69 ****************************************************************************
72 extern int system ( const char *command
);
73 extern __asmcall
int main ( void );