Przeglądaj źródła

I thought it would be smaller to inline since these funcs are small.
Well, not inlining saves 300 bytes, so do that instead.
-Erik

Eric Andersen 21 lat temu
rodzic
commit
14c6293257

+ 1 - 1
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

+ 6 - 7
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)
 {

+ 14 - 2
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;

+ 30 - 0
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);
+