@@ -245,8 +245,9 @@ extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
Unlike the latter, fallocate can operate in different modes. The default
mode = 0 is equivalent to posix_fallocate().
- Note: These declarations are used in posix_fallocate.c and posix_fallocate64.c,
- so we expose them internally. */
+ Note: These declarations are used in posix_fallocate.c and
+ posix_fallocate64.c, so we expose them internally.
+ */
/* Flags for fallocate's mode. */
# define FALLOC_FL_KEEP_SIZE 1 /* Don't extend size of file
@@ -256,6 +257,7 @@ extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
# ifndef __USE_FILE_OFFSET64
extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
+libc_hidden_proto(fallocate)
# else
# ifdef __REDIRECT
extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
@@ -267,6 +269,7 @@ extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
# endif
# ifdef __USE_LARGEFILE64
extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len);
+libc_hidden_proto(fallocate64)
# endif
#endif
@@ -62,17 +62,10 @@ CSRC-$(UCLIBC_LINUX_SPECIFIC) += \
vmsplice.c
CSRC-$(if $(findstring yy,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_LFS)),y) += \
sendfile64.c
-# posix_fallocate() needs the internal function _fallocate() defined in fallocate.c
-# and posix_fallocate64() needs _fallocate64() in fallocate64.c if LFS is enabled.
-# So we do not remove them even if we want just posix_fallocate() or posix_fallocate64().
-ifeq ($(findstring y,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_ADVANCED_REALTIME)),y)
-ifneq ($(findstring y,$(UCLIBC_HAS_LFS)),y)
-CSRC- += fallocate64.c
-endif
-else
-CSRC- += fallocate.c
-CSRC- += fallocate64.c
-endif
+# posix_fallocate() needs __libc_fallocate() from fallocate.c
+# posix_fallocate64() needs __libc_fallocate64() from fallocate64.c
+CSRC-$(if $(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_ADVANCED_REALTIME),y,) += \
+ fallocate.c $(filter fallocate64.c,$(CSRC-y))
# NPTL needs these internally: madvise.c
CSRC-$(findstring y,$(UCLIBC_LINUX_SPECIFIC)$(UCLIBC_HAS_THREADS_NATIVE)) += madvise.c
ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
@@ -14,7 +14,8 @@
#include <stdint.h>
#if defined __NR_fallocate
-int attribute_hidden _fallocate(int fd, int mode, __off_t offset, __off_t len)
+extern __typeof(fallocate) __libc_fallocate attribute_hidden;
+int attribute_hidden __libc_fallocate(int fd, int mode, __off_t offset, __off_t len)
{
int ret;
@@ -39,13 +40,11 @@ int attribute_hidden _fallocate(int fd, int mode, __off_t offset, __off_t len)
}
# if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
-int fallocate(int fd, int mode, __off_t offset, __off_t len)
-{
- return _fallocate(fd, mode, offset, len);
-}
-# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
-strong_alias(fallocate,fallocate64)
+strong_alias(__libc_fallocate,fallocate)
+libc_hidden_def(fallocate)
+# if __WORDSIZE == 64
+strong_alias(__libc_fallocate,fallocate64)
+libc_hidden_def(fallocate64)
# endif
# endif
-
#endif
@@ -19,7 +19,9 @@
# if __WORDSIZE == 64
/* Can use normal fallocate() */
# elif __WORDSIZE == 32
-int attribute_hidden _fallocate64(int fd, int mode, __off64_t offset, __off64_t len)
+extern __typeof(fallocate64) __libc_fallocate64 attribute_hidden;
+int attribute_hidden __libc_fallocate64(int fd, int mode, __off64_t offset,
+ __off64_t len)
{
int ret;
INTERNAL_SYSCALL_DECL(err);
@@ -31,10 +33,8 @@ int attribute_hidden _fallocate64(int fd, int mode, __off64_t offset, __off64_t
}
# if defined __UCLIBC_LINUX_SPECIFIC__ && defined __USE_GNU
-int fallocate64(int fd, int mode, __off64_t offset, __off64_t len)
-{
- return _fallocate64(fd, mode, offset, len);
-}
+strong_alias(__libc_fallocate64,fallocate64)
+libc_hidden_def(fallocate64)
# endif
# else
@@ -13,12 +13,11 @@
#include <bits/kernel-features.h>
#include <stdint.h>
-extern __typeof(fallocate) _fallocate attribute_hidden;
-
#if defined __NR_fallocate
+extern __typeof(fallocate) __libc_fallocate attribute_hidden;
int posix_fallocate(int fd, __off_t offset, __off_t len)
{
- return _fallocate(fd, 0, offset, len);
+ return __libc_fallocate(fd, 0, offset, len);
}
# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
strong_alias(posix_fallocate,posix_fallocate64)
@@ -13,17 +13,16 @@
#include <bits/kernel-features.h>
#include <stdint.h>
-extern __typeof(fallocate64) _fallocate64 attribute_hidden;
-
#if defined __NR_fallocate
# if __WORDSIZE == 64
/* Can use normal posix_fallocate() */
# elif __WORDSIZE == 32
+extern __typeof(fallocate64) __libc_fallocate64 attribute_hidden;
int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
{
- return _fallocate64(fd, 0, offset, len);
+ return __libc_fallocate64(fd, 0, offset, len);
}
# else
-# error your machine is neither 32 bit or 64 bit ... it must be magical
+# error your machine is neither 32 bit or 64 bit ... it must be magical
# endif
#endif
@@ -6,21 +6,15 @@ ifeq ($(UCLIBC_HAS_LFS),)
TESTS_DISABLED := tst-preadwrite64 tst-posix_fallocate64 tst-fallocate64
endif
-# If we don't have LINUX_SPECIFIC, then get rid of tst-fallocate, and check to
-# make sure we didn't miss removing tst-fallocate64 above because LFS is enabled
+# If we don't have LINUX_SPECIFIC, then get rid of tst-fallocate
ifeq ($(UCLIBC_LINUX_SPECIFIC),)
TESTS_DISABLED += tst-fallocate
-ifeq ($(UCLIBC_HAS_LFS),y)
-TESTS_DISABLED += tst-fallocate64
-endif
endif
-# The logic is similar for HAS_ADVANCED_REALTIME and tst-posix_fallocate/tst-posix_fallocate64
+# The logic is similar for HAS_ADVANCED_REALTIME and
+# tst-posix_fallocate/tst-posix_fallocate64
ifeq ($(UCLIBC_HAS_ADVANCED_REALTIME),)
TESTS_DISABLED += tst-posix_fallocate
-ifeq ($(UCLIBC_HAS_LFS),y)
-TESTS_DISABLED += tst-posix_fallocate64
-endif
endif
OPTS_getopt := -abcXXX -9
@@ -10,12 +10,6 @@
# endif
#endif
-static void do_prepare (void);
-#define PREPARE(argc, argv) do_prepare ()
-static int do_test (void);
-#define TEST_FUNCTION do_test ()
-#include <test-skeleton.c>
-
static int fd;
static void
do_prepare (void)
@@ -161,3 +155,7 @@ do_test (void)
return 0;
}
+
+#define PREPARE(argc, argv) do_prepare ()
+#define TEST_FUNCTION do_test ()
+#include <test-skeleton.c>