From 5c228063bc0a8ed3dcbce9b0801e51d7dde5092b Mon Sep 17 00:00:00 2001 From: eck Date: Fri, 19 Jan 1990 16:25:54 +0000 Subject: [PATCH] forgot _sbrk(), _fstat(), _times() --- mach/sun3/libsys/LIST | 4 ++++ mach/sun3/libsys/Xstat.c | 2 +- mach/sun3/libsys/_Xstat.c | 32 ++++++++++++++++++++++++++++++ mach/sun3/libsys/_sbrk.s | 41 +++++++++++++++++++++++++++++++++++++++ mach/sun3/libsys/_times.c | 16 +++++++++++++++ mach/sun3/libsys/fstat.s | 4 ++-- 6 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 mach/sun3/libsys/_Xstat.c create mode 100644 mach/sun3/libsys/_sbrk.s create mode 100644 mach/sun3/libsys/_times.c diff --git a/mach/sun3/libsys/LIST b/mach/sun3/libsys/LIST index 9eeeb7c1c..1d50aa9a6 100644 --- a/mach/sun3/libsys/LIST +++ b/mach/sun3/libsys/LIST @@ -34,7 +34,9 @@ flock.s fork.s _fork.s Xstat.c +_Xstat.c fstat.s +_fstat.s fstatfs.s fsync.s ftime.c @@ -107,6 +109,7 @@ recvmsg.s rename.s rmdir.s sbrk.s +_sbrk.s select.s semsys.s send.s @@ -147,6 +150,7 @@ sync.s syscall.s time.c times.c +_times.c truncate.s umask.s unlink.s diff --git a/mach/sun3/libsys/Xstat.c b/mach/sun3/libsys/Xstat.c index d48475836..b4c688992 100644 --- a/mach/sun3/libsys/Xstat.c +++ b/mach/sun3/libsys/Xstat.c @@ -37,7 +37,7 @@ fstat(fd, buf) char Xbuf[100]; int retval; - retval = _fstat(fd, Xbuf); + retval = __fstat(fd, Xbuf); Xcvt(Xbuf, (char *)buf); return retval; } diff --git a/mach/sun3/libsys/_Xstat.c b/mach/sun3/libsys/_Xstat.c new file mode 100644 index 000000000..ac8ad0e88 --- /dev/null +++ b/mach/sun3/libsys/_Xstat.c @@ -0,0 +1,32 @@ +#include +#include + +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++; +} diff --git a/mach/sun3/libsys/_sbrk.s b/mach/sun3/libsys/_sbrk.s new file mode 100644 index 000000000..cc34c334e --- /dev/null +++ b/mach/sun3/libsys/_sbrk.s @@ -0,0 +1,41 @@ +#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 diff --git a/mach/sun3/libsys/_times.c b/mach/sun3/libsys/_times.c new file mode 100644 index 000000000..1d6a7b9e5 --- /dev/null +++ b/mach/sun3/libsys/_times.c @@ -0,0 +1,16 @@ +#include + +#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; +} diff --git a/mach/sun3/libsys/fstat.s b/mach/sun3/libsys/fstat.s index 824df98bc..78bae40cf 100644 --- a/mach/sun3/libsys/fstat.s +++ b/mach/sun3/libsys/fstat.s @@ -1,4 +1,4 @@ #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) -- 2.34.1