summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-01-24 11:52:51 +0000
committerEric Andersen <andersen@codepoet.org>2003-01-24 11:52:51 +0000
commit14c6293257eae377415d84ede9d118988e6474ce (patch)
tree5f3da9ed51470e4200c4fa12f368ff524dfcb0ff /libc/sysdeps/linux
parent85800279bcad0b3495ccc22374f42cd04675f9e4 (diff)
I thought it would be smaller to inline since these funcs are small.
Well, not inlining saves 300 bytes, so do that instead. -Erik
Diffstat (limited to 'libc/sysdeps/linux')
-rw-r--r--libc/sysdeps/linux/common/Makefile2
-rw-r--r--libc/sysdeps/linux/common/syscalls.c13
-rw-r--r--libc/sysdeps/linux/common/xstatconv.c16
-rw-r--r--libc/sysdeps/linux/common/xstatconv.h30
4 files changed, 51 insertions, 10 deletions
diff --git a/libc/sysdeps/linux/common/Makefile b/libc/sysdeps/linux/common/Makefile
index 225371b3f..a59b0c39f 100644
--- a/libc/sysdeps/linux/common/Makefile
+++ b/libc/sysdeps/linux/common/Makefile
@@ -25,7 +25,7 @@ CSRC= waitpid.c getdnnm.c gethstnm.c getcwd.c \
cmsg_nxthdr.c longjmp.c open64.c ftruncate64.c \
truncate64.c getrlimit64.c setrlimit64.c creat64.c mmap64.c \
llseek.c pread_write.c _exit.c setuid.c sync.c getdirname.c \
- sendfile64.c
+ sendfile64.c xstatconv.c
ifneq ($(strip $(EXCLUDE_BRK)),y)
CSRC+=sbrk.c
endif
diff --git a/libc/sysdeps/linux/common/syscalls.c b/libc/sysdeps/linux/common/syscalls.c
index 867635856..620ee96e7 100644
--- a/libc/sysdeps/linux/common/syscalls.c
+++ b/libc/sysdeps/linux/common/syscalls.c
@@ -970,8 +970,7 @@ _syscall2(int, getitimer, __itimer_which_t, which, struct itimerval *, value);
#define __NR___syscall_stat __NR_stat
#include <unistd.h>
#include <sys/stat.h>
-#include <bits/kernel_stat.h>
-#include "xstatconv.c"
+#include "xstatconv.h"
_syscall2(int, __syscall_stat, const char *, file_name, struct kernel_stat *, buf);
int stat(const char * file_name, struct stat * buf)
{
@@ -994,7 +993,7 @@ weak_alias(stat, stat64);
#include <unistd.h>
#include <sys/stat.h>
#include <bits/kernel_stat.h>
-#include "xstatconv.c"
+#include "xstatconv.h"
_syscall2(int, __syscall_lstat, const char *, file_name, struct kernel_stat *, buf);
int lstat(const char * file_name, struct stat * buf)
{
@@ -1017,7 +1016,7 @@ weak_alias(lstat, lstat64);
#include <unistd.h>
#include <sys/stat.h>
#include <bits/kernel_stat.h>
-#include "xstatconv.c"
+#include "xstatconv.h"
_syscall2(int, __syscall_fstat, int, fd, struct kernel_stat *, buf);
int fstat(int fd, struct stat * buf)
{
@@ -1676,7 +1675,7 @@ int getrlimit (__rlimit_resource_t resource, struct rlimit *rlimits)
#include <unistd.h>
#include <sys/stat.h>
#include <bits/kernel_stat.h>
-#include "xstatconv.c"
+#include "xstatconv.h"
_syscall2(int, __syscall_stat64, const char *, file_name, struct kernel_stat64 *, buf);
int stat64(const char * file_name, struct stat64 * buf)
{
@@ -1698,7 +1697,7 @@ int stat64(const char * file_name, struct stat64 * buf)
#include <unistd.h>
#include <sys/stat.h>
#include <bits/kernel_stat.h>
-#include "xstatconv.c"
+#include "xstatconv.h"
_syscall2(int, __syscall_lstat64, const char *, file_name, struct kernel_stat64 *, buf);
int lstat64(const char * file_name, struct stat64 * buf)
{
@@ -1720,7 +1719,7 @@ int lstat64(const char * file_name, struct stat64 * buf)
#include <unistd.h>
#include <sys/stat.h>
#include <bits/kernel_stat.h>
-#include "xstatconv.c"
+#include "xstatconv.h"
_syscall2(int, __syscall_fstat64, int, filedes, struct kernel_stat64 *, buf);
int fstat64(int fd, struct stat64 * buf)
{
diff --git a/libc/sysdeps/linux/common/xstatconv.c b/libc/sysdeps/linux/common/xstatconv.c
index c8d28d411..8b432a328 100644
--- a/libc/sysdeps/linux/common/xstatconv.c
+++ b/libc/sysdeps/linux/common/xstatconv.c
@@ -20,7 +20,19 @@
Modified for uClibc by Erik Andersen <andersen@codepoet.org>
*/
-static inline void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
+#define _GNU_SOURCE
+#define _LARGEFILE64_SOURCE
+#include <features.h>
+#undef __OPTIMIZE__
+/* We absolutely do _NOT_ want interfaces silently
+ * * * renamed under us or very bad things will happen... */
+#ifdef __USE_FILE_OFFSET64
+# undef __USE_FILE_OFFSET64
+#endif
+#include <sys/stat.h>
+#include "xstatconv.h"
+
+void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
{
/* Convert to current kernel version of `struct stat'. */
buf->st_dev = kbuf->st_dev;
@@ -59,7 +71,7 @@ static inline void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf)
#endif
}
-static inline void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf)
+void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf)
{
/* Convert to current kernel version of `struct stat64'. */
buf->st_dev = kbuf->st_dev;
diff --git a/libc/sysdeps/linux/common/xstatconv.h b/libc/sysdeps/linux/common/xstatconv.h
new file mode 100644
index 000000000..fd3b81b34
--- /dev/null
+++ b/libc/sysdeps/linux/common/xstatconv.h
@@ -0,0 +1,30 @@
+/* Convert between the kernel's `struct stat' format, and libc's.
+ Copyright (C) 1991,1995,1996,1997,2000,2002 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA.
+
+ Modified for uClibc by Erik Andersen <andersen@codepoet.org>
+ */
+
+/* Pull in whatever this particular arch's kernel thinks the kernel version of
+ * 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... */
+#include <bits/kernel_stat.h>
+
+extern void __xstat_conv(struct kernel_stat *kbuf, struct stat *buf);
+extern void __xstat64_conv(struct kernel_stat64 *kbuf, struct stat64 *buf);
+