1#include <sys/types.h> 2#include <sys/stat.h> 3#include <sys/times.h> 4#include <errno.h> 5#include <stdio.h> 6#include <stdlib.h> 7#include <assert.h> 8 9size_t (*_libc_terminal_read_func)(char *, size_t); 10size_t (*_libc_terminal_write_func)(const char *, size_t); 11 12void (*_libc_assert_func)(const char *, const char *, const char *, int); 13 14typedef void *(*morecore_alloc_func_t)(size_t bytes, size_t *retbytes); 15morecore_alloc_func_t sys_morecore_alloc; 16 17typedef void (*morecore_free_func_t)(void *base, size_t bytes); 18morecore_free_func_t sys_morecore_free; 19 20int system(const char *cmd) 21{ 22 return -1; 23} 24 25clock_t times(struct tms *buf) 26{ 27 return -1; 28} 29 30void (*_libc_exit_func)(int) __attribute__((noreturn)); 31void _Exit(int status) 32{ 33 _libc_exit_func(status); 34} 35 36 37/* copied from oldc sys-barrelfish */ 38extern void sys_print(const char *, size_t); 39 40void abort(void) 41{ 42 // Do not use stderr here. It relies on too much to be working. 43 sys_print("Aborted\n", 8); 44 exit(EXIT_FAILURE); 45 46 // Can't assert() here (would re-enter abort()) 47 sys_print("FATAL: exit() returned in abort()!\n", 36); 48 for(;;); 49} 50