fixed fallocate usage on linux distros that don't have it

This commit is contained in:
Arvid Norberg 2010-01-31 21:52:45 +00:00
parent c9e50559b6
commit c4bdd4debe
1 changed files with 5 additions and 1 deletions

View File

@ -76,12 +76,16 @@ POSSIBILITY OF SUCH DAMAGE.
#include <linux/fiemap.h>
#endif
#include <asm/unistd_64.h> // For __NR_fallocate
#include <asm/unistd.h> // For __NR_fallocate
// circumvent the lack of support in glibc
static int my_fallocate(int fd, int mode, loff_t offset, loff_t len)
{
#ifdef __NR_fallocate
return syscall(__NR_fallocate, fd, mode, offset, len);
#else
return EOPNOTSUPP;
#endif
}
#elif defined __APPLE__ && defined __MACH__