[444] | 1 | /* Copyright (c) 1995 Cygnus Support |
---|
| 2 | * |
---|
| 3 | * The authors hereby grant permission to use, copy, modify, distribute, |
---|
| 4 | * and license this software and its documentation for any purpose, provided |
---|
| 5 | * that existing copyright notices are retained in all copies and that this |
---|
| 6 | * notice is included verbatim in any distributions. No written agreement, |
---|
| 7 | * license, or royalty fee is required for any of the authorized uses. |
---|
| 8 | * Modifications to this software may be copyrighted by their authors |
---|
| 9 | * and need not follow the licensing terms described here, provided that |
---|
| 10 | * the new terms are clearly indicated on the first page of each file where |
---|
| 11 | * they apply. |
---|
| 12 | * |
---|
| 13 | * fake unix routines for sparclite and remote debugger |
---|
| 14 | * Many of these routines just substitute an appropriate error status, |
---|
| 15 | * if you want some kind of file system access, you'll have to fill them in... |
---|
| 16 | * sbrk on the other hand is functional (malloc uses it) but it doesn't do |
---|
| 17 | * any checking for lack of memory. |
---|
| 18 | * kill and _exit could get more real implementations, as well. |
---|
| 19 | */ |
---|
| 20 | |
---|
| 21 | #include <sys/stat.h> |
---|
| 22 | |
---|
| 23 | int |
---|
| 24 | fstat(int _fd, struct stat* _sbuf) |
---|
| 25 | { |
---|
| 26 | /* this is used in a few places in stdio... */ |
---|
| 27 | /* just error, so they assume a pipe */ |
---|
| 28 | return -1; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | int |
---|
| 32 | isatty(int _fd) |
---|
| 33 | { |
---|
| 34 | return 1; |
---|
| 35 | } |
---|
| 36 | |
---|
| 37 | int |
---|
| 38 | close(int _fd) |
---|
| 39 | { |
---|
| 40 | /* return value usually ignored anyhow */ |
---|
| 41 | return 0; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | int |
---|
| 45 | open(char *filename) |
---|
| 46 | { |
---|
| 47 | /* always fail */ |
---|
| 48 | return -1; |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | int |
---|
| 52 | getpid() { |
---|
| 53 | return 1; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | int |
---|
| 57 | kill(int pid) { |
---|
| 58 | /* if we knew how to nuke the board, we would... */ |
---|
| 59 | return 0; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | void |
---|
| 63 | _exit(int status) { |
---|
| 64 | /* likewise... */ |
---|
| 65 | return; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | int |
---|
| 69 | lseek(int _fd, off_t offset, int whence) |
---|
| 70 | { |
---|
| 71 | /* nothing is ever seekable */ |
---|
| 72 | return -1; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | extern char end; |
---|
| 76 | char* |
---|
| 77 | sbrk(int incr) |
---|
| 78 | { |
---|
| 79 | static char* base; |
---|
| 80 | char *b; |
---|
| 81 | if(!base) base = &end; |
---|
| 82 | b = base; |
---|
| 83 | base += incr; |
---|
| 84 | return b; |
---|
| 85 | } |
---|