source: trunk/libs/newlib/src/libgloss/sparc/syscalls.c @ 450

Last change on this file since 450 was 444, checked in by satin@…, 6 years ago

add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc

File size: 1.8 KB
Line 
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
23int
24fstat(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
31int
32isatty(int _fd)
33{
34  return 1;
35}
36
37int
38close(int _fd)
39{
40  /* return value usually ignored anyhow */
41  return 0;
42}
43
44int 
45open(char *filename)
46{
47  /* always fail */
48  return -1;
49}
50
51int 
52getpid() {
53  return 1;
54}
55
56int 
57kill(int pid) {
58  /* if we knew how to nuke the board, we would... */
59  return 0;
60}
61
62void
63_exit(int status) {
64  /* likewise... */
65  return;
66}
67
68int
69lseek(int _fd, off_t offset, int whence)
70{
71  /* nothing is ever seekable */
72  return -1;
73}
74
75extern char end;
76char*
77sbrk(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}
Note: See TracBrowser for help on using the repository browser.