int posix_fadvise(int fd, off_t offset, off_t len, int advise) { INTERNAL_SYSCALL_DECL (err); int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise, __LONG_LONG_PAIR (HIGH_BITS(offset), (long)offset), __LONG_LONG_PAIR (HIGH_BITS(len), (long)len)); if (INTERNAL_SYSCALL_ERROR_P (ret, err)) return INTERNAL_SYSCALL_ERRNO (ret, err); return 0; }
int truncate64(const char * path, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; # if defined(__UCLIBC_TRUNCATE64_HAS_4_ARGS__) return INLINE_SYSCALL(truncate64, 4, path, 0, __LONG_LONG_PAIR(high, low)); # else return INLINE_SYSCALL(truncate64, 3, path, __LONG_LONG_PAIR(high, low)); # endif }
/* The exported ftruncate64 function. */ int ftruncate64 (int fd, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; #if defined(__powerpc__) || defined(__mips__) return INLINE_SYSCALL(ftruncate64, 4, fd, 0, __LONG_LONG_PAIR (high, low)); #else return INLINE_SYSCALL(ftruncate64, 3, fd, __LONG_LONG_PAIR (high, low)); #endif }
int posix_fallocate64(int fd, __off64_t offset, __off64_t len) { int ret; uint32_t off_low = offset & 0xffffffff; uint32_t off_high = offset >> 32; uint32_t len_low = len & 0xffffffff; uint32_t len_high = len >> 32; INTERNAL_SYSCALL_DECL(err); ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0, __LONG_LONG_PAIR (off_high, off_low), __LONG_LONG_PAIR (len_high, len_low))); if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err))) return INTERNAL_SYSCALL_ERRNO (ret, err); return 0; }
ssize_t __libc_pread64(int fd, void *buf, size_t count, off64_t offset) { uint32_t low = offset & 0xffffffff; uint32_t high = offset >> 32; if (SINGLE_THREAD_P) return __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)); #ifdef __UCLIBC_HAS_THREADS_NATIVE__ int oldtype = LIBC_CANCEL_ASYNC (); ssize_t result = __syscall_pread(fd, buf, count, 0, __LONG_LONG_PAIR (high, low)); LIBC_CANCEL_RESET (oldtype); return result; #endif }
/* Truncate the file FD refers to to LENGTH bytes. */ int __ftruncate64 (int fd, off64_t length) { unsigned int low = length & 0xffffffff; unsigned int high = length >> 32; return INLINE_SYSCALL (ftruncate64, __ALIGNMENT_COUNT (3, 4), fd, __ALIGNMENT_ARG __LONG_LONG_PAIR (high, low)); }
/* Truncate the file PATH to LENGTH bytes. */ int truncate64 (const char *path, off64_t length) { unsigned int low = length & 0xffffffff; unsigned int high = length >> 32; return INLINE_SYSCALL (truncate64, __ALIGNMENT_COUNT (3, 4), path, __ALIGNMENT_ARG __LONG_LONG_PAIR (high, low)); }
/* Truncate the file referenced by FD to LENGTH bytes. */ int truncate64 (const char *path, off64_t length) { unsigned int low = length & 0xffffffff; unsigned int high = length >> 32; int result = INLINE_SYSCALL (truncate64, 3, path, __LONG_LONG_PAIR (high, low)); return result; }
/* Truncate the file FD refers to to LENGTH bytes. */ int __ftruncate64 (int fd, off64_t length) { unsigned int low = length & 0xffffffff; unsigned int high = length >> 32; int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0, __LONG_LONG_PAIR (high, low)); return result; }
off_t __NC(lseek)(int fd, off_t offset, int whence) { #if defined __UCLIBC_HAS_LFS__ return lseek64(fd, offset, whence); #elif __WORDSIZE == 32 __off64_t result; __off_t high = 0; return INLINE_SYSCALL(llseek, 5, fd, __LONG_LONG_PAIR(high, offset), &result, whence) ?: result; #endif /* No need to handle __WORDSIZE == 64 as such a kernel won't define __NR_llseek */ }
int posix_fallocate(int fd, __off_t offset, __off_t len) { int ret; # if __WORDSIZE == 32 uint32_t off_low = offset; uint32_t len_low = len; /* may assert that these >>31 are 0 */ uint32_t zero = 0; INTERNAL_SYSCALL_DECL(err); ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0, __LONG_LONG_PAIR (zero, off_low), __LONG_LONG_PAIR (zero, len_low))); # elif __WORDSIZE == 64 INTERNAL_SYSCALL_DECL(err); ret = (int) (INTERNAL_SYSCALL(fallocate, err, 4, fd, 0, offset, len)); # else # error your machine is neither 32 bit or 64 bit ... it must be magical #endif if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err))) return INTERNAL_SYSCALL_ERRNO (ret, err); return 0; }
/* Truncate the file FD refers to to LENGTH bytes. */ int __ftruncate64 (int fd, off64_t length) { #ifndef __ASSUME_TRUNCATE64_SYSCALL if (! __have_no_truncate64) #endif { unsigned int low = length & 0xffffffff; unsigned int high = length >> 32; #ifndef __ASSUME_TRUNCATE64_SYSCALL int saved_errno = errno; #endif int result = INLINE_SYSCALL (ftruncate64, 4, fd, 0, __LONG_LONG_PAIR (high, low)); #ifndef __ASSUME_TRUNCATE64_SYSCALL if (result != -1 || errno != ENOSYS) #endif return result; #ifndef __ASSUME_TRUNCATE64_SYSCALL __set_errno (saved_errno); __have_no_truncate64 = 1; #endif }
/* Truncate the file FD refers to to LENGTH bytes. */ int truncate64 (const char *path, off64_t length) { #ifndef __ASSUME_TRUNCATE64_SYSCALL if (! __have_no_truncate64) #endif { unsigned int low = length & 0xffffffff; unsigned int high = length >> 32; #ifndef __ASSUME_TRUNCATE64_SYSCALL int saved_errno = errno; #endif int result = INLINE_SYSCALL (truncate64, 3, CHECK_STRING (path), __LONG_LONG_PAIR (high, low)); #ifndef __ASSUME_TRUNCATE64_SYSCALL if (result != -1 || errno != ENOSYS) #endif return result; #ifndef __ASSUME_TRUNCATE64_SYSCALL __set_errno (saved_errno); __have_no_truncate64 = 1; #endif }
size_t __libc_pread(int fd, void *buf, size_t count, off_t offset) { return __pread(fd,buf,count,0,__LONG_LONG_PAIR(0,offset)); }
/* The exported ftruncate64 function. */ int ftruncate64 (int fd, __off64_t length) { uint32_t low = length & 0xffffffff; uint32_t high = length >> 32; return INLINE_SYSCALL(ftruncate64, 3, fd, __LONG_LONG_PAIR (high, low)); }