@@ -1155,6 +1155,7 @@ config UCLIBC_HAS_ADVANCED_REALTIME
clock_getcpuclockid()
clock_nanosleep()
+ fallocate()
mq_timedreceive()
mq_timedsend()
posix_fadvise()
@@ -225,17 +225,31 @@ extern int posix_fadvise64 (int __fd, __off64_t __offset, __off64_t __len,
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int posix_fallocate (int __fd, __off_t __offset, __off_t __len);
+# ifdef __USE_GNU
+extern int fallocate (int __fd, int __mode, __off_t __offset, __off_t __len);
+# endif
# else
# ifdef __REDIRECT
extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
__off64_t __len),
posix_fallocate64);
+# ifdef __USE_GNU
+extern int __REDIRECT (fallocate, (int __fd, int __mode, __off64_t __offset,
+ __off64_t __len),
+ fallocate64);
+# endif
# else
# define posix_fallocate posix_fallocate64
+# ifdef __USE_GNU
+# define fallocate fallocate64
+# endif
# endif
# endif
# ifdef __USE_LARGEFILE64
extern int posix_fallocate64 (int __fd, __off64_t __offset, __off64_t __len);
+# ifdef __USE_GNU
+extern int fallocate64 (int __fd, int __mode, __off64_t __offset, __off64_t __len);
+# endif
# endif
#endif
@@ -86,9 +86,9 @@ CSRC-$(UCLIBC_HAS_REALTIME) += clock_adjtime.c clock_getres.c clock_gettime.c cl
nanosleep.c __rt_sigtimedwait.c __rt_sigwaitinfo.c sched_getparam.c \
sched_get_priority_max.c sched_get_priority_min.c sched_getscheduler.c \
sched_rr_get_interval.c sched_setparam.c sched_setscheduler.c sigqueue.c
-# clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp|posix_typ
ed_mem_g
et_info|pthread_mutex_timedlock|sem_timedwait
+# clock_getcpuclockid|clock_nanosleep|mq_timedreceive|mq_timedsend|posix_fadvise|posix_fallocate|fallocate|posix_madvise|posix_memalign|posix_mem_offset|posix_spawnattr_destroy|posix_spawnattr_init|posix_spawnattr_getflags|posix_spawnattr_setflags|posix_spawnattr_getpgroup|posix_spawnattr_setpgroup|posix_spawnattr_getschedparam|posix_spawnattr_setschedparam|posix_spawnattr_getschedpolicy|posix_spawnattr_setschedpolicy|posix_spawnattr_getsigdefault|posix_spawnattr_setsigdefault|posix_spawnattr_getsigmask|posix_spawnattr_setsigmask|posix_spawnattr_init|posix_spawnattr_setflags|posix_spawnattr_setpgroup|posix_spawnattr_setschedparam|posix_spawnattr_setschedpolicy|posix_spawnattr_setsigdefault|posix_spawnattr_setsigmask|posix_spawn_file_actions_addclose|posix_spawn_file_actions_addopen|posix_spawn_file_actions_adddup2|posix_spawn_file_actions_addopen|posix_spawn_file_actions_destroy|posix_spawn_file_actions_init|posix_spawn_file_actions_init|posix_spawn|posix_spawnp|posix_spawnp
|posix_t
yped_mem_get_info|pthread_mutex_timedlock|sem_timedwait
CSRC-$(UCLIBC_HAS_ADVANCED_REALTIME) += posix_fadvise64.c posix_fadvise.c posix_madvise.c \
- posix_fallocate.c posix_fallocate64.c
+ posix_fallocate.c posix_fallocate64.c fallocate.c fallocate64.c
CSRC-$(UCLIBC_SUSV4_LEGACY) += utime.c
CSRC-$(UCLIBC_HAS_EPOLL) += epoll.c
CSRC-$(UCLIBC_HAS_XATTR) += xattr.c
new file mode 100644
@@ -0,0 +1,51 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * fallocate() for uClibc - Based off of posix_fallocate() by Erik Andersen
+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+#include <fcntl.h>
+#include <bits/kernel-features.h>
+#include <stdint.h>
+
+#if defined __NR_fallocate
+int attribute_hidden _fallocate(int fd, int mode, __off_t offset, __off_t len)
+{
+ int ret;
+
+# if __WORDSIZE == 32
+ uint32_t off_low = offset;
+ uint32_t len_low = len;
+ /* may assert that these >>31 are 0 */
+ uint32_t zero = 0;
+ INTERNAL_SYSCALL_DECL(err);
+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, mode,
+ __LONG_LONG_PAIR (zero, off_low),
+ __LONG_LONG_PAIR (zero, len_low)));
+# elif __WORDSIZE == 64
+ INTERNAL_SYSCALL_DECL(err);
+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, mode, offset, len));
+# else
+# error your machine is neither 32 bit or 64 bit ... it must be magical
+#endif
+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+}
+
+# if 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)
+# endif
+# endif
+
+#endif
new file mode 100644
@@ -0,0 +1,44 @@
+/* vi: set sw=4 ts=4: */
+/*
+ * fallocate() for uClibc - based off posix_fallocate() by Erik Andersen
+ * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
+ *
+ * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
+ *
+ * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
+ */
+
+#include <sys/syscall.h>
+
+#include <fcntl.h>
+#include <bits/kernel-features.h>
+#include <stdint.h>
+
+#if defined __NR_fallocate
+
+# if __WORDSIZE == 64
+/* Can use normal fallocate() */
+# elif __WORDSIZE == 32
+int attribute_hidden _fallocate64(int fd, int mode, __off64_t offset, __off64_t len)
+{
+ int ret;
+ INTERNAL_SYSCALL_DECL(err);
+ ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, mode,
+ OFF64_HI_LO (offset), OFF64_HI_LO (len)));
+ if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
+ return 0;
+}
+
+# if defined __USE_GNU
+int fallocate64(int fd, int mode, __off64_t offset, __off64_t len)
+{
+ return _fallocate64(fd, mode, offset, len);
+}
+# endif
+
+# else
+# error your machine is neither 32 bit or 64 bit ... it must be magical
+# endif
+#endif
+
@@ -16,26 +16,7 @@
#if defined __NR_fallocate
int posix_fallocate(int fd, __off_t offset, __off_t len)
{
- int ret;
-
-# if __WORDSIZE == 32
- uint32_t off_low = offset;
- uint32_t len_low = len;
- /* may assert that these >>31 are 0 */
- uint32_t zero = 0;
- INTERNAL_SYSCALL_DECL(err);
- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
- __LONG_LONG_PAIR (zero, off_low),
- __LONG_LONG_PAIR (zero, len_low)));
-# elif __WORDSIZE == 64
- INTERNAL_SYSCALL_DECL(err);
- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len));
-# else
-# error your machine is neither 32 bit or 64 bit ... it must be magical
-#endif
- if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
- return INTERNAL_SYSCALL_ERRNO (ret, err);
- return 0;
+ return _fallocate(fd, 0, offset, len);
}
# if defined __UCLIBC_HAS_LFS__ && __WORDSIZE == 64
strong_alias(posix_fallocate,posix_fallocate64)
@@ -20,13 +20,7 @@
# elif __WORDSIZE == 32
int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
{
- int ret;
- INTERNAL_SYSCALL_DECL(err);
- ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
- OFF64_HI_LO (offset), OFF64_HI_LO (len)));
- if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
- return INTERNAL_SYSCALL_ERRNO (ret, err);
- return 0;
+ return _fallocate64(fd, 0, offset, len);
}
# else
# error your machine is neither 32 bit or 64 bit ... it must be magical