summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common')
-rw-r--r--libc/sysdeps/linux/common/Makefile11
-rw-r--r--libc/sysdeps/linux/common/statfix.h2
-rw-r--r--libc/sysdeps/linux/common/syscalls.c48
3 files changed, 39 insertions, 22 deletions
diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile
index 85949988f..c54f7cd1d 100644
--- a/libc/sysdeps/linux/common/Makefile
+++ b/libc/sysdeps/linux/common/Makefile
@@ -25,7 +25,7 @@ TOPDIR=../../../
include $(TOPDIR)Rules.mak
LIBC=$(TOPDIR)libc.a
-CSRC= _xmknod.c waitpid.c getdents.c kernel_version.c rewinddir.c \
+CSRC= waitpid.c getdents.c kernel_version.c rewinddir.c \
statfix.c getdnnm.c seekdir.c telldir.c tell.c gethstnm.c \
mkfifo.c setegid.c wait.c errno.c closedir.c getpagesize.c \
opendir.c seteuid.c wait3.c dirfd.c readdir.c setpgrp.c \
@@ -33,13 +33,10 @@ CSRC= _xmknod.c waitpid.c getdents.c kernel_version.c rewinddir.c \
COBJS=$(patsubst %.c,%.o, $(CSRC))
-NISRC= _fxstat.c _lxstat.c _xstat.c
-NIOBJS=$(patsubst %.c,%.o, $(NISRC))
-
MSRC=syscalls.c
MOBJ=$(shell ./list_syscalls.sh)
-OBJ=$(COBJS) $(NIOBJS) $(MOBJ)
+OBJ=$(COBJS) $(MOBJ)
UNIFIED_SYSCALL_HEADER = /dev/null
STR_SYSCALLS =
@@ -65,10 +62,6 @@ $(COBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-$(NIOBJS):
- $(CC) $(CFLAGS) $< -c $*.c -o $*.o -fno-inline
- $(STRIPTOOL) -x -R .note -R .comment $*.o
-
str_syscalls:
/bin/sh ./str_syscalls.sh > str_syscalls.c
gcc str_syscalls.c -o str_syscalls
diff --git a/libc/sysdeps/linux/common/statfix.h b/libc/sysdeps/linux/common/statfix.h
index df85d84d4..6dad72dc4 100644
--- a/libc/sysdeps/linux/common/statfix.h
+++ b/libc/sysdeps/linux/common/statfix.h
@@ -2,7 +2,7 @@
#define STATFIX_H
/* Pull in whatever this particular arch's kernel thinks the kernel version of
- * struct stat should look like. It turn out that each arch has a different
+ * struct stat should look like. It turns out that each arch has a different
* opinion on the subject, and different kernel revs use different names... */
#define stat kernel_stat
#define new_stat kernel_stat
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index 968ce06dc..5c35cc679 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -126,10 +126,22 @@ _syscall1(time_t, time, time_t *, t);
#endif
//#define __NR_mknod 14
-#ifdef L___mknod
+#ifdef L_mknod
#include <unistd.h>
-#define __NR___mknod __NR_mknod
-_syscall3(int, __mknod, const char *, pathname, mode_t, mode, dev_t, dev);
+extern int mknod(const char *pathname, mode_t mode, dev_t dev);
+_syscall3(int, mknod, const char *, pathname, mode_t, mode, dev_t, dev);
+
+int _xmknod (int version, const char * path, mode_t mode, dev_t *dev)
+{
+ switch(version)
+ {
+ case 1:
+ return mknod (path, mode, *dev);
+ default:
+ errno = EINVAL;
+ return -1;
+ }
+}
#endif
//#define __NR_chmod 15
@@ -714,14 +726,13 @@ _syscall2(int, getitimer, enum __itimer_which, which, struct itimerval *, value)
//#define __NR_stat 106
#ifdef L___stat
-#define __NR___stat __NR_stat
#include <unistd.h>
#include "statfix.h"
+#define __NR___stat __NR_stat
extern int __stat(const char *file_name, struct kernel_stat *buf);
-
_syscall2(int, __stat, const char *, file_name, struct kernel_stat *, buf);
-int _stat(const char * file_name, struct libc_stat * cstat)
+int _xstat(int version, const char * file_name, struct libc_stat * cstat)
{
struct kernel_stat kstat;
int result = __stat(file_name, &kstat);
@@ -731,18 +742,22 @@ int _stat(const char * file_name, struct libc_stat * cstat)
}
return result;
}
+
+int stat(const char *file_name, struct libc_stat *buf)
+{
+ return(_xstat(0, file_name, buf));
+}
#endif
//#define __NR_lstat 107
#ifdef L___lstat
-#define __NR___lstat __NR_lstat
#include <unistd.h>
#include "statfix.h"
+#define __NR___lstat __NR_lstat
extern int __lstat(const char *file_name, struct kernel_stat *buf);
-
_syscall2(int, __lstat, const char *, file_name, struct kernel_stat *, buf);
-int _lstat(const char * file_name, struct libc_stat * cstat)
+int _lxstat(int version, const char * file_name, struct libc_stat * cstat)
{
struct kernel_stat kstat;
int result = __lstat(file_name, &kstat);
@@ -752,18 +767,22 @@ int _lstat(const char * file_name, struct libc_stat * cstat)
}
return result;
}
+
+int lstat(const char *file_name, struct libc_stat *buf)
+{
+ return(_lxstat(0, file_name, buf));
+}
#endif
//#define __NR_fstat 108
#ifdef L___fstat
-#define __NR___fstat __NR_fstat
#include <unistd.h>
#include "statfix.h"
+#define __NR___fstat __NR_fstat
extern int __fstat(int filedes, struct kernel_stat *buf);
-
_syscall2(int, __fstat, int, filedes, struct kernel_stat *, buf);
-int _fstat(int fd, struct libc_stat *cstat)
+int _fxstat(int version, int fd, struct libc_stat * cstat)
{
struct kernel_stat kstat;
int result = __fstat(fd, &kstat);
@@ -773,6 +792,11 @@ int _fstat(int fd, struct libc_stat *cstat)
}
return result;
}
+
+int fstat(int filedes, struct libc_stat *buf)
+{
+ return(_fxstat(0, filedes, buf));
+}
#endif
//#define __NR_olduname 109