+2012-05-19 Joseph Myers <joseph@codesourcery.com>
+
+ * sysdeps/unix/sysv/linux/arm/ftruncate64.c (kernel-features.h):
+ Don't include.
+ [__NR_ftruncate64]: Make code unconditional.
+ [!__NR_ftruncate64]: Remove conditional code.
+ [!__ASSUME_TRUNCATE64_SYSCALL]: Likewise.
+ * sysdeps/unix/sysv/linux/arm/mmap.S (kernel-features.h): Don't
+ include.
+ [__ASSUME_MMAP2_SYSCALL]:
+ Make code unconditional.
+ [!__ASSUME_MMAP2_SYSCALL]: Remove conditional code.
+ * sysdeps/unix/sysv/linux/arm/posix_fadvise64.c
+ (kernel-features.h): Don't include.
+ [__NR_arm_fadvise64_64]: Make code unconditional.
+ [!__ASSUME_FADVISE64_64_SYSCALL]: Remove conditional code.
+ * sysdeps/unix/sysv/linux/arm/truncate64.c (kernel-features.h):
+ Don't include.
+ [__NR_truncate64]: Make code unconditional.
+ [!__NR_truncate64]: Remove conditional code.
+ [!__ASSUME_TRUNCATE64_SYSCALL]: Likewise.
+ * sysdeps/unix/sysv/linux/arm/vfork.S (kernel-features.h): Don't
+ include.
+ [__NR_vfork]: Make code unconditional.
+ [__ASSUME_VFORK_SYSCALL]: Likewise.
+ [!__ASSUME_VFORK_SYSCALL]: Remove conditional code.
+ [!__NR_vfork]: Likewise.
+
2012-05-16 Joseph Myers <joseph@codesourcery.com>
* sysdeps/unix/sysv/linux/arm/kernel-features.h
-/* Copyright (C) 1997,1998,1999,2000,2001,2003, 2005
- Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <sysdep.h>
#include <sys/syscall.h>
-#include "kernel-features.h"
-
-#ifdef __NR_ftruncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls. */
-extern int __have_no_truncate64;
-#endif
-
-
/* 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
- }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if ((off_t) length != length)
- {
- __set_errno (EINVAL);
- return -1;
- }
- return __ftruncate (fd, (off_t) length);
-#endif
+ 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;
}
weak_alias (__ftruncate64, ftruncate64)
-
-#else
-/* Use the generic implementation. */
-# include <misc/ftruncate64.c>
-#endif
-/* Copyright (C) 1998, 2000, 2003, 2005, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
-#include <kernel-features.h>
#define EINVAL 22
.text
ENTRY (__mmap)
-# ifdef __ASSUME_MMAP2_SYSCALL
- /* This code is actually a couple of cycles slower than the
- sys_mmap version below, so it might seem like a loss. But the
- code path inside the kernel is sufficiently much shorter to
- make it a net gain to use mmap2 when it's known to be
- available. */
-
/* shuffle args */
str r5, [sp, #-4]!
cfi_adjust_cfa_offset (4)
.Linval:
mov r0, #-EINVAL
b 2b
-# else
- /* Because we can only get five args through the syscall interface, and
- mmap() takes six, we need to build a parameter block and pass its
- address instead. The 386 port does a similar trick. */
-
- /* This code previously moved sp into ip and stored the args using
- stmdb ip!, {a1-a4}. It did not modify sp, so the stack never had
- to be restored after the syscall completed. It saved an
- instruction and meant no stack cleanup work was required.
-
- This will not work in the case of a mmap call being interrupted
- by a signal. If the signal handler uses any stack the arguments
- to mmap will be trashed. The results of a restart of mmap are
- then unpredictable. */
-
- /* store args on the stack */
- stmdb sp!, {a1-a4}
- cfi_adjust_cfa_offset (16)
-
- /* do the syscall */
- mov a1, sp
- DO_CALL (mmap, 0)
-
- /* pop args off the stack. */
- add sp, sp, #16
- cfi_adjust_cfa_offset (-16)
-
- cmn r0, $4096
- RETINSTR(cc, lr)
- b PLTJMP(syscall_error);
-#endif
-
PSEUDO_END (__mmap)
weak_alias (__mmap, mmap)
-/* Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 2003-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <errno.h>
#include <fcntl.h>
#include <sysdep.h>
-#include <kernel-features.h>
int __posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise);
int __posix_fadvise64_l32 (int fd, off64_t offset, size_t len, int advise);
int
__posix_fadvise64_l64 (int fd, off64_t offset, off64_t len, int advise)
{
-#ifdef __NR_arm_fadvise64_64
INTERNAL_SYSCALL_DECL (err);
int ret = INTERNAL_SYSCALL (arm_fadvise64_64, err, 6, fd, advise,
__LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
__LONG_LONG_PAIR ((long)(len >> 32), (long)len));
if (!INTERNAL_SYSCALL_ERROR_P (ret, err))
return 0;
-# ifndef __ASSUME_FADVISE64_64_SYSCALL
- if (INTERNAL_SYSCALL_ERRNO (ret, err) != ENOSYS)
-# endif
- return INTERNAL_SYSCALL_ERRNO (ret, err);
-#endif
-#ifndef __ASSUME_FADVISE64_64_SYSCALL
-# ifdef __NR_fadvise64
- if (len != (off_t) len)
- return EOVERFLOW;
-
- INTERNAL_SYSCALL_DECL (err2);
- int ret2 = INTERNAL_SYSCALL (fadvise64, err2, 6, fd, 0,
- __LONG_LONG_PAIR ((long)(offset >> 32), (long)offset),
- (off_t) len, advise);
- if (!INTERNAL_SYSCALL_ERROR_P (ret2, err2))
- return 0;
- return INTERNAL_SYSCALL_ERRNO (ret2, err2);
-# else
- return ENOSYS;
-# endif
-#endif
+ return INTERNAL_SYSCALL_ERRNO (ret, err);
}
#include <shlib-compat.h>
-/* Copyright (C) 1997-2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
#include <sys/syscall.h>
#include <bp-checks.h>
-#include "kernel-features.h"
-
-#ifdef __NR_truncate64
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
-/* The variable is shared between all wrappers around *truncate64 calls. */
-int __have_no_truncate64;
-#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, 4, CHECK_STRING (path), 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
- }
-
-#ifndef __ASSUME_TRUNCATE64_SYSCALL
- if ((off_t) length != length)
- {
- __set_errno (EINVAL);
- return -1;
- }
- return __truncate (path, (off_t) length);
-#endif
+ unsigned int low = length & 0xffffffff;
+ unsigned int high = length >> 32;
+ int result = INLINE_SYSCALL (truncate64, 4, CHECK_STRING (path), 0,
+ __LONG_LONG_PAIR (high, low));
+ return result;
}
-
-#else
-/* Use the generic implementation. */
-# include <misc/truncate64.c>
-#endif
#include <sysdep.h>
#define _ERRNO_H 1
#include <bits/errno.h>
-#include <kernel-features.h>
/* Clone the calling process, but without copying the whole address space.
The calling process is suspended until the new process exits or is
and the process ID of the new process to the old process. */
ENTRY (__vfork)
-
-#ifdef __NR_vfork
#ifdef SAVE_PID
SAVE_PID
#endif
cmn a1, #4096
RETINSTR(cc, lr)
-# ifdef __ASSUME_VFORK_SYSCALL
b PLTJMP(SYSCALL_ERROR)
-# else
- /* Check if vfork syscall is known at all. */
- cmn a1, #ENOSYS
- bne PLTJMP(SYSCALL_ERROR)
-# endif
-#endif
-
-#ifndef __ASSUME_VFORK_SYSCALL
- /* If we don't have vfork, fork is close enough. */
- DO_CALL (fork, 0)
- cmn a1, #4096
- RETINSTR(cc, lr)
- b PLTJMP(SYSCALL_ERROR)
-#elif !defined __NR_vfork
-# error "__NR_vfork not available and __ASSUME_VFORK_SYSCALL defined"
-#endif
-
PSEUDO_END (__vfork)
libc_hidden_def (__vfork)