Remove pre-2.2 Linux kernel support.

This commit is contained in:
Joseph Myers 2012-05-14 14:11:02 +00:00
parent 1bfb72913b
commit ffb7875d03
40 changed files with 333 additions and 1447 deletions

124
ChangeLog
View File

@ -1,3 +1,127 @@
2012-05-14 Joseph Myers <joseph@codesourcery.com>
[BZ #13717]
* sysdeps/unix/sysv/linux/configure.in (arch_minimum_kernel): Set
to 2.2.0 where earlier.
* sysdeps/unix/sysv/linux/configure: Regenerated.
* sysdeps/unix/sysv/linux/getcwd.c [!__ASSUME_GETCWD_SYSCALL]:
Remove conditional code.
[__ASSUME_GETCWD_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/i386/chown.c [!__ASSUME_LCHOWN_SYSCALL]:
Remove conditional code.
[!__NR_lchown]: Likewise.
[__ASSUME_LCHOWN_SYSCALL]: Make code unconditional.
[__NR_lchown]: Likewise.
* sysdeps/unix/sysv/linux/i386/fchownat.c (fchownat): Remove
comment referencing __ASSUME_LCHOWN_SYSCALL.
* sysdeps/unix/sysv/linux/i386/sigaction.c
[!__ASSUME_REALTIME_SIGNALS]: Remove conditional code.
[__ASSUME_REALTIME_SIGNALS]: Make code unconditional.
* sysdeps/unix/sysv/linux/if_index.c [!__ASSUME_SIOCGIFNAME]:
Remove conditional code.
[__ASSUME_SIOCGIFNAME ]: Make code unconditional.
(__protocol_available): Remove #if 0 code.
* sysdeps/unix/sysv/linux/ifreq.c [!__ASSUME_SIOCGIFNAME]: Remove
conditional code.
[__ASSUME_SIOCGIFNAME]: Make code unconditional.
* sysdeps/unix/sysv/linux/kernel-features.h
(__ASSUME_GETCWD_SYSCALL): Don't define.
(__ASSUME_REALTIME_SIGNALS): Likewise.
(__ASSUME_PREAD_SYSCALL): Likewise.
(__ASSUME_PWRITE_SYSCALL): Likewise.
(__ASSUME_POLL_SYSCALL): Likewise.
(__ASSUME_LCHOWN_SYSCALL): Likewise.
(__ASSUME_SETRESUID_SYSCALL): Define for all kernel versions for
non-SPARC.
(__ASSUME_SIOCGIFNAME): Don't define.
(__ASSUME_MSG_NOSIGNAL): Likewise.
(__ASSUME_SENDFILE): Define unconditionally.
(__ASSUME_PROC_SELF_FD_SYMLINK): Don't define.
* sysdeps/unix/sysv/linux/poll.c [!__ASSUME_POLL_SYSCALL]: Remove
conditional code.
[__ASSUME_POLL_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/chown.c (__chown)
[!__ASSUME_LCHOWN_SYSCALL]: Remove conditional code.
(__chown) [__ASSUME_LCHOWN_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/fchownat.c (fchownat)
[!__ASSUME_LCHOWN_SYSCALL]: Remove conditional code.
(fchownat) [__ASSUME_LCHOWN_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread.c
[!__ASSUME_PREAD_SYSCALL]: Remove conditional code.
[__ASSUME_PREAD_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/pread64.c
[!__ASSUME_PREAD_SYSCALL]: Remove conditional code.
[__ASSUME_PREAD_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite.c
[!__ASSUME_PWRITE_SYSCALL]: Remove conditional code.
[__ASSUME_PWRITE_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/pwrite64.c
[!__ASSUME_PWRITE_SYSCALL]: Remove conditional code.
[__ASSUME_PWRITE_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/pread.c
[!__ASSUME_PREAD_SYSCALL]: Remove conditional code.
[__ASSUME_PREAD_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/pread64.c
[!__ASSUME_PREAD_SYSCALL]: Remove conditional code.
[__ASSUME_PREAD_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite.c
[!__ASSUME_PWRITE_SYSCALL]: Remove conditional code.
[__ASSUME_PWRITE_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/pwrite64.c
[!__ASSUME_PWRITE_SYSCALL]: Remove conditional code.
[__ASSUME_PWRITE_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/pread.c [!__ASSUME_PREAD_SYSCALL]:
Remove conditional code.
[__ASSUME_PREAD_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/pread64.c [!__ASSUME_PREAD_SYSCALL]:
Remove conditional code.
[__ASSUME_PREAD_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/ptsname.c (__ptsname_internal)
[__LINUX_KERNEL_VERSION < 131443]: Remove conditional code.
* sysdeps/unix/sysv/linux/pwrite.c [!__ASSUME_PWRITE_SYSCALL]:
Remove conditional code.
[__ASSUME_PWRITE_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/pwrite64.c [!__ASSUME_PWRITE_SYSCALL]:
Remove conditional code.
[__ASSUME_PWRITE_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/sh/pread.c [!__ASSUME_PREAD_SYSCALL]:
Remove conditional code.
[__ASSUME_PREAD_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/sh/pread64.c [!__ASSUME_PREAD_SYSCALL]:
Remove conditional code.
[__ASSUME_PREAD_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/sh/pwrite.c [!__ASSUME_PWRITE_SYSCALL]:
Remove conditional code.
[__ASSUME_PWRITE_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/sh/pwrite64.c
[!__ASSUME_PWRITE_SYSCALL]: Remove conditional code.
[__ASSUME_PWRITE_SYSCALL]: Make code unconditional.
* sysdeps/unix/sysv/linux/sigaction.c
[!__ASSUME_REALTIME_SIGNALS]: Remove conditional code.
[__ASSUME_REALTIME_SIGNALS]: Make code unconditional.
* sysdeps/unix/sysv/linux/sigpending.c
[!__ASSUME_REALTIME_SIGNALS]: Remove conditional code.
[__ASSUME_REALTIME_SIGNALS]: Make code unconditional.
* sysdeps/unix/sysv/linux/sigprocmask.c
[!__ASSUME_REALTIME_SIGNALS]: Remove conditional code.
[__ASSUME_REALTIME_SIGNALS]: Make code unconditional.
* sysdeps/unix/sysv/linux/sigsuspend.c
[!__ASSUME_REALTIME_SIGNALS]: Remove conditional code.
[__ASSUME_REALTIME_SIGNALS]: Make code unconditional.
* sysdeps/unix/sysv/linux/sparc/sparc32/sigaction.c
(__libc_missing_rt_sigs): Remove.
(__libc_sigaction) [__NR_rt_sigaction]: Make code unconditional.
(__libc_sigaction): Do not handle ENOSYS from rt_sigaction.
* sysdeps/unix/sysv/linux/syslog.c [!__ASSUME_MSG_NOSIGNAL]:
Remove conditional code.
[__ASSUME_MSG_NOSIGNAL]: Make code unconditional.
* sysdeps/unix/sysv/linux/testrtsig.h (kernel_has_rtsig): Always
return 1.
* sysdeps/unix/sysv/linux/ttyname.c (ttyname)
[!__ASSUME_PROC_SELF_FD_SYMLINK]: Remove conditional code.
* sysdeps/unix/sysv/linux/ttyname_r.c (__ttyname_r)
[!__ASSUME_PROC_SELF_FD_SYMLINK]: Likewise.
2012-05-14 Andreas Jaeger <aj@suse.de>
* manual/string.texi (Copying and Concatenation): Add missing

4
NEWS
View File

@ -63,6 +63,10 @@ Version 2.16
version 2.14. This option will be removed at some time in the future
after the TI-RPC library becomes fully sufficient for the needs of
existing applications.
* Compatibility code for Linux kernel versions before 2.2 has been removed.
Note that glibc is not expected to work with any Linux kernel version
before 2.6.
Version 2.15

View File

@ -284,11 +284,11 @@ test -n "$arch_minimum_kernel" ||
case "$machine" in
i386*)
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.0.10
arch_minimum_kernel=2.2.0
;;
powerpc/powerpc32)
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.0.10
arch_minimum_kernel=2.2.0
;;
powerpc/powerpc64)
arch_minimum_kernel=2.4.21
@ -311,13 +311,13 @@ case "$machine" in
;;
sparc*)
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.0.10
arch_minimum_kernel=2.2.0
;;
x86_64*)
arch_minimum_kernel=2.4.0
;;
*)
arch_minimum_kernel=2.0.10
arch_minimum_kernel=2.2.0
;;
esac
if test -n "$minimum_kernel"; then
@ -331,7 +331,7 @@ $as_echo "$as_me: WARNING: minimum kernel version reset to $arch_minimum_kernel"
minimum_kernel=$arch_minimum_kernel
fi
else
if test $arch_minimum_kernel != '2.0.10'; then
if test $arch_minimum_kernel != '2.2.0'; then
minimum_kernel=$arch_minimum_kernel
fi
fi

View File

@ -41,11 +41,11 @@ test -n "$arch_minimum_kernel" ||
case "$machine" in
i386*)
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.0.10
arch_minimum_kernel=2.2.0
;;
powerpc/powerpc32)
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.0.10
arch_minimum_kernel=2.2.0
;;
powerpc/powerpc64)
arch_minimum_kernel=2.4.21
@ -68,13 +68,13 @@ case "$machine" in
;;
sparc*)
libc_cv_gcc_unwind_find_fde=yes
arch_minimum_kernel=2.0.10
arch_minimum_kernel=2.2.0
;;
x86_64*)
arch_minimum_kernel=2.4.0
;;
*)
arch_minimum_kernel=2.0.10
arch_minimum_kernel=2.2.0
;;
esac
if test -n "$minimum_kernel"; then
@ -87,7 +87,7 @@ if test -n "$minimum_kernel"; then
minimum_kernel=$arch_minimum_kernel
fi
else
if test $arch_minimum_kernel != '2.0.10'; then
if test $arch_minimum_kernel != '2.2.0'; then
minimum_kernel=$arch_minimum_kernel
fi
fi

View File

@ -38,27 +38,6 @@
#endif
#if __ASSUME_GETCWD_SYSCALL > 0
/* Kernel 2.1.92 introduced a third way to get the current working
directory: a syscall. We've got to be careful that even when
compiling under 2.1.92+ the libc still runs under older kernels. */
# define no_syscall_getcwd 0
# define have_new_dcache 1
#else
# if __NR_getcwd
/* Kernel 2.1.92 introduced a third way to get the current working
directory: a syscall. We've got to be careful that even when
compiling under 2.1.92+ the libc still runs under older kernels.
An additional problem is that the system call does not return
the path of directories longer than one page. */
static int no_syscall_getcwd;
static int have_new_dcache;
# else
# define no_syscall_getcwd 1
static int have_new_dcache = 1;
# endif
#endif
/* The "proc" filesystem provides an easy method to retrieve the value.
For each process, the corresponding directory contains a symbolic link
named `cwd'. Reading the content of this link immediate gives us the
@ -73,9 +52,6 @@ __getcwd (char *buf, size_t size)
int n;
char *result;
if (no_syscall_getcwd && !have_new_dcache)
return generic_getcwd (buf, size);
#ifndef NO_ALLOCATION
size_t alloc_size = size;
if (size == 0)
@ -101,138 +77,59 @@ __getcwd (char *buf, size_t size)
#endif
path = buf;
#if defined __NR_getcwd || __LINUX_GETCWD_SYSCALL > 0
if (!no_syscall_getcwd)
int retval;
retval = INLINE_SYSCALL (getcwd, 2, CHECK_STRING (path), alloc_size);
if (retval >= 0)
{
int retval;
#ifndef NO_ALLOCATION
if (buf == NULL && size == 0)
/* Ensure that the buffer is only as large as necessary. */
buf = realloc (path, (size_t) retval);
retval = INLINE_SYSCALL (getcwd, 2, CHECK_STRING (path), alloc_size);
if (retval >= 0)
{
# ifndef NO_ALLOCATION
if (buf == NULL && size == 0)
/* Ensure that the buffer is only as large as necessary. */
buf = realloc (path, (size_t) retval);
if (buf == NULL)
/* Either buf was NULL all along, or `realloc' failed but
we still have the original string. */
buf = path;
# endif
return buf;
}
/* The system call cannot handle paths longer than a page.
Neither can the magic symlink in /proc/self. Just use the
generic implementation right away. */
if (errno == ENAMETOOLONG)
{
# ifndef NO_ALLOCATION
if (buf == NULL && size == 0)
{
free (path);
path = NULL;
}
# endif
result = generic_getcwd (path, size);
# ifndef NO_ALLOCATION
if (result == NULL && buf == NULL && size != 0)
free (path);
# endif
return result;
}
# if __ASSUME_GETCWD_SYSCALL
/* It should never happen that the `getcwd' syscall failed because
the buffer is too small if we allocated the buffer ourselves
large enough. */
assert (errno != ERANGE || buf != NULL || size != 0);
# ifndef NO_ALLOCATION
if (buf == NULL)
/* Either buf was NULL all along, or `realloc' failed but
we still have the original string. */
buf = path;
#endif
return buf;
}
/* The system call cannot handle paths longer than a page.
Neither can the magic symlink in /proc/self. Just use the
generic implementation right away. */
if (errno == ENAMETOOLONG)
{
#ifndef NO_ALLOCATION
if (buf == NULL && size == 0)
{
free (path);
path = NULL;
}
#endif
result = generic_getcwd (path, size);
#ifndef NO_ALLOCATION
if (result == NULL && buf == NULL && size != 0)
free (path);
# endif
return NULL;
# else
if (errno == ENOSYS)
{
no_syscall_getcwd = 1;
have_new_dcache = 1; /* Now we will try the /proc method. */
}
else if (errno != ERANGE || buf != NULL)
{
# ifndef NO_ALLOCATION
if (buf == NULL)
free (path);
# endif
return NULL;
}
# endif
}
#endif
n = __readlink ("/proc/self/cwd", path, alloc_size - 1);
if (n != -1)
{
if (path[0] == '/')
{
if ((size_t) n >= alloc_size - 1)
{
#ifndef NO_ALLOCATION
if (buf == NULL)
free (path);
#endif
return NULL;
}
path[n] = '\0';
#ifndef NO_ALLOCATION
if (buf == NULL && size == 0)
/* Ensure that the buffer is only as large as necessary. */
buf = realloc (path, (size_t) n + 1);
if (buf == NULL)
/* Either buf was NULL all along, or `realloc' failed but
we still have the original string. */
buf = path;
#endif
return buf;
}
#ifndef have_new_dcache
else
have_new_dcache = 0;
#endif
return result;
}
#if __ASSUME_GETCWD_SYSCALL == 0
/* Set to have_new_dcache only if error indicates that proc doesn't
exist. */
if (errno != EACCES && errno != ENAMETOOLONG)
have_new_dcache = 0;
#endif
/* It should never happen that the `getcwd' syscall failed because
the buffer is too small if we allocated the buffer ourselves
large enough. */
assert (errno != ERANGE || buf != NULL || size != 0);
#ifndef NO_ALLOCATION
/* Don't put restrictions on the length of the path unless the user does. */
if (buf == NULL && size == 0)
{
free (path);
path = NULL;
}
#endif
result = generic_getcwd (path, size);
#ifndef NO_ALLOCATION
if (result == NULL && buf == NULL && size != 0)
if (buf == NULL)
free (path);
#endif
return result;
return NULL;
}
weak_alias (__getcwd, getcwd)

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1998,1999,2000,2002,2003,2004,2006
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
@ -42,64 +41,22 @@ extern int __chown_is_lchown (const char *__file, uid_t __owner,
extern int __real_chown (const char *__file, uid_t __owner, gid_t __group);
#if defined __NR_lchown || __ASSUME_LCHOWN_SYSCALL > 0
/* Running under Linux > 2.1.80. */
# ifdef __NR_chown32
#ifdef __NR_chown32
# if __ASSUME_32BITUIDS == 0
/* This variable is shared with all files that need to check for 32bit
uids. */
extern int __libc_missing_32bit_uids;
# endif
# endif /* __NR_chown32 */
# endif
#endif /* __NR_chown32 */
int
__real_chown (const char *file, uid_t owner, gid_t group)
{
# if __ASSUME_LCHOWN_SYSCALL == 0
static int __libc_old_chown;
int result;
if (!__libc_old_chown)
{
int saved_errno = errno;
# ifdef __NR_chown32
if (__libc_missing_32bit_uids <= 0)
{
int result;
int saved_errno = errno;
result = INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
if (result == 0 || errno != ENOSYS)
return result;
__set_errno (saved_errno);
__libc_missing_32bit_uids = 1;
}
# endif /* __NR_chown32 */
if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
|| ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
{
__set_errno (EINVAL);
return -1;
}
result = INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group);
if (result >= 0 || errno != ENOSYS)
return result;
__set_errno (saved_errno);
__libc_old_chown = 1;
}
return __lchown (file, owner, group);
# elif __ASSUME_32BITUIDS
/* This implies __ASSUME_LCHOWN_SYSCALL. */
#if __ASSUME_32BITUIDS
return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group);
# else
/* !__ASSUME_32BITUIDS && ASSUME_LCHOWN_SYSCALL */
# ifdef __NR_chown32
#else
/* !__ASSUME_32BITUIDS */
# ifdef __NR_chown32
if (__libc_missing_32bit_uids <= 0)
{
int result;
@ -112,7 +69,7 @@ __real_chown (const char *file, uid_t owner, gid_t group)
__set_errno (saved_errno);
__libc_missing_32bit_uids = 1;
}
# endif /* __NR_chown32 */
# endif /* __NR_chown32 */
if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U))
|| ((group + 1) > (gid_t) ((__kernel_gid_t) -1U)))
{
@ -121,19 +78,11 @@ __real_chown (const char *file, uid_t owner, gid_t group)
}
return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group);
# endif
}
#endif
#if !defined __NR_lchown && __ASSUME_LCHOWN_SYSCALL == 0
/* Compiling under older kernels. */
int
__chown_is_lchown (const char *file, uid_t owner, gid_t group)
{
return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group);
}
#elif SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
/* Compiling for compatibiity. */
int
attribute_compat_text_section
@ -147,12 +96,6 @@ __chown_is_lchown (const char *file, uid_t owner, gid_t group)
compat_symbol (libc, __chown_is_lchown, chown, GLIBC_2_0);
#endif
#ifdef __NR_lchown
versioned_symbol (libc, __real_chown, chown, GLIBC_2_1);
strong_alias (__real_chown, __chown)
#else
strong_alias (__chown_is_lchown, __chown_is_lchown21)
versioned_symbol (libc, __chown_is_lchown21, chown, GLIBC_2_1);
strong_alias (__chown_is_lchown, __chown)
#endif
libc_hidden_def (__chown)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
/* Copyright (C) 2005-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
@ -84,7 +84,6 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
}
# if __ASSUME_32BITUIDS > 0
/* This implies __ASSUME_LCHOWN_SYSCALL. */
INTERNAL_SYSCALL_DECL (err);
if (flag & AT_SYMLINK_NOFOLLOW)

View File

@ -1,5 +1,5 @@
/* POSIX.1 `sigaction' call for Linux/i386.
Copyright (C) 1991,1995-2000,2002-2005,2006 Free Software Foundation, Inc.
Copyright (C) 1991-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
@ -37,12 +37,6 @@
#define SA_RESTORER 0x04000000
#if __ASSUME_REALTIME_SIGNALS == 0
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. */
int __libc_missing_rt_sigs;
#endif
/* Using the hidden attribute here does not change the code but it
helps to avoid warnings. */
#ifdef __NR_rt_sigaction
@ -56,92 +50,39 @@ extern void restore (void) asm ("__restore") attribute_hidden;
int
__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
#if __ASSUME_REALTIME_SIGNALS == 0
struct old_kernel_sigaction k_newact, k_oldact;
#endif
int result;
#ifdef __NR_rt_sigaction
struct kernel_sigaction kact, koact;
/* First try the RT signals. */
# if __ASSUME_REALTIME_SIGNALS == 0
if (!__libc_missing_rt_sigs)
# endif
{
struct kernel_sigaction kact, koact;
# if __ASSUME_REALTIME_SIGNALS == 0
int saved_errno = errno;
# endif
if (act)
{
kact.k_sa_handler = act->sa_handler;
kact.sa_flags = act->sa_flags;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
if (GLRO(dl_sysinfo_dso) == NULL)
{
kact.sa_flags |= SA_RESTORER;
kact.sa_restorer = ((act->sa_flags & SA_SIGINFO)
? &restore_rt : &restore);
}
}
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
result = INLINE_SYSCALL (rt_sigaction, 4,
sig, act ? __ptrvalue (&kact) : NULL,
oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
# if __ASSUME_REALTIME_SIGNALS == 0
if (result >= 0 || errno != ENOSYS)
# endif
{
if (oact && result >= 0)
{
oact->sa_handler = koact.k_sa_handler;
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
oact->sa_flags = koact.sa_flags;
oact->sa_restorer = koact.sa_restorer;
}
return result;
}
# if __ASSUME_REALTIME_SIGNALS == 0
__set_errno (saved_errno);
__libc_missing_rt_sigs = 1;
# endif
}
#endif
#if __ASSUME_REALTIME_SIGNALS == 0
if (act)
{
k_newact.k_sa_handler = act->sa_handler;
k_newact.sa_mask = act->sa_mask.__val[0];
k_newact.sa_flags = act->sa_flags | SA_RESTORER;
kact.k_sa_handler = act->sa_handler;
kact.sa_flags = act->sa_flags;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
k_newact.sa_restorer = &restore;
if (GLRO(dl_sysinfo_dso) == NULL)
{
kact.sa_flags |= SA_RESTORER;
kact.sa_restorer = ((act->sa_flags & SA_SIGINFO)
? &restore_rt : &restore);
}
}
result = INLINE_SYSCALL (sigaction, 3, sig,
act ? __ptrvalue (&k_newact) : 0,
oact ? __ptrvalue (&k_oldact) : 0);
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
result = INLINE_SYSCALL (rt_sigaction, 4,
sig, act ? __ptrvalue (&kact) : NULL,
oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
if (result < 0)
return -1;
if (oact)
if (oact && result >= 0)
{
oact->sa_handler = k_oldact.k_sa_handler;
oact->sa_mask.__val[0] = k_oldact.sa_mask;
oact->sa_flags = k_oldact.sa_flags;
oact->sa_restorer = k_oldact.sa_restorer;
oact->sa_handler = koact.k_sa_handler;
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
oact->sa_flags = koact.sa_flags;
oact->sa_restorer = koact.sa_restorer;
}
return 0;
#endif
return result;
}
libc_hidden_def (__libc_sigaction)

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2007
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
@ -32,14 +31,6 @@
#include "netlinkaccess.h"
/* Variable to signal whether SIOCGIFCONF is not available. */
# if __ASSUME_SIOCGIFNAME == 0
static int old_siocgifconf;
#else
# define old_siocgifconf 0
#endif
unsigned int
if_nametoindex (const char *ifname)
{
@ -101,38 +92,20 @@ if_nameindex_ioctl (void)
/* We may be able to get the needed buffer size directly, rather than
guessing. */
if (! old_siocgifconf)
{
ifc.ifc_buf = NULL;
ifc.ifc_len = 0;
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
{
# if __ASSUME_SIOCGIFNAME == 0
old_siocgifconf = 1;
# endif
rq_len = RQ_IFS * sizeof (struct ifreq);
}
else
rq_len = ifc.ifc_len;
}
else
ifc.ifc_buf = NULL;
ifc.ifc_len = 0;
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
rq_len = RQ_IFS * sizeof (struct ifreq);
else
rq_len = ifc.ifc_len;
/* Read all the interfaces out of the kernel. */
ifc.ifc_buf = alloca (rq_len);
ifc.ifc_len = rq_len;
while (1)
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0)
{
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0)
{
close_not_cancel_no_status (fd);
return NULL;
}
if (ifc.ifc_len < rq_len || ! old_siocgifconf)
break;
ifc.ifc_buf = extend_alloca (ifc.ifc_buf, rq_len, 2 * rq_len);
ifc.ifc_len = rq_len;
close_not_cancel_no_status (fd);
return NULL;
}
nifs = ifc.ifc_len / sizeof (struct ifreq);
@ -314,161 +287,31 @@ libc_hidden_def (if_nameindex)
char *
if_indextoname (unsigned int ifindex, char *ifname)
{
#if !defined SIOCGIFINDEX && __ASSUME_SIOCGIFNAME == 0
__set_errno (ENOSYS);
return NULL;
#else
# if __ASSUME_SIOCGIFNAME == 0
struct if_nameindex *idx;
struct if_nameindex *p;
char *result = NULL;
# endif
# if defined SIOCGIFNAME || __ASSUME_SIOCGIFNAME > 0
/* We may be able to do the conversion directly, rather than searching a
list. This ioctl is not present in kernels before version 2.1.50. */
struct ifreq ifr;
int fd;
# if __ASSUME_SIOCGIFNAME == 0
static int siocgifname_works_not;
int status;
if (!siocgifname_works_not)
# endif
{
# if __ASSUME_SIOCGIFNAME == 0
int serrno = errno;
# endif
int status;
fd = __opensock ();
if (fd < 0)
return NULL;
ifr.ifr_ifindex = ifindex;
status = __ioctl (fd, SIOCGIFNAME, &ifr);
close_not_cancel_no_status (fd);
if (status < 0)
{
# if __ASSUME_SIOCGIFNAME == 0
if (errno == EINVAL)
siocgifname_works_not = 1; /* Don't make the same mistake twice. */
else
# endif
{
if (errno == ENODEV)
/* POSIX requires ENXIO. */
__set_errno (ENXIO);
return NULL;
}
}
else
return strncpy (ifname, ifr.ifr_name, IFNAMSIZ);
# if __ASSUME_SIOCGIFNAME == 0
__set_errno (serrno);
# endif
}
# endif
# if __ASSUME_SIOCGIFNAME == 0
idx = if_nameindex ();
if (idx != NULL)
{
for (p = idx; p->if_index || p->if_name; ++p)
if (p->if_index == ifindex)
{
result = strncpy (ifname, p->if_name, IFNAMSIZ);
break;
}
if_freenameindex (idx);
if (result == NULL)
__set_errno (ENXIO);
}
return result;
# endif
#endif
}
libc_hidden_def (if_indextoname)
#if 0
void
internal_function
__protocol_available (int *have_inet, int *have_inet6)
{
int fd = __opensock ();
unsigned int nifs;
int rq_len;
struct ifconf ifc;
# define RQ_IFS 4
/* Wirst case assumption. */
*have_inet = 0;
*have_inet6 = 0;
fd = __opensock ();
if (fd < 0)
/* We cannot open the socket. No networking at all? */
return;
return NULL;
/* We may be able to get the needed buffer size directly, rather than
guessing. */
if (! old_siocgifconf)
{
ifc.ifc_buf = NULL;
ifc.ifc_len = 0;
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
{
# if __ASSUME_SIOCGIFNAME == 0
old_siocgifconf = 1;
# endif
rq_len = RQ_IFS * sizeof (struct ifreq);
}
else
rq_len = ifc.ifc_len;
}
else
rq_len = RQ_IFS * sizeof (struct ifreq);
/* Read all the interfaces out of the kernel. */
do
{
ifc.ifc_buf = alloca (ifc.ifc_len = rq_len);
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0)
{
close_not_cancel_no_status (fd);
return;
}
rq_len *= 2;
}
while (ifc.ifc_len == rq_len && old_siocgifconf);
nifs = ifc.ifc_len / sizeof (struct ifreq);
/* Go through all the interfaces and get the address. */
while (nifs-- > 0)
if (__ioctl (fd, SIOCGIFADDR, &ifc.ifc_req[nifs]) >= 0)
{
/* We successfully got information about this interface. Now
test whether it is an IPv4 or IPv6 address. */
if (ifc.ifc_req[nifs].ifr_addr.sa_family == AF_INET)
*have_inet = 1;
else if (ifc.ifc_req[nifs].ifr_addr.sa_family == AF_INET6)
*have_inet6 = 1;
/* Note, this is & not &&. It works since the values are always
0 or 1. */
if (*have_inet & *have_inet6)
/* We can stop early. */
break;
}
ifr.ifr_ifindex = ifindex;
status = __ioctl (fd, SIOCGIFNAME, &ifr);
close_not_cancel_no_status (fd);
if (status < 0)
{
if (errno == ENODEV)
/* POSIX requires ENXIO. */
__set_errno (ENXIO);
return NULL;
}
else
return strncpy (ifname, ifr.ifr_name, IFNAMSIZ);
}
#endif
libc_hidden_def (if_indextoname)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1999,2002,2003,2004,2005,2006 Free Software Foundation, Inc.
/* Copyright (C) 1999-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Andreas Jaeger <aj@suse.de>.
@ -19,13 +19,6 @@
#include "ifreq.h"
#include <kernel-features.h>
/* Variable to signal whether SIOCGIFCONF is not available. */
#if __ASSUME_SIOCGIFNAME == 0 || 1
static int old_siocgifconf;
#else
# define old_siocgifconf 0
#endif
void
__ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
@ -49,45 +42,27 @@ __ifreq (struct ifreq **ifreqs, int *num_ifs, int sockfd)
/* We may be able to get the needed buffer size directly, rather than
guessing. */
if (! old_siocgifconf)
{
ifc.ifc_buf = NULL;
ifc.ifc_len = 0;
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
{
# if __ASSUME_SIOCGIFNAME == 0
old_siocgifconf = 1;
# endif
rq_len = RQ_IFS * sizeof (struct ifreq);
}
else
rq_len = ifc.ifc_len;
}
else
ifc.ifc_buf = NULL;
ifc.ifc_len = 0;
if (__ioctl (fd, SIOCGIFCONF, &ifc) < 0 || ifc.ifc_len == 0)
rq_len = RQ_IFS * sizeof (struct ifreq);
else
rq_len = ifc.ifc_len;
/* Read all the interfaces out of the kernel. */
while (1)
ifc.ifc_len = rq_len;
void *newp = realloc (ifc.ifc_buf, ifc.ifc_len);
if (newp == NULL
|| (ifc.ifc_buf = newp, __ioctl (fd, SIOCGIFCONF, &ifc)) < 0)
{
ifc.ifc_len = rq_len;
void *newp = realloc (ifc.ifc_buf, ifc.ifc_len);
if (newp == NULL
|| (ifc.ifc_buf = newp, __ioctl (fd, SIOCGIFCONF, &ifc)) < 0)
{
free (ifc.ifc_buf);
free (ifc.ifc_buf);
if (fd != sockfd)
__close (fd);
if (fd != sockfd)
__close (fd);
*num_ifs = 0;
*ifreqs = NULL;
return;
}
if (!old_siocgifconf || ifc.ifc_len < rq_len)
break;
rq_len *= 2;
*num_ifs = 0;
*ifreqs = NULL;
return;
}
nifs = ifc.ifc_len / sizeof (struct ifreq);

View File

@ -35,60 +35,16 @@
version given by __LINUX_KERNEL_VERSION. We are not always exactly
recording the correct versions in which the features were
introduced. If somebody cares these values can afterwards be
corrected. Most of the numbers here are set corresponding to
2.2.0. */
corrected. */
/* `getcwd' system call. */
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_GETCWD_SYSCALL 1
#endif
/* Real-time signal became usable in 2.1.70. */
#if __LINUX_KERNEL_VERSION >= 131398
# define __ASSUME_REALTIME_SIGNALS 1
#endif
/* When were the `pread'/`pwrite' syscalls introduced? */
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_PREAD_SYSCALL 1
# define __ASSUME_PWRITE_SYSCALL 1
#endif
/* When was `poll' introduced? */
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_POLL_SYSCALL 1
#endif
/* The `lchown' syscall was introduced in 2.1.80. */
#if __LINUX_KERNEL_VERSION >= 131408
# define __ASSUME_LCHOWN_SYSCALL 1
#endif
/* When did the `setresuid' syscall became available? */
#if __LINUX_KERNEL_VERSION >= 131584 && !defined __sparc__
/* When did the `setresuid' syscall became available? By 2.2.0 except
on SPARC. */
#if !defined __sparc__
# define __ASSUME_SETRESUID_SYSCALL 1
#endif
/* The SIOCGIFNAME ioctl is available starting with 2.1.50. */
#if __LINUX_KERNEL_VERSION >= 131408
# define __ASSUME_SIOCGIFNAME 1
#endif
/* MSG_NOSIGNAL was at least available with Linux 2.2.0. */
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_MSG_NOSIGNAL 1
#endif
/* The sendfile syscall was introduced in 2.2.0. */
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_SENDFILE 1
#endif
/* Only very old kernels had no real symlinks for terminal descriptors
in /proc/self/fd. */
#if __LINUX_KERNEL_VERSION >= 131584
# define __ASSUME_PROC_SELF_FD_SYMLINK 1
#endif
#define __ASSUME_SENDFILE 1
/* On x86 another `getrlimit' syscall was added in 2.3.25. */
#if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__

View File

@ -1,6 +1,5 @@
/* Poll system call, with emulation if it is not available.
Copyright (C) 1997,1998,1999,2000,2001,2002,2006
Free Software Foundation, Inc.
/* Poll system call.
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
@ -26,58 +25,12 @@
#include <kernel-features.h>
#if defined __NR_poll || __ASSUME_POLL_SYSCALL > 0
# if __ASSUME_POLL_SYSCALL == 0
static int __emulate_poll (struct pollfd *fds, nfds_t nfds,
int timeout) internal_function;
# endif
# if __ASSUME_POLL_SYSCALL == 0
/* For loser kernels. */
static int
loser_poll (struct pollfd *fds, nfds_t nfds, int timeout)
{
static int must_emulate;
if (!must_emulate)
{
int errno_saved = errno;
int retval = INLINE_SYSCALL (poll, 3, CHECK_N (fds, nfds), nfds,
timeout);
if (retval >= 0 || errno != ENOSYS)
return retval;
__set_errno (errno_saved);
must_emulate = 1;
}
return __emulate_poll (fds, nfds, timeout);
}
# endif
/* The real implementation. */
int
__poll (fds, nfds, timeout)
struct pollfd *fds;
nfds_t nfds;
int timeout;
{
# if __ASSUME_POLL_SYSCALL == 0
if (SINGLE_THREAD_P)
return loser_poll (CHECK_N (fds, nfds), nfds, timeout);
int oldtype = LIBC_CANCEL_ASYNC ();
int result = loser_poll (CHECK_N (fds, nfds), nfds, timeout);
LIBC_CANCEL_RESET (oldtype);
return result;
# else
if (SINGLE_THREAD_P)
return INLINE_SYSCALL (poll, 3, CHECK_N (fds, nfds), nfds, timeout);
@ -88,17 +41,7 @@ __poll (fds, nfds, timeout)
LIBC_CANCEL_RESET (oldtype);
return result;
# endif
}
libc_hidden_def (__poll)
weak_alias (__poll, poll)
strong_alias (__poll, __libc_poll)
/* Get the emulation code. */
# define __poll(fds, nfds, timeout) \
static internal_function __emulate_poll (fds, nfds, timeout)
#endif
#if __ASSUME_POLL_SYSCALL == 0
# include <sysdeps/unix/bsd/poll.c>
#endif

View File

@ -1,5 +1,5 @@
/* chown() compatibility.
Copyright (C) 1998, 2000, 2002, 2003, 2005 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
@ -35,95 +35,7 @@
int
__chown (const char *file, uid_t owner, gid_t group)
{
#if __ASSUME_LCHOWN_SYSCALL
return INLINE_SYSCALL (chown, 3, file, owner, group);
#else
int err;
int old_errno;
char link[PATH_MAX + 2];
char path[2 * PATH_MAX + 4];
int loopct;
size_t filelen;
static int libc_old_chown = 0 /* -1=old linux, 1=new linux, 0=unknown */;
if (libc_old_chown == 1)
return INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
old_errno = errno;
# ifdef __NR_lchown
if (libc_old_chown == 0)
{
err = INLINE_SYSCALL (chown, 3, __ptrvalue (file), owner, group);
if (err != -1 || errno != ENOSYS)
{
libc_old_chown = 1;
return err;
}
libc_old_chown = -1;
}
# endif
err = __readlink (file, link, PATH_MAX + 1);
if (err == -1)
{
__set_errno (old_errno);
return __lchown (file, owner, group);
}
filelen = strlen (file) + 1;
if (filelen > sizeof (path))
{
__set_errno (ENAMETOOLONG);
return -1;
}
memcpy (path, file, filelen);
/* 'The system has an arbitrary limit...' In practise, we'll hit
ENAMETOOLONG before this, usually. */
for (loopct = 0; loopct < 128; ++loopct)
{
size_t linklen;
if (err >= PATH_MAX + 1)
{
__set_errno (ENAMETOOLONG);
return -1;
}
link[err] = 0; /* Null-terminate string, just-in-case. */
linklen = strlen (link) + 1;
if (link[0] == '/')
memcpy (path, link, linklen);
else
{
filelen = strlen (path);
while (filelen > 1 && path[filelen - 1] == '/')
--filelen;
while (filelen > 0 && path[filelen - 1] != '/')
--filelen;
if (filelen + linklen > sizeof (path))
{
errno = ENAMETOOLONG;
return -1;
}
memcpy (path + filelen, link, linklen);
}
err = __readlink (path, link, PATH_MAX + 1);
if (err == -1)
{
__set_errno (old_errno);
return __lchown (path, owner, group);
}
}
__set_errno (ELOOP);
return -1;
#endif
}
libc_hidden_def (__chown)

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
/* Copyright (C) 2005-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
@ -86,7 +86,6 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
file = buf;
}
# if __ASSUME_LCHOWN_SYSCALL
INTERNAL_SYSCALL_DECL (err);
if (flag & AT_SYMLINK_NOFOLLOW)
@ -99,15 +98,6 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag)
__atfct_seterrno (INTERNAL_SYSCALL_ERRNO (result, err), fd, buf);
return -1;
}
# else
/* Don't inline the rest to avoid unnecessary code duplication. */
if (flag & AT_SYMLINK_NOFOLLOW)
result = __lchown (file, owner, group);
else
result = __chown (file, owner, group);
if (result < 0)
__atfct_seterrno (errno, fd, buf);
# endif
return result;

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -27,14 +26,6 @@
#include <kernel-features.h>
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
# if __ASSUME_PREAD_SYSCALL == 0
static ssize_t __emulate_pread (int fd, void *buf, size_t count,
off_t offset) internal_function;
# endif
ssize_t
__libc_pread (fd, buf, count, offset)
int fd;
@ -49,11 +40,6 @@ __libc_pread (fd, buf, count, offset)
/* On PPC32 64bit values are aligned in odd/even register pairs. */
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count,
0, offset >> 31, offset);
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread (fd, buf, count, offset);
# endif
return result;
}
@ -63,11 +49,6 @@ __libc_pread (fd, buf, count, offset)
/* On PPC32 64bit values are aligned in odd/even register pairs. */
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count,
0, offset >> 31, offset);
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -76,11 +57,3 @@ __libc_pread (fd, buf, count, offset)
strong_alias (__libc_pread, __pread)
weak_alias (__libc_pread, pread)
# define __libc_pread(fd, buf, count, offset) \
static internal_function __emulate_pread (fd, buf, count, offset)
#endif
#if __ASSUME_PREAD_SYSCALL == 0
# include <sysdeps/posix/pread.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -26,13 +25,6 @@
#include <kernel-features.h>
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
# if __ASSUME_PREAD_SYSCALL == 0
static ssize_t __emulate_pread64 (int fd, void *buf, size_t count,
off64_t offset) internal_function;
# endif
ssize_t
__libc_pread64 (fd, buf, count, offset)
@ -49,11 +41,6 @@ __libc_pread64 (fd, buf, count, offset)
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count,
0, (long) (offset >> 32),
(long) offset);
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread64 (fd, buf, count, offset);
# endif
return result;
}
@ -64,11 +51,6 @@ __libc_pread64 (fd, buf, count, offset)
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count,
0, (long) (offset >> 32),
(long) offset);
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread64 (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -77,11 +59,3 @@ __libc_pread64 (fd, buf, count, offset)
weak_alias (__libc_pread64, __pread64)
weak_alias (__libc_pread64, pread64)
# define __libc_pread64(fd, buf, count, offset) \
static internal_function __emulate_pread64 (fd, buf, count, offset)
#endif
# if __ASSUME_PREAD_SYSCALL == 0
# include <sysdeps/posix/pread64.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -27,13 +26,6 @@
#include <kernel-features.h>
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
off_t offset) internal_function;
# endif
ssize_t
__libc_pwrite (fd, buf, count, offset)
@ -49,11 +41,6 @@ __libc_pwrite (fd, buf, count, offset)
/* On PPC32 64bit values are aligned in odd/even register pairs. */
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count,
0, offset >> 31, offset);
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite (fd, buf, count, offset);
# endif
return result;
}
@ -63,11 +50,6 @@ __libc_pwrite (fd, buf, count, offset)
/* On PPC32 64bit values are aligned in odd/even register pairs. */
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count,
0, offset >> 31, offset);
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -76,11 +58,3 @@ __libc_pwrite (fd, buf, count, offset)
strong_alias (__libc_pwrite, __pwrite)
weak_alias (__libc_pwrite, pwrite)
# define __libc_pwrite(fd, buf, count, offset) \
static internal_function __emulate_pwrite (fd, buf, count, offset)
#endif
#if __ASSUME_PWRITE_SYSCALL == 0
# include <sysdeps/posix/pwrite.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -26,13 +25,6 @@
#include <kernel-features.h>
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
off64_t offset) internal_function;
# endif
ssize_t
__libc_pwrite64 (fd, buf, count, offset)
@ -49,11 +41,6 @@ __libc_pwrite64 (fd, buf, count, offset)
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count,
0, (long) (offset >> 32),
(long) offset);
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite64 (fd, buf, count, offset);
# endif
return result;
}
@ -64,11 +51,6 @@ __libc_pwrite64 (fd, buf, count, offset)
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count,
0, (long) (offset >> 32),
(long) offset);
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite64 (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -78,11 +60,3 @@ __libc_pwrite64 (fd, buf, count, offset)
weak_alias (__libc_pwrite64, __pwrite64)
libc_hidden_weak (__pwrite64)
weak_alias (__libc_pwrite64, pwrite64)
# define __libc_pwrite64(fd, buf, count, offset) \
static internal_function __emulate_pwrite64 (fd, buf, count, offset)
#endif
#if __ASSUME_PWRITE_SYSCALL == 0
# include <sysdeps/posix/pwrite64.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -27,13 +26,6 @@
#include <kernel-features.h>
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
# if __ASSUME_PREAD_SYSCALL == 0
static ssize_t __emulate_pread (int fd, void *buf, size_t count,
off_t offset) internal_function;
# endif
ssize_t
__libc_pread (fd, buf, count, offset)
@ -48,11 +40,6 @@ __libc_pread (fd, buf, count, offset)
{
result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
offset);
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread (fd, buf, count, offset);
# endif
return result;
}
@ -61,11 +48,6 @@ __libc_pread (fd, buf, count, offset)
result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
offset);
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -74,11 +56,3 @@ __libc_pread (fd, buf, count, offset)
strong_alias (__libc_pread, __pread)
weak_alias (__libc_pread, pread)
# define __libc_pread(fd, buf, count, offset) \
static internal_function __emulate_pread (fd, buf, count, offset)
#endif
#if __ASSUME_PREAD_SYSCALL == 0
# include <sysdeps/posix/pread.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -26,13 +25,6 @@
#include <kernel-features.h>
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
# if __ASSUME_PREAD_SYSCALL == 0
static ssize_t __emulate_pread64 (int fd, void *buf, size_t count,
off64_t offset) internal_function;
# endif
ssize_t
__libc_pread64 (fd, buf, count, offset)
@ -47,11 +39,6 @@ __libc_pread64 (fd, buf, count, offset)
{
result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
offset);
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread64 (fd, buf, count, offset);
# endif
return result;
}
@ -60,11 +47,6 @@ __libc_pread64 (fd, buf, count, offset)
result = INLINE_SYSCALL (pread, 4, fd, CHECK_N (buf, count), count,
offset);
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread64 (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -73,11 +55,3 @@ __libc_pread64 (fd, buf, count, offset)
weak_alias (__libc_pread64, __pread64)
weak_alias (__libc_pread64, pread64)
# define __libc_pread64(fd, buf, count, offset) \
static internal_function __emulate_pread64 (fd, buf, count, offset)
#endif
# if __ASSUME_PREAD_SYSCALL == 0
# include <sysdeps/posix/pread64.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -27,13 +26,6 @@
#include <kernel-features.h>
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
off_t offset) internal_function;
# endif
ssize_t
__libc_pwrite (fd, buf, count, offset)
@ -48,11 +40,6 @@ __libc_pwrite (fd, buf, count, offset)
{
result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
offset);
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite (fd, buf, count, offset);
# endif
return result;
}
@ -61,11 +48,6 @@ __libc_pwrite (fd, buf, count, offset)
result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
offset);
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -74,11 +56,3 @@ __libc_pwrite (fd, buf, count, offset)
strong_alias (__libc_pwrite, __pwrite)
weak_alias (__libc_pwrite, pwrite)
# define __libc_pwrite(fd, buf, count, offset) \
static internal_function __emulate_pwrite (fd, buf, count, offset)
#endif
#if __ASSUME_PWRITE_SYSCALL == 0
# include <sysdeps/posix/pwrite.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -26,13 +25,6 @@
#include <kernel-features.h>
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
off64_t offset) internal_function;
# endif
ssize_t
__libc_pwrite64 (fd, buf, count, offset)
@ -47,11 +39,6 @@ __libc_pwrite64 (fd, buf, count, offset)
{
result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
offset);
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite64 (fd, buf, count, offset);
# endif
return result;
}
@ -60,11 +47,6 @@ __libc_pwrite64 (fd, buf, count, offset)
result = INLINE_SYSCALL (pwrite, 4, fd, CHECK_N (buf, count), count,
offset);
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite64 (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -74,11 +56,3 @@ __libc_pwrite64 (fd, buf, count, offset)
weak_alias (__libc_pwrite64, __pwrite64)
libc_hidden_weak (__pwrite64)
weak_alias (__libc_pwrite64, pwrite64)
# define __libc_pwrite64(fd, buf, count, offset) \
static internal_function __emulate_pwrite64 (fd, buf, count, offset)
#endif
#if __ASSUME_PWRITE_SYSCALL == 0
# include <sysdeps/posix/pwrite64.c>
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997-2000,2002,2003,2004,2006 Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -34,13 +34,6 @@
# define __NR_pread __NR_pread64
#endif
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
# if __ASSUME_PREAD_SYSCALL == 0
static ssize_t __emulate_pread (int fd, void *buf, size_t count,
off_t offset) internal_function;
# endif
static ssize_t
#ifdef NO_CANCELLATION
@ -50,15 +43,9 @@ do_pread (int fd, void *buf, size_t count, off_t offset)
{
ssize_t result;
/* First try the syscall. */
assert (sizeof (offset) == 4);
result = INLINE_SYSCALL (pread, 5, fd, CHECK_N (buf, count), count,
__LONG_LONG_PAIR (offset >> 31, offset));
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread (fd, buf, count, offset);
# endif
return result;
}
@ -85,11 +72,3 @@ __libc_pread (fd, buf, count, offset)
strong_alias (__libc_pread, __pread)
weak_alias (__libc_pread, pread)
# define __libc_pread(fd, buf, count, offset) \
static internal_function __emulate_pread (fd, buf, count, offset)
#endif
#if __ASSUME_PREAD_SYSCALL == 0
# include <sysdeps/posix/pread.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -34,28 +33,15 @@
# define __NR_pread __NR_pread64
#endif
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
# if __ASSUME_PREAD_SYSCALL == 0
static ssize_t __emulate_pread64 (int fd, void *buf, size_t count,
off64_t offset) internal_function;
# endif
static ssize_t
do_pread64 (int fd, void *buf, size_t count, off64_t offset)
{
ssize_t result;
/* First try the syscall. */
result = INLINE_SYSCALL (pread, 5, fd, CHECK_N (buf, count), count,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread64 (fd, buf, count, offset);
# endif
return result;
}
@ -82,11 +68,3 @@ __libc_pread64 (fd, buf, count, offset)
weak_alias (__libc_pread64, __pread64)
weak_alias (__libc_pread64, pread64)
# define __libc_pread64(fd, buf, count, offset) \
static internal_function __emulate_pread64 (fd, buf, count, offset)
#endif
# if __ASSUME_PREAD_SYSCALL == 0
# include <sysdeps/posix/pread64.c>
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1998, 2000, 2001, 2002, 2009 Free Software Foundation, Inc.
/* Copyright (C) 1998-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Zack Weinberg <zack@rabi.phys.columbia.edu>, 1998.
@ -127,12 +127,6 @@ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
}
ptyno = minor (stp->st_rdev);
#if __LINUX_KERNEL_VERSION < 131443
/* This is for the old BSD pseudo terminals. As of Linux
2.1.115 these are no longer supported. */
if (major (stp->st_rdev) == 4)
ptyno -= 128;
#endif
if (ptyno / 16 >= strlen (__libc_ptyname1))
{

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997-2000,2002,2003,2004,2006 Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -34,13 +34,6 @@
# define __NR_pwrite __NR_pwrite64
#endif
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
off_t offset) internal_function;
# endif
static ssize_t
#ifdef NO_CANCELLATION
@ -50,15 +43,9 @@ do_pwrite (int fd, const void *buf, size_t count, off_t offset)
{
ssize_t result;
/* First try the syscall. */
assert (sizeof (offset) == 4);
result = INLINE_SYSCALL (pwrite, 5, fd, CHECK_N (buf, count), count,
__LONG_LONG_PAIR (offset >> 31, offset));
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite (fd, buf, count, offset);
# endif
return result;
}
@ -85,11 +72,3 @@ __libc_pwrite (fd, buf, count, offset)
strong_alias (__libc_pwrite, __pwrite)
weak_alias (__libc_pwrite, pwrite)
# define __libc_pwrite(fd, buf, count, offset) \
static internal_function __emulate_pwrite (fd, buf, count, offset)
#endif
#if __ASSUME_PWRITE_SYSCALL == 0
# include <sysdeps/posix/pwrite.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -34,28 +33,15 @@
# define __NR_pwrite __NR_pwrite64
#endif
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
off64_t offset) internal_function;
# endif
static ssize_t
do_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
{
ssize_t result;
/* First try the syscall. */
result = INLINE_SYSCALL (pwrite, 5, fd, CHECK_N (buf, count), count,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite64 (fd, buf, count, offset);
# endif
return result;
}
@ -83,11 +69,3 @@ __libc_pwrite64 (fd, buf, count, offset)
weak_alias (__libc_pwrite64, __pwrite64)
libc_hidden_weak (__pwrite64)
weak_alias (__libc_pwrite64, pwrite64)
# define __libc_pwrite64(fd, buf, count, offset) \
static internal_function __emulate_pwrite64 (fd, buf, count, offset)
#endif
#if __ASSUME_PWRITE_SYSCALL == 0
# include <sysdeps/posix/pwrite64.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -35,12 +34,6 @@
# define __NR_pread __NR_pread64
#endif
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
# if __ASSUME_PREAD_SYSCALL == 0
static ssize_t __emulate_pread (int fd, void *buf, size_t count,
off_t offset) internal_function;
# endif
ssize_t
__libc_pread (fd, buf, count, offset)
@ -53,27 +46,15 @@ __libc_pread (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
/* First try the syscall. */
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread (fd, buf, count, offset);
# endif
return result;
}
int oldtype = LIBC_CANCEL_ASYNC ();
/* First try the syscall. */
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -82,11 +63,3 @@ __libc_pread (fd, buf, count, offset)
strong_alias (__libc_pread, __pread)
weak_alias (__libc_pread, pread)
# define __libc_pread(fd, buf, count, offset) \
static internal_function __emulate_pread (fd, buf, count, offset)
#endif
#if __ASSUME_PREAD_SYSCALL == 0
# include <sysdeps/posix/pread.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -34,12 +33,6 @@
# define __NR_pread __NR_pread64
#endif
#if defined __NR_pread || __ASSUME_PREAD_SYSCALL > 0
# if __ASSUME_PREAD_SYSCALL == 0
static ssize_t __emulate_pread64 (int fd, void *buf, size_t count,
off64_t offset) internal_function;
# endif
ssize_t
__libc_pread64 (fd, buf, count, offset)
@ -52,29 +45,17 @@ __libc_pread64 (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
/* First try the syscall. */
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread64 (fd, buf, count, offset);
# endif
return result;
}
int oldtype = LIBC_CANCEL_ASYNC ();
/* First try the syscall. */
result = INLINE_SYSCALL (pread, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
# if __ASSUME_PREAD_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pread64 (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -83,11 +64,3 @@ __libc_pread64 (fd, buf, count, offset)
weak_alias (__libc_pread64, __pread64)
weak_alias (__libc_pread64, pread64)
# define __libc_pread64(fd, buf, count, offset) \
static internal_function __emulate_pread64 (fd, buf, count, offset)
#endif
#if __ASSUME_PREAD_SYSCALL == 0
# include <sysdeps/posix/pread64.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -35,12 +34,6 @@
# define __NR_pwrite __NR_pwrite64
#endif
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite (int fd, const void *buf, size_t count,
off_t offset) internal_function;
# endif
ssize_t
__libc_pwrite (fd, buf, count, offset)
@ -53,27 +46,15 @@ __libc_pwrite (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
/* First try the syscall. */
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite (fd, buf, count, offset);
# endif
return result;
}
int oldtype = LIBC_CANCEL_ASYNC ();
/* First try the syscall. */
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR (offset >> 31, offset));
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -82,11 +63,3 @@ __libc_pwrite (fd, buf, count, offset)
strong_alias (__libc_pwrite, __pwrite)
weak_alias (__libc_pwrite, pwrite)
# define __libc_pwrite(fd, buf, count, offset) \
static internal_function __emulate_pwrite (fd, buf, count, offset)
#endif
#if __ASSUME_PWRITE_SYSCALL == 0
# include <sysdeps/posix/pwrite.c>
#endif

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997, 1998, 2000, 2002, 2003, 2004, 2006
Free Software Foundation, Inc.
/* Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ralf Baechle <ralf@gnu.org>, 1998.
@ -34,12 +33,6 @@
# define __NR_pwrite __NR_pwrite64
#endif
#if defined __NR_pwrite || __ASSUME_PWRITE_SYSCALL > 0
# if __ASSUME_PWRITE_SYSCALL == 0
static ssize_t __emulate_pwrite64 (int fd, const void *buf, size_t count,
off64_t offset) internal_function;
# endif
ssize_t
__libc_pwrite64 (fd, buf, count, offset)
@ -52,30 +45,18 @@ __libc_pwrite64 (fd, buf, count, offset)
if (SINGLE_THREAD_P)
{
/* First try the syscall. */
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite64 (fd, buf, count, offset);
# endif
return result;
}
int oldtype = LIBC_CANCEL_ASYNC ();
/* First try the syscall. */
result = INLINE_SYSCALL (pwrite, 6, fd, CHECK_N (buf, count), count, 0,
__LONG_LONG_PAIR ((off_t) (offset >> 32),
(off_t) (offset & 0xffffffff)));
# if __ASSUME_PWRITE_SYSCALL == 0
if (result == -1 && errno == ENOSYS)
/* No system call available. Use the emulation. */
result = __emulate_pwrite64 (fd, buf, count, offset);
# endif
LIBC_CANCEL_RESET (oldtype);
@ -85,11 +66,3 @@ __libc_pwrite64 (fd, buf, count, offset)
weak_alias (__libc_pwrite64, __pwrite64)
libc_hidden_weak (__pwrite64)
weak_alias (__libc_pwrite64, pwrite64)
# define __libc_pwrite64(fd, buf, count, offset) \
static internal_function __emulate_pwrite64 (fd, buf, count, offset)
#endif
#if __ASSUME_PWRITE_SYSCALL == 0
# include <sysdeps/posix/pwrite64.c>
#endif

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997-2000,2002,2003,2005,2006 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
@ -29,12 +29,6 @@
translate it here. */
#include <kernel_sigaction.h>
#if __ASSUME_REALTIME_SIGNALS == 0
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. This is the definition. */
int __libc_missing_rt_sigs;
#endif
/* If ACT is not NULL, change the action for SIG to *ACT.
If OACT is not NULL, put the old action for SIG in *OACT. */
@ -44,87 +38,36 @@ __libc_sigaction (sig, act, oact)
const struct sigaction *act;
struct sigaction *oact;
{
#if __ASSUME_REALTIME_SIGNALS == 0
struct old_kernel_sigaction k_sigact, k_osigact;
#endif
int result;
#if defined __NR_rt_sigaction || __ASSUME_REALTIME_SIGNALS > 0
/* First try the RT signals. */
# if __ASSUME_REALTIME_SIGNALS == 0
if (!__libc_missing_rt_sigs)
# endif
{
struct kernel_sigaction kact, koact;
/* Save the current error value for later. We need not do this
if we are guaranteed to have realtime signals. */
# if __ASSUME_REALTIME_SIGNALS == 0
int saved_errno = errno;
# endif
struct kernel_sigaction kact, koact;
if (act)
{
kact.k_sa_handler = act->sa_handler;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
kact.sa_flags = act->sa_flags;
# ifdef HAVE_SA_RESTORER
kact.sa_restorer = act->sa_restorer;
# endif
}
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
result = INLINE_SYSCALL (rt_sigaction, 4, sig,
act ? __ptrvalue (&kact) : NULL,
oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
# if __ASSUME_REALTIME_SIGNALS == 0
if (result >= 0 || errno != ENOSYS)
# endif
{
if (oact && result >= 0)
{
oact->sa_handler = koact.k_sa_handler;
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
oact->sa_flags = koact.sa_flags;
# ifdef HAVE_SA_RESTORER
oact->sa_restorer = koact.sa_restorer;
# endif
}
return result;
}
# if __ASSUME_REALTIME_SIGNALS == 0
__set_errno (saved_errno);
__libc_missing_rt_sigs = 1;
# endif
}
#endif
#if __ASSUME_REALTIME_SIGNALS == 0
if (act)
{
k_sigact.k_sa_handler = act->sa_handler;
k_sigact.sa_mask = act->sa_mask.__val[0];
k_sigact.sa_flags = act->sa_flags;
# ifdef HAVE_SA_RESTORER
k_sigact.sa_restorer = act->sa_restorer;
# endif
kact.k_sa_handler = act->sa_handler;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
kact.sa_flags = act->sa_flags;
#ifdef HAVE_SA_RESTORER
kact.sa_restorer = act->sa_restorer;
#endif
}
result = INLINE_SYSCALL (sigaction, 3, sig,
act ? __ptrvalue (&k_sigact) : NULL,
oact ? __ptrvalue (&k_osigact) : NULL);
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
result = INLINE_SYSCALL (rt_sigaction, 4, sig,
act ? __ptrvalue (&kact) : NULL,
oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
if (oact && result >= 0)
{
oact->sa_handler = k_osigact.k_sa_handler;
oact->sa_mask.__val[0] = k_osigact.sa_mask;
oact->sa_flags = k_osigact.sa_flags;
# ifdef HAVE_SA_RESTORER
oact->sa_restorer = k_osigact.sa_restorer;
# endif
oact->sa_handler = koact.k_sa_handler;
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
oact->sa_flags = koact.sa_flags;
#ifdef HAVE_SA_RESTORER
oact->sa_restorer = koact.sa_restorer;
#endif
}
return result;
#endif
}
libc_hidden_def (__libc_sigaction)

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1997,1998,1999,2000,2003,2006
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
@ -27,37 +26,11 @@
#include <kernel-features.h>
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. The definition is in sigaction.c. */
extern int __libc_missing_rt_sigs;
/* Change the set of blocked signals to SET,
wait until a signal arrives, and restore the set of blocked signals. */
int
sigpending (set)
sigset_t *set;
{
#if __ASSUME_REALTIME_SIGNALS > 0
return INLINE_SYSCALL (rt_sigpending, 2, CHECK_SIGSET (set), _NSIG / 8);
#else
# ifdef __NR_rt_sigpending
/* First try the RT signals. */
if (!__libc_missing_rt_sigs)
{
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
int saved_errno = errno;
int result = INLINE_SYSCALL (rt_sigpending, 2, CHECK_SIGSET (set), _NSIG / 8);
if (result >= 0 || errno != ENOSYS)
return result;
__set_errno (saved_errno);
__libc_missing_rt_sigs = 1;
}
# endif
return INLINE_SYSCALL (sigpending, 1, CHECK_SIGSET (set));
#endif
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997-2001,2003,2004,2006 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
@ -27,11 +27,6 @@
#include <kernel-features.h>
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. The definition is in sigaction.c. */
extern int __libc_missing_rt_sigs;
/* Get and/or change the set of blocked signals. */
int
__sigprocmask (how, set, oset)
@ -60,31 +55,7 @@ __sigprocmask (how, set, oset)
}
#endif
#if __ASSUME_REALTIME_SIGNALS > 0
return INLINE_SYSCALL (rt_sigprocmask, 4, how, CHECK_SIGSET_NULL_OK (set),
CHECK_SIGSET_NULL_OK (oset), _NSIG / 8);
#else
# ifdef __NR_rt_sigprocmask
/* First try the RT signals. */
if (!__libc_missing_rt_sigs)
{
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
int saved_errno = errno;
int result = INLINE_SYSCALL (rt_sigprocmask, 4, how,
CHECK_SIGSET_NULL_OK (set),
CHECK_SIGSET_NULL_OK (oset), _NSIG / 8);
if (result >= 0 || errno != ENOSYS)
return result;
__set_errno (saved_errno);
__libc_missing_rt_sigs = 1;
}
# endif
return INLINE_SYSCALL (sigprocmask, 3, how, CHECK_SIGSET_NULL_OK (set),
CHECK_SIGSET_NULL_OK (oset));
#endif
}
weak_alias (__sigprocmask, sigprocmask)

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1996,1997,1998,1999,2000,2002,2003,2006
Free Software Foundation, Inc.
/* Copyright (C) 1996-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
@ -27,41 +26,11 @@
#include <kernel-features.h>
#if !__ASSUME_REALTIME_SIGNALS
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. The definition is in sigaction.c. */
extern int __libc_missing_rt_sigs;
static int
do_sigsuspend (const sigset_t *set)
{
# ifdef __NR_rt_sigsuspend
/* First try the RT signals. */
if (!__libc_missing_rt_sigs)
{
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
int saved_errno = errno;
int result = INLINE_SYSCALL (rt_sigsuspend, 2,
CHECK_SIGSET (set), _NSIG / 8);
if (result >= 0 || errno != ENOSYS)
return result;
__set_errno (saved_errno);
__libc_missing_rt_sigs = 1;
}
# endif
return INLINE_SYSCALL (sigsuspend, 3, 0, 0, set->__val[0]);
}
#else
static inline int __attribute__ ((always_inline))
do_sigsuspend (const sigset_t *set)
{
return INLINE_SYSCALL (rt_sigsuspend, 2, CHECK_SIGSET (set), _NSIG / 8);
}
#endif
/* Change the set of blocked signals to SET,
wait until a signal arrives, and restore the set of blocked signals. */

View File

@ -27,106 +27,40 @@
static void __rt_sigreturn_stub (void);
static void __sigreturn_stub (void);
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. */
int __libc_missing_rt_sigs;
int
__libc_sigaction (int sig, const struct sigaction *act, struct sigaction *oact)
{
struct old_kernel_sigaction k_sigact, k_osigact;
int ret;
#ifdef __NR_rt_sigaction
/* First try the RT signals. */
if (!__libc_missing_rt_sigs)
{
struct kernel_sigaction kact, koact;
unsigned long stub = 0;
int saved_errno = errno;
if (act)
{
kact.k_sa_handler = act->sa_handler;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
if (((kact.sa_flags = act->sa_flags) & SA_SIGINFO) != 0)
stub = (unsigned long) &__rt_sigreturn_stub;
else
stub = (unsigned long) &__sigreturn_stub;
stub -= 8;
kact.sa_restorer = NULL;
}
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
ret = INLINE_SYSCALL (rt_sigaction, 5, sig, act ? &kact : 0,
oact ? &koact : 0, stub, _NSIG / 8);
if (ret >= 0 || errno != ENOSYS)
{
if (oact && ret >= 0)
{
oact->sa_handler = koact.k_sa_handler;
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
oact->sa_flags = koact.sa_flags;
oact->sa_restorer = koact.sa_restorer;
}
return ret;
}
__set_errno (saved_errno);
__libc_missing_rt_sigs = 1;
}
#endif
/* Magic to tell the kernel we are using "new-style" signals, in that
the signal table is not kept in userspace. Not the same as the
really-new-style rt signals. */
sig = -sig;
struct kernel_sigaction kact, koact;
unsigned long stub = 0;
if (act)
{
k_sigact.k_sa_handler = act->sa_handler;
k_sigact.sa_mask = act->sa_mask.__val[0];
k_sigact.sa_flags = act->sa_flags;
k_sigact.sa_restorer = NULL;
kact.k_sa_handler = act->sa_handler;
memcpy (&kact.sa_mask, &act->sa_mask, sizeof (sigset_t));
if (((kact.sa_flags = act->sa_flags) & SA_SIGINFO) != 0)
stub = (unsigned long) &__rt_sigreturn_stub;
else
stub = (unsigned long) &__sigreturn_stub;
stub -= 8;
kact.sa_restorer = NULL;
}
{
register int r_syscallnr __asm__("%g1") = __NR_sigaction;
register int r_sig __asm__("%o0") = sig;
register struct old_kernel_sigaction *r_act __asm__("%o1");
register struct old_kernel_sigaction *r_oact __asm__("%o2");
/* XXX The size argument hopefully will have to be changed to the
real size of the user-level sigset_t. */
ret = INLINE_SYSCALL (rt_sigaction, 5, sig, act ? &kact : 0,
oact ? &koact : 0, stub, _NSIG / 8);
r_act = act ? &k_sigact : NULL;
r_oact = oact ? &k_osigact : NULL;
__asm__ __volatile__("t 0x10\n\t"
"bcc 1f\n\t"
" nop\n\t"
"sub %%g0,%%o0,%%o0\n"
"1:"
: "=r"(r_sig)
: "r"(r_syscallnr), "r"(r_act), "r"(r_oact),
"0"(r_sig));
ret = r_sig;
}
if (ret >= 0)
if (oact && ret >= 0)
{
if (oact)
{
oact->sa_handler = k_osigact.k_sa_handler;
oact->sa_mask.__val[0] = k_osigact.sa_mask;
oact->sa_flags = k_osigact.sa_flags;
oact->sa_restorer = NULL;
}
return ret;
oact->sa_handler = koact.k_sa_handler;
memcpy (&oact->sa_mask, &koact.sa_mask, sizeof (sigset_t));
oact->sa_flags = koact.sa_flags;
oact->sa_restorer = koact.sa_restorer;
}
__set_errno (-ret);
return -1;
return ret;
}
libc_hidden_def (__libc_sigaction)

View File

@ -1,10 +1,6 @@
#include <kernel-features.h>
#if __ASSUME_MSG_NOSIGNAL
# define NO_SIGPIPE
# define send_flags MSG_NOSIGNAL
#else
# define send_flags 0
#endif
#define NO_SIGPIPE
#define send_flags MSG_NOSIGNAL
#include <misc/syslog.c>

View File

@ -1,5 +1,5 @@
/* Test whether RT signals are really available.
Copyright (C) 1997, 1999, 2006 Free Software Foundation, Inc.
Copyright (C) 1997-2012 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
@ -25,11 +25,5 @@
static int
kernel_has_rtsig (void)
{
#if __ASSUME_REALTIME_SIGNALS
return 1;
#else
struct utsname name;
return uname (&name) == 0 && __strverscmp (name.release, "2.1.70") >= 0;
#endif
}

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1991-1993,1996-2002,2006,2009,2010
Free Software Foundation, Inc.
/* Copyright (C) 1991-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
@ -155,12 +154,7 @@ ttyname (int fd)
return NULL;
}
if (__builtin_expect (len != -1
#ifndef __ASSUME_PROC_SELF_FD_SYMLINK
/* This is for Linux 2.0. */
&& ttyname_buf[0] != '['
#endif
, 1))
if (__builtin_expect (len != -1, 1))
{
if ((size_t) len >= buflen)
return NULL;

View File

@ -1,5 +1,4 @@
/* Copyright (C) 1991-1993,1995-2001,2003,2006,2010
Free Software Foundation, Inc.
/* Copyright (C) 1991-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
@ -141,12 +140,7 @@ __ttyname_r (int fd, char *buf, size_t buflen)
return ERANGE;
}
if (__builtin_expect (ret != -1
#ifndef __ASSUME_PROC_SELF_FD_SYMLINK
/* This is for Linux 2.0. */
&& buf[0] != '['
#endif
, 1))
if (__builtin_expect (ret != -1, 1))
{
#define UNREACHABLE_LEN strlen ("(unreachable)")
if (ret > UNREACHABLE_LEN