posix_fallocate.c 697 B

123456789101112131415161718192021222324252627
  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. extern __typeof(fallocate) __libc_fallocate attribute_hidden;
  16. int posix_fallocate(int fd, __off_t offset, __off_t len)
  17. {
  18. if (__libc_fallocate(fd, 0, offset, len))
  19. return errno;
  20. return 0;
  21. }
  22. # if __WORDSIZE == 64
  23. strong_alias(posix_fallocate,posix_fallocate64)
  24. # endif
  25. #endif