Browse Source

Move common parts into internal header, should it be used for all *64.c?

Peter S. Mazinger 18 years ago
parent
commit
d958ebdfa9

+ 29 - 0
libc/sysdeps/linux/common/_lfs_64.h

@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
+ */
+#include <features.h>
+
+#ifdef __UCLIBC_HAS_LFS__
+
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 
+#undef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS   64
+#endif
+
+#ifndef __USE_LARGEFILE64
+# define __USE_LARGEFILE64      1
+#endif
+
+/* 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
+
+#else
+
+# error Don't include this header in files not built when LFS is disabled
+
+#endif

+ 3 - 17
libc/sysdeps/linux/common/creat64.c

@@ -16,25 +16,12 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <features.h>
+#include "_lfs_64.h"
+
+#ifdef __UCLIBC_HAS_LFS__
 #include <fcntl.h>
 #include <sys/types.h>
 
-#if defined __UCLIBC_HAS_LFS__
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 
-#undef _FILE_OFFSET_BITS
-#define _FILE_OFFSET_BITS   64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64      1
-#endif
-/* 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
-
 libc_hidden_proto(open64)
 
 /* Create FILE with protections MODE.  */
@@ -43,4 +30,3 @@ int creat64 (const char *file, mode_t mode)
     return open64 (file, O_WRONLY|O_CREAT|O_TRUNC, mode);
 }
 #endif /* __UCLIBC_HAS_LFS__ */
-

+ 1 - 14
libc/sysdeps/linux/common/getrlimit64.c

@@ -16,20 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <features.h>
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 
-#undef _FILE_OFFSET_BITS
-#define	_FILE_OFFSET_BITS   64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64	1
-#endif
-/* 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 "_lfs_64.h"
 
 #include <sys/types.h>
 #include <sys/resource.h>

+ 4 - 17
libc/sysdeps/linux/common/mmap64.c

@@ -5,31 +5,18 @@
  */
 /* Massivly hacked up for uClibc by Erik Andersen */
 
-#include <features.h>
+#include "_lfs_64.h"
+
+#ifdef __UCLIBC_HAS_LFS__
+
 #include <errno.h>
 #include <unistd.h>
 #include <sys/mman.h>
 #include <sys/syscall.h>
 #include <bits/uClibc_page.h>
 
-#ifdef __UCLIBC_HAS_LFS__
-
 libc_hidden_proto(mmap)
 
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
-# undef _FILE_OFFSET_BITS
-# define _FILE_OFFSET_BITS   64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64      1
-#endif
-/* 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
-
 # if !defined __NR_mmap2 || !defined _syscall6
 
 /*

+ 1 - 14
libc/sysdeps/linux/common/setrlimit64.c

@@ -16,20 +16,7 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#include <features.h>
-
-#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64 
-#undef _FILE_OFFSET_BITS
-#define	_FILE_OFFSET_BITS   64
-#endif
-#ifndef __USE_LARGEFILE64
-# define __USE_LARGEFILE64	1
-#endif
-/* 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 "_lfs_64.h"
 
 #include <sys/types.h>
 #include <sys/resource.h>