Added Xstat.c, to convert between different alignments
authorceriel <none@none>
Tue, 3 Nov 1987 14:50:32 +0000 (14:50 +0000)
committerceriel <none@none>
Tue, 3 Nov 1987 14:50:32 +0000 (14:50 +0000)
mach/sun3/libsys/LIST
mach/sun3/libsys/Xstat.c [new file with mode: 0644]
mach/sun3/libsys/fstat.s
mach/sun3/libsys/lstat.s
mach/sun3/libsys/stat.s

index cffcb20..760ef4e 100644 (file)
@@ -28,6 +28,7 @@ fchown.s
 fcntl.s
 flock.s
 fork.s
+Xstat.c
 fstat.s
 fstatfs.s
 fsync.s
diff --git a/mach/sun3/libsys/Xstat.c b/mach/sun3/libsys/Xstat.c
new file mode 100644 (file)
index 0000000..d484758
--- /dev/null
@@ -0,0 +1,58 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+
+static Xcvt();
+
+int
+stat(path, buf)
+       char *path;
+       struct stat *buf;
+{
+       char Xbuf[100];
+       int retval;
+
+       retval = _stat(path, Xbuf);
+       Xcvt(Xbuf, (char *)buf);
+       return retval;
+}
+
+int
+lstat(path, buf)
+       char *path;
+       struct stat *buf;
+{
+       char Xbuf[100];
+       int retval;
+
+       retval = _lstat(path, Xbuf);
+       Xcvt(Xbuf, (char *)buf);
+       return retval;
+}
+
+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++;
+}
index c3df3de..824df98 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)
index b6e4ffe..ccf8a69 100644 (file)
@@ -1,4 +1,4 @@
 #include "syscall.h"
 .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
-.define _lstat
-_lstat: SYSTEM(SYS_lstat)
+.define __lstat
+__lstat: SYSTEM(SYS_lstat)
index 37067e6..b953f55 100644 (file)
@@ -1,4 +1,4 @@
 #include "syscall.h"
 .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text
-.define _stat
-_stat: SYSTEM(SYS_stat)
+.define __stat
+__stat: SYSTEM(SYS_stat)