Last change
on this file since 544 was
444,
checked in by satin@…, 7 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
973 bytes
|
Rev | Line | |
---|
[444] | 1 | #include <sys/types.h> |
---|
| 2 | #include <sys/stat.h> |
---|
| 3 | |
---|
| 4 | static char *heap_end = 0; |
---|
| 5 | |
---|
| 6 | int |
---|
| 7 | brk (void *ptr) |
---|
| 8 | { |
---|
| 9 | heap_end = ptr; |
---|
| 10 | return 0; |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | caddr_t |
---|
| 14 | sbrk (int amt) |
---|
| 15 | { |
---|
| 16 | extern char end; |
---|
| 17 | char *prev_heap_end; |
---|
| 18 | |
---|
| 19 | if (heap_end == 0) |
---|
| 20 | heap_end = &end; |
---|
| 21 | prev_heap_end = heap_end; |
---|
| 22 | heap_end += amt; |
---|
| 23 | return ((caddr_t) prev_heap_end); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | int |
---|
| 27 | isatty (int file) |
---|
| 28 | { |
---|
| 29 | return file<3; |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | int |
---|
| 33 | fstat (int file, struct stat *st) |
---|
| 34 | { |
---|
| 35 | st->st_mode = S_IFCHR; |
---|
| 36 | return 0; |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | int |
---|
| 40 | stat (const char *__restrict filename, struct stat *__restrict st) |
---|
| 41 | { |
---|
| 42 | st->st_mode = S_IFCHR; |
---|
| 43 | return 0; |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | int |
---|
| 47 | lseek (int fd, off_t offset, int type) |
---|
| 48 | { |
---|
| 49 | return _sys_lseek (fd, offset, type); |
---|
| 50 | } |
---|
| 51 | |
---|
| 52 | int |
---|
| 53 | open (char *file, int mode, int perms) |
---|
| 54 | { |
---|
| 55 | return _sys_open (file, mode, perms); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | int |
---|
| 59 | close (int fd) |
---|
| 60 | { |
---|
| 61 | return _sys_close (fd); |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | int |
---|
| 65 | getpid () |
---|
| 66 | { |
---|
| 67 | return -1; |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | int |
---|
| 71 | kill (int pid, int signal) |
---|
| 72 | { |
---|
| 73 | exit (signal); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | #if 0 |
---|
| 77 | /* This conflicts with the abort defined in newlib. */ |
---|
| 78 | void |
---|
| 79 | abort () |
---|
| 80 | { |
---|
| 81 | exit (6); |
---|
| 82 | } |
---|
| 83 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.