Added Xstat.c, to convert between different alignments

This commit is contained in:
ceriel 1987-11-03 14:50:32 +00:00
parent 72ab7b68b8
commit 9ae4e7924a
5 changed files with 65 additions and 6 deletions

View file

@ -28,6 +28,7 @@ fchown.s
fcntl.s
flock.s
fork.s
Xstat.c
fstat.s
fstatfs.s
fsync.s

58
mach/sun3/libsys/Xstat.c Normal file
View file

@ -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++;
}

View 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)

View 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)

View 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)