* sysdeps/unix/sysv/linux/ftruncate64.c (ftruncate64): Make order
of arguments dependend on endianness. * sysdeps/unix/sysv/linux/truncate64.c: Likewise.
This commit is contained in:
parent
f0b2767b75
commit
1869e7d134
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <endian.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
|
@ -31,14 +32,13 @@
|
||||||
extern int __have_no_truncate64;
|
extern int __have_no_truncate64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The order of hight, low depends on endianness. */
|
||||||
extern int __syscall_ftruncate64 (int fd, int high_length, int low_length);
|
extern int __syscall_ftruncate64 (int fd, int high_length, int low_length);
|
||||||
|
|
||||||
|
|
||||||
/* Truncate the file FD refers to to LENGTH bytes. */
|
/* Truncate the file FD refers to to LENGTH bytes. */
|
||||||
int
|
int
|
||||||
ftruncate64 (fd, length)
|
ftruncate64 (int fd, off64_t length)
|
||||||
int fd;
|
|
||||||
off64_t length;
|
|
||||||
{
|
{
|
||||||
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
||||||
if (! __have_no_truncate64)
|
if (! __have_no_truncate64)
|
||||||
|
@ -49,8 +49,11 @@ ftruncate64 (fd, length)
|
||||||
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
#endif
|
#endif
|
||||||
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
int result = INLINE_SYSCALL (ftruncate64, 3, fd, low, high);
|
int result = INLINE_SYSCALL (ftruncate64, 3, fd, low, high);
|
||||||
|
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
int result = INLINE_SYSCALL (ftruncate64, 3, fd, high, low);
|
||||||
|
#endif
|
||||||
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
||||||
if (result != -1 || errno != ENOSYS)
|
if (result != -1 || errno != ENOSYS)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <endian.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
@ -31,14 +32,13 @@
|
||||||
int __have_no_truncate64;
|
int __have_no_truncate64;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* The order of hight, low depends on endianness. */
|
||||||
extern int __syscall_truncate64 (const char *path, int high_length, int low_length);
|
extern int __syscall_truncate64 (const char *path, int high_length, int low_length);
|
||||||
|
|
||||||
|
|
||||||
/* Truncate the file FD refers to to LENGTH bytes. */
|
/* Truncate the file FD refers to to LENGTH bytes. */
|
||||||
int
|
int
|
||||||
truncate64 (path, length)
|
truncate64 (const char *path, off64_t length)
|
||||||
const char *path;
|
|
||||||
off64_t length;
|
|
||||||
{
|
{
|
||||||
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
||||||
if (! __have_no_truncate64)
|
if (! __have_no_truncate64)
|
||||||
|
@ -49,7 +49,11 @@ truncate64 (path, length)
|
||||||
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
#endif
|
#endif
|
||||||
|
#if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||||
int result = INLINE_SYSCALL (truncate64, 3, path, low, high);
|
int result = INLINE_SYSCALL (truncate64, 3, path, low, high);
|
||||||
|
#elif __BYTE_ORDER == __BIG_ENDIAN
|
||||||
|
int result = INLINE_SYSCALL (truncate64, 3, path, high, low);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
#ifndef __ASSUME_TRUNCATE64_SYSCALL
|
||||||
if (result != -1 || errno != ENOSYS)
|
if (result != -1 || errno != ENOSYS)
|
||||||
|
|
Loading…
Reference in New Issue