From 33a12b5540b8abbc4ee0ecb3a51912b3c7868517 Mon Sep 17 00:00:00 2001 From: "Anthony G. Basile" Date: Sun, 7 Sep 2014 15:33:46 -0400 Subject: libc: add fallocate() and fallocate64() We add the Linux-specific function fallocate() which allows the user to directly manipulate allocate space for a file. fallocate() can operate in different modes, but the default mode is equivalent to posix_fallocate() which is specified in POSIX.1. Recent releases of e2fsprogs 1.42.11 and above expect fallocate64() to be available. Signed-off-by: Anthony G. Basile Signed-off-by: Bernhard Reutner-Fischer --- libc/sysdeps/linux/common/posix_fallocate64.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'libc/sysdeps/linux/common/posix_fallocate64.c') diff --git a/libc/sysdeps/linux/common/posix_fallocate64.c b/libc/sysdeps/linux/common/posix_fallocate64.c index 76dc9b87e..12ddbc2bc 100644 --- a/libc/sysdeps/linux/common/posix_fallocate64.c +++ b/libc/sysdeps/linux/common/posix_fallocate64.c @@ -14,21 +14,15 @@ #include #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) { - 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 __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 -- cgit v1.2.3