ftruncate: Use ftruncate64 if arch does not have the ftruncate syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
truncate: Use truncate64 if arch does not have the truncate syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
sendfile: Use sendfile64 if arch does not have the sendfile syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
lseek: Use lseek64 is arch does not have the lseek syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
getdents: Use getdents64 if arch does not have the getdents syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
statfs: Use statfs64 if arch does not have the statfs syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
libc/statfs64: Skip conversion code for new architectures

Fixes the following tests in LTP

statfs02_64 ( test case #5 )

The purpose of this test is to pass an invalid pointer to the statfs64
syscall and check if the kernel returns EFAULT or not. However,
uClibc creates a new statfs struct which is then passed to the kernel.
As a result of which, the kernel returns 0 because the newly created
statfs structure is valid. But, when copying the contens of the new
pointer to the old userspace one, the uClibc segfauls because the old
pointer is invalid. Old architectures are doomed to suffer by this
problem but new architectures can use the statfs64 syscall directly
so that the userspace pointer is passed directly to the kernel and get
the correct errno at the end.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
fstat: Use fstat64 if arch does not have the fstat syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
fstatat: Use newfstatat only for 64-bit operations

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
fstatat64: Use newfstatat only for 64-bit operations

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
fstatat{64}: No conversion code is needed for new architectures

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
stat64: Use fstatat64 if arch does not have the stat64 syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
lstat: Use fstatat64 if arch does not have the lstat syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
lstat64: Use fstatat64 if arch does not have the lstat64 syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
ustat: Add ustat stub for arches that don't have the ustat system call

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
stat: Use fstatat64 if arch does not have the stat syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
fstatfs: Add __libc_fstatfs wrapper

New architectures don't have fstatfs anymore, so we use a wrapper for
__libc_fstatfs which will use fstatfs64 internally. The interface however
needs to remain the same (i.e accepting a struct statfs as a second
argument) for backwards compatibility

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
fstatfs64: Prefer fstatfs64 system call instead of __libc_fstatfs

Using __libc_fstatfs for fstatfs64 adds a small delay as it needs to
use a 32-bit data structure to get the file info and them pass them to
the 64-bit data structure which was given as a fstatfs64 argument. Using
the system call directly should make the entire process much faster.
Also fix the arguments for fstatfs64. It takes three arguments
(see fs/fstatfs.c in Linux kernel sources) so despite what the manpage
says, the size of the buffer needs to be passed as the second argument

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
fcntl: Use fcntl64 is arch does not have the fcntl syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
open64: Use openat if arch does not have the open syscall

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>