mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 10:50:07 +00:00
Remove some pre-2.6.16 Linux kernel conditionals.
This commit is contained in:
parent
a281decc87
commit
93df14eee8
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
||||
2012-08-07 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* sysdeps/unix/sysv/linux/kernel-features.h
|
||||
(__ASSUME_PROT_GROWSUPDOWN): Remove.
|
||||
(__ASSUME_NO_CLONE_DETACHED): Likewise.
|
||||
(__ASSUME_GETDENTS32_D_TYPE): Likewise.
|
||||
(__ASSUME_WAITID_SYSCALL): Likewise.
|
||||
* sysdeps/unix/sysv/linux/dl-execstack.c
|
||||
(_dl_make_stack_executable) [PROT_GROWSDOWN || PROT_GROWSUP]: Make
|
||||
code unconditional.
|
||||
(_dl_make_stack_executable) [!__ASSUME_PROT_GROWSUPDOWN]: Remove
|
||||
conditional code.
|
||||
* sysdeps/unix/sysv/linux/getdents.c (__GETDENTS)
|
||||
[__ASSUME_GETDENTS32_D_TYPE]: Make code unconditional.
|
||||
(__GETDENTS) [!__ASSUME_GETDENTS32_D_TYPE]: Remove conditional
|
||||
code.
|
||||
* sysdeps/unix/sysv/linux/waitid.c [__NR_waitid]: Make code
|
||||
unconditional.
|
||||
[__ASSUME_WAITID_SYSCALL]: Likewise.
|
||||
[!__ASSUME_WAITID_SYSCALL]: Remove conditional code.
|
||||
|
||||
2012-08-07 Roland McGrath <roland@hack.frob.com>
|
||||
|
||||
* sysdeps/unix/closedir.c: Renamed to ...
|
||||
|
@ -1,3 +1,8 @@
|
||||
2012-08-07 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* sysdeps/pthread/createthread.c (create_thread)
|
||||
[!__ASSUME_NO_CLONE_DETACHED]: Remove conditional code.
|
||||
|
||||
2012-08-03 Joseph Myers <joseph@codesourcery.com>
|
||||
|
||||
* nptl-init.c (sigcancel_handler) [__ASSUME_CORRECT_SI_PID]: Make
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2002-2007, 2008, 2010 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2002-2012 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
|
||||
|
||||
@ -179,18 +179,11 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr,
|
||||
sys_exit() in the location pointed to by the seventh parameter
|
||||
to CLONE.
|
||||
|
||||
CLONE_DETACHED
|
||||
No signal is generated if the thread exists and it is
|
||||
automatically reaped.
|
||||
|
||||
The termination signal is chosen to be zero which means no signal
|
||||
is sent. */
|
||||
int clone_flags = (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGNAL
|
||||
| CLONE_SETTLS | CLONE_PARENT_SETTID
|
||||
| CLONE_CHILD_CLEARTID | CLONE_SYSVSEM
|
||||
#if __ASSUME_NO_CLONE_DETACHED == 0
|
||||
| CLONE_DETACHED
|
||||
#endif
|
||||
| 0);
|
||||
|
||||
if (__builtin_expect (THREAD_GETMEM (THREAD_SELF, report_events), 0))
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Stack executability handling for GNU dynamic linker. Linux version.
|
||||
Copyright (C) 2003, 2004, 2005, 2006 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
|
||||
@ -46,95 +46,11 @@ _dl_make_stack_executable (void **stack_endp)
|
||||
|| __builtin_expect (*stack_endp != __libc_stack_end, 0))
|
||||
return EPERM;
|
||||
|
||||
/* Newer Linux kernels support a flag to make our job easy. */
|
||||
#if defined PROT_GROWSDOWN || defined PROT_GROWSUP
|
||||
# if __ASSUME_PROT_GROWSUPDOWN == 0
|
||||
static bool no_growsupdown;
|
||||
if (! no_growsupdown)
|
||||
# endif
|
||||
{
|
||||
if (__builtin_expect (__mprotect ((void *) page, GLRO(dl_pagesize),
|
||||
__stack_prot) == 0, 1))
|
||||
goto return_success;
|
||||
# if __ASSUME_PROT_GROWSUPDOWN == 0
|
||||
if (errno == EINVAL)
|
||||
no_growsupdown = true;
|
||||
else
|
||||
# endif
|
||||
{
|
||||
result = errno;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* There is always a hole in the address space below the bottom of the
|
||||
stack. So when we make an mprotect call that starts below the bottom
|
||||
of the stack, it will include the hole and fail with ENOMEM.
|
||||
|
||||
We start with a random guess at how deep the stack might have gotten
|
||||
so as to have extended the GROWSDOWN mapping to lower pages. */
|
||||
|
||||
#if __ASSUME_PROT_GROWSUPDOWN == 0
|
||||
size_t size = GLRO(dl_pagesize) * 8;
|
||||
|
||||
# if _STACK_GROWS_DOWN
|
||||
page = page + GLRO(dl_pagesize) - size;
|
||||
while (1)
|
||||
{
|
||||
if (__mprotect ((void *) page, size,
|
||||
__stack_prot & ~PROT_GROWSDOWN) == 0)
|
||||
/* We got this chunk changed; loop to do another chunk below. */
|
||||
page -= size;
|
||||
else
|
||||
{
|
||||
if (errno != ENOMEM) /* Unexpected failure mode. */
|
||||
{
|
||||
result = errno;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (size == GLRO(dl_pagesize))
|
||||
/* We just tried to mprotect the top hole page and failed.
|
||||
We are done. */
|
||||
break;
|
||||
|
||||
/* Our mprotect call failed because it started below the lowest
|
||||
stack page. Try again on just the top half of that region. */
|
||||
size /= 2;
|
||||
page += size;
|
||||
}
|
||||
}
|
||||
|
||||
# elif _STACK_GROWS_UP
|
||||
while (1)
|
||||
{
|
||||
if (__mprotect ((void *) page, size, __stack_prot & ~PROT_GROWSUP) == 0)
|
||||
/* We got this chunk changed; loop to do another chunk below. */
|
||||
page += size;
|
||||
else
|
||||
{
|
||||
if (errno != ENOMEM) /* Unexpected failure mode. */
|
||||
{
|
||||
result = errno;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (size == GLRO(dl_pagesize))
|
||||
/* We just tried to mprotect the lowest hole page and failed.
|
||||
We are done. */
|
||||
break;
|
||||
|
||||
/* Our mprotect call failed because it extended past the highest
|
||||
stack page. Try again on just the bottom half of that region. */
|
||||
size /= 2;
|
||||
}
|
||||
}
|
||||
|
||||
# else
|
||||
# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
|
||||
# endif
|
||||
#endif
|
||||
if (__builtin_expect (__mprotect ((void *) page, GLRO(dl_pagesize),
|
||||
__stack_prot) == 0, 1))
|
||||
goto return_success;
|
||||
result = errno;
|
||||
goto out;
|
||||
|
||||
return_success:
|
||||
/* Clear the address. */
|
||||
|
@ -97,7 +97,6 @@ __GETDENTS (int fd, char *buf, size_t nbytes)
|
||||
{
|
||||
ssize_t retval;
|
||||
|
||||
#ifdef __ASSUME_GETDENTS32_D_TYPE
|
||||
/* The d_ino and d_off fields in kernel_dirent and dirent must have
|
||||
the same sizes and alignments. */
|
||||
if (sizeof (DIRENT_TYPE) == sizeof (struct dirent)
|
||||
@ -135,7 +134,6 @@ __GETDENTS (int fd, char *buf, size_t nbytes)
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif
|
||||
|
||||
off64_t last_offset = -1;
|
||||
|
||||
@ -293,11 +291,7 @@ __GETDENTS (int fd, char *buf, size_t nbytes)
|
||||
DIRENT_SET_DP_INO(dp, kdp->d_ino);
|
||||
dp->d_off = kdp->d_off;
|
||||
dp->d_reclen = new_reclen;
|
||||
#ifdef __ASSUME_GETDENTS32_D_TYPE
|
||||
dp->d_type = *((char *) kdp + kdp->d_reclen - 1);
|
||||
#else
|
||||
dp->d_type = DT_UNKNOWN;
|
||||
#endif
|
||||
memcpy (dp->d_name, kdp->d_name,
|
||||
kdp->d_reclen - offsetof (struct kernel_dirent, d_name));
|
||||
|
||||
|
@ -139,10 +139,6 @@
|
||||
# define __ASSUME_FADVISE64_64_SYSCALL 1
|
||||
#endif
|
||||
|
||||
/* The PROT_GROWSDOWN/PROT_GROWSUP flags were introduced in the 2.6.0-test
|
||||
series. */
|
||||
#define __ASSUME_PROT_GROWSUPDOWN 1
|
||||
|
||||
/* Starting with 2.6.0 PowerPC adds signal/swapcontext support for Vector
|
||||
SIMD (AKA Altivec, VMX) instructions and register state. This changes
|
||||
the overall size of the sigcontext and adds the swapcontext syscall. */
|
||||
@ -150,19 +146,6 @@
|
||||
# define __ASSUME_SWAPCONTEXT_SYSCALL 1
|
||||
#endif
|
||||
|
||||
/* The CLONE_DETACHED flag is not necessary in 2.6.2 kernels, it is
|
||||
implied. */
|
||||
#define __ASSUME_NO_CLONE_DETACHED 1
|
||||
|
||||
/* Starting with version 2.6.4-rc1 the getdents syscall returns d_type
|
||||
information as well and in between 2.6.5 and 2.6.8 most compat wrappers
|
||||
were fixed too. Except s390{,x} which was fixed in 2.6.11. */
|
||||
#define __ASSUME_GETDENTS32_D_TYPE 1
|
||||
|
||||
/* Starting with version 2.6.9, the waitid system call is available.
|
||||
Except for powerpc{,64} and s390{,x}, where it is available in 2.6.12. */
|
||||
#define __ASSUME_WAITID_SYSCALL 1
|
||||
|
||||
/* On sparc64 stat64/lstat64/fstat64 syscalls were introduced in 2.6.12. */
|
||||
#if defined __sparc__ && defined __arch64__
|
||||
# define __ASSUME_STAT64_SYSCALL 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Linux implementation of waitid.
|
||||
Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
Copyright (C) 2004-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
|
||||
@ -19,14 +19,8 @@
|
||||
#include <stddef.h>
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
#include <kernel-features.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
|
||||
#ifdef __NR_waitid
|
||||
|
||||
# if __ASSUME_WAITID_SYSCALL > 0
|
||||
|
||||
static inline int
|
||||
do_waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options)
|
||||
{
|
||||
@ -34,37 +28,6 @@ do_waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options)
|
||||
pass if we were using waitid to simulate wait3/wait4. */
|
||||
return INLINE_SYSCALL (waitid, 5, idtype, id, infop, options, NULL);
|
||||
}
|
||||
# define NO_DO_WAITID
|
||||
|
||||
# else
|
||||
|
||||
static int do_compat_waitid (idtype_t idtype, id_t id,
|
||||
siginfo_t *infop, int options);
|
||||
# define DO_WAITID do_compat_waitid
|
||||
|
||||
static int
|
||||
do_waitid (idtype_t idtype, id_t id, siginfo_t *infop, int options)
|
||||
{
|
||||
static int waitid_works;
|
||||
if (waitid_works > 0)
|
||||
return INLINE_SYSCALL (waitid, 5, idtype, id, infop, options, NULL);
|
||||
if (waitid_works == 0)
|
||||
{
|
||||
int result = INLINE_SYSCALL (waitid, 5,
|
||||
idtype, id, infop, options, NULL);
|
||||
if (result < 0 && errno == ENOSYS)
|
||||
waitid_works = -1;
|
||||
else
|
||||
{
|
||||
waitid_works = 1;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return do_compat_waitid (idtype, id, infop, options);
|
||||
}
|
||||
|
||||
# endif
|
||||
|
||||
#endif
|
||||
#define NO_DO_WAITID
|
||||
|
||||
#include "sysdeps/posix/waitid.c"
|
||||
|
Loading…
Reference in New Issue
Block a user