ftruncate.c 618 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * ftruncate() for uClibc
  3. *
  4. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <unistd.h>
  10. #if defined __NR_ftruncate64 && !defined __NR_ftruncate
  11. # include <endian.h>
  12. # include <stdint.h>
  13. int ftruncate(int fd, __off_t length)
  14. {
  15. # if __WORDSIZE == 32
  16. return INLINE_SYSCALL(ftruncate64, 3, fd, OFF_HI_LO(length));
  17. # else
  18. return ftruncate64(fd, length);
  19. # endif
  20. }
  21. libc_hidden_def(ftruncate);
  22. #else
  23. _syscall2(int, ftruncate, int, fd, __off_t, length)
  24. libc_hidden_def(ftruncate)
  25. #endif