posix_fallocate64.c 804 B

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