123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #include <_lfs_64.h>
- #include <sys/syscall.h>
- #include <unistd.h>
- #ifdef __NR_ftruncate64
- # include <bits/wordsize.h>
- # if __WORDSIZE == 64
- _syscall2(int, ftruncate64, int, fd, __off64_t, length)
- # elif __WORDSIZE == 32
- # include <endian.h>
- # include <stdint.h>
- int ftruncate64 (int fd, __off64_t length)
- {
- # if defined(__UCLIBC_SYSCALL_ALIGN_64BIT__)
- return INLINE_SYSCALL(ftruncate64, 4, fd, 0, OFF64_HI_LO(length));
- # else
- return INLINE_SYSCALL(ftruncate64, 3, fd, OFF64_HI_LO(length));
- # endif
- }
- # else
- # error Your machine is not 64 bit or 32 bit, I am dazed and confused.
- # endif
- #else
- # include <errno.h>
- int ftruncate64 (int fd, __off64_t length)
- {
- __off_t x = (__off_t) length;
- if (x == length) {
- return ftruncate(fd, x);
- }
- __set_errno((x < 0) ? EINVAL : EFBIG);
- return -1;
- }
- #endif
- libc_hidden_def(ftruncate64)
|