forgot _sbrk(), _fstat(), _times()
authoreck <none@none>
Fri, 19 Jan 1990 16:25:54 +0000 (16:25 +0000)
committereck <none@none>
Fri, 19 Jan 1990 16:25:54 +0000 (16:25 +0000)
mach/sun3/libsys/LIST
mach/sun3/libsys/Xstat.c
mach/sun3/libsys/_Xstat.c [new file with mode: 0644]
mach/sun3/libsys/_sbrk.s [new file with mode: 0644]
mach/sun3/libsys/_times.c [new file with mode: 0644]
mach/sun3/libsys/fstat.s

index 9eeeb7c..1d50aa9 100644 (file)
@@ -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
index d484758..b4c6889 100644 (file)
@@ -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 (file)
index 0000000..ac8ad0e
--- /dev/null
@@ -0,0 +1,32 @@
+#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++;
+}
diff --git a/mach/sun3/libsys/_sbrk.s b/mach/sun3/libsys/_sbrk.s
new file mode 100644 (file)
index 0000000..cc34c33
--- /dev/null
@@ -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 (file)
index 0000000..1d6a7b9
--- /dev/null
@@ -0,0 +1,16 @@
+#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;
+}
index 824df98..78bae40 100644 (file)
@@ -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)