1 /* vi: set sw=4 ts=4: */
2 /*
3  * posix_fallocate() for uClibc
4  * http://www.opengroup.org/onlinepubs/9699919799/functions/posix_fallocate.html
5  *
6  * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
7  *
8  * Licensed under the LGPL v2.1 or later, see the file COPYING.LIB in this tarball.
9  */
10 
11 #include <sys/syscall.h>
12 #include <fcntl.h>
13 #include <bits/kernel-features.h>
14 #include <stdint.h>
15 
16 #if defined __NR_fallocate
17 
18 # if __WORDSIZE == 64
19 /* Can use normal posix_fallocate() */
20 # elif __WORDSIZE == 32
posix_fallocate64(int fd,__off64_t offset,__off64_t len)21 int posix_fallocate64(int fd, __off64_t offset, __off64_t len)
22 {
23 	int ret;
24 	INTERNAL_SYSCALL_DECL(err);
25 	ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0,
26 		OFF64_HI_LO (offset), OFF64_HI_LO (len)));
27     if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err)))
28       return INTERNAL_SYSCALL_ERRNO (ret, err);
29     return 0;
30 }
31 # else
32 # error your machine is neither 32 bit or 64 bit ... it must be magical
33 # endif
34 #endif
35