1 /* Support files for GNU libc. Files in the system namespace go here.
2 Files in the C namespace (ie those that do not start with an
3 underscore) go in .c. */
11 #include <sys/times.h>
14 #include <system_def.h>
16 /* Register name faking - works in collusion with the linker. */
17 register char * stack_ptr asm ("sp");
19 system_stub_ops_t system_stub_ops;
26 if(!system_stub_ops.read)
28 return system_stub_ops.read(file,ptr,len);
36 if(!system_stub_ops.write)
38 return system_stub_ops.write(file,ptr,len);
47 if(!system_stub_ops.lseek)
49 return system_stub_ops.lseek(file,pos,dir);
53 _open (const char * path,
57 if(!system_stub_ops.open)
59 return system_stub_ops.open(path,flags,0);
65 if(!system_stub_ops.close)
67 return system_stub_ops.close(file);
70 typedef int (local_call_t)(void);
95 extern char end asm ("end"); /* Defined by the linker. */
96 static char *heap_end;
101 if (heap_end == NULL)
104 prev_heap_end = heap_end;
106 if (heap_end + incr > stack_ptr)
108 /* Some of the libstdc++-v3 tests rely upon detecting
109 out of memory errors, so do not abort here. */
111 extern void abort (void);
113 _write (1, "_sbrk: Heap and stack collision\n", 32);
124 return (caddr_t) prev_heap_end;
128 _fstat (int file, struct stat * st)
133 int _stat (const char *fname, struct stat *st)
157 _gettimeofday (struct timeval * tp, struct timezone * tzp)
165 /* Return fixed data for the timezone. */
168 tzp->tz_minuteswest = 0;
175 /* Return a clock that ticks at 100Hz. */
177 _times (struct tms * tp)
183 tp->tms_utime = timeval; /* user time */
184 tp->tms_stime = 0; /* system time */
185 tp->tms_cutime = 0; /* user time, children */
186 tp->tms_cstime = 0; /* system time, children */
200 _system (const char *s)
206 _rename (const char * oldpath, const char * newpath)