fork.s
_fork.s
Xstat.c
+_Xstat.c
fstat.s
+_fstat.s
fstatfs.s
fsync.s
ftime.c
rename.s
rmdir.s
sbrk.s
+_sbrk.s
select.s
semsys.s
send.s
syscall.s
time.c
times.c
+_times.c
truncate.s
umask.s
unlink.s
char Xbuf[100];
int retval;
- retval = _fstat(fd, Xbuf);
+ retval = __fstat(fd, Xbuf);
Xcvt(Xbuf, (char *)buf);
return retval;
}
--- /dev/null
+#include <sys/types.h>
+#include <sys/stat.h>
+
+static Xcvt();
+
+int
+_fstat(fd, buf)
+ int fd;
+ struct stat *buf;
+{
+ char Xbuf[100];
+ int retval;
+
+ retval = __fstat(fd, Xbuf);
+ Xcvt(Xbuf, (char *)buf);
+ return retval;
+}
+
+static
+Xcvt(buf, statbuf)
+ char *buf, *statbuf;
+{
+ register char *s, *t;
+ register int i;
+
+ s = buf; t = statbuf;
+ *t++ = *s++; *t++ = *s++;
+ *t++ = 0; *t++ = 0;
+ for (i = 14; i; i--) *t++ = *s++;
+ *t++ = 0; *t++ = 0;
+ for (i = 44; i; i--) *t++ = *s++;
+}
--- /dev/null
+#include "syscall.h"
+.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
+.define __sbrk,__brk
+__sbrk:
+ move.l (4,sp),d0
+ add.l #3,d0
+ move.l #~3,d1
+ and.l d1,d0
+ move.l d0,a0
+ move.l (curbrk),d0
+ add.l #3,d0
+ and.l d1,d0
+ move.l d0,(curbrk)
+ add.l d0,a0
+ move.l a0,(4,sp)
+ pea (17) ! not SYS_sbrk
+ trap #0
+ bcs 1f
+ move.l (curbrk),d0
+ move.l (4,sp),(curbrk)
+ rts
+1:
+ jmp (cerror)
+
+__brk:
+ move.l (4,sp),d0
+ add.l #3,d0
+ move.l #~3,d1
+ and.l d1,d0
+ move.l d0,(4,sp)
+ pea (17)
+ trap #0
+ bcs 1f
+ move.l (4,sp),(curbrk)
+ clr.l d0
+ rts
+1:
+ jmp (cerror)
+
+.sect .data
+curbrk: .data4 endbss
--- /dev/null
+#include <sys/types.h>
+
+#define Xval(xx) ((xx).l1*60+(xx).l2/(100000/6))
+
+_times(bp)
+ struct { time_t l1,l2,l3,l4;} *bp;
+{
+ struct { struct { long l1,l2; }s1,s2; long x[20]; } t;
+ if (_getrusage(0,&t) < 0) return -1;
+ bp->l1 = Xval(t.s1);
+ bp->l2 = Xval(t.s2);
+ if (_getrusage(-1,&t) < 0) return -1;
+ bp->l3 = Xval(t.s1);
+ bp->l4 = Xval(t.s2);
+ return 0;
+}
#include "syscall.h"
.sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
-.define __fstat
-__fstat: SYSTEM(SYS_fstat)
+.define ___fstat
+___fstat: SYSTEM(SYS_fstat)