libc: add fallocate() and fallocate64()
[uclibc-ng.git] / libc / sysdeps / linux / common / posix_fallocate64.c
blob12ddbc2bc766cf0613c24e959c708dee6696d3f2
1 /* vi: set sw=4 ts=4: */
2 /*
3 * posix_fallocate() for uClibc
4 * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
6 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
8 * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
9 */
11 #include <sys/syscall.h>
12 #include <fcntl.h>
13 #include <bits/kernel-features.h>
14 #include <stdint.h>
16 #if defined __NR_fallocate
17 # if __WORDSIZE == 64
18 /* Can use normal posix_fallocate() */
19 # elif __WORDSIZE == 32
20 extern __typeof(fallocate64) __libc_fallocate64 attribute_hidden;
21 int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
23 return __libc_fallocate64(fd, 0, offset, len);
25 # else
26 # error your machine is neither 32 bit or 64 bit ... it must be magical
27 # endif
28 #endif