summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/posix_fallocate64.c
blob: 85614f6f573b22eae15625e9a6da687027d34408 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* vi: set sw=4 ts=4: */
/*
 * posix_fallocate() for uClibc
 * 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>
#include <errno.h>

#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)
{
	if (__libc_fallocate64(fd, 0, offset, len))
		return errno;
	return 0;
}
# else
#  error your machine is neither 32 bit or 64 bit ... it must be magical
# endif
#endif