diff options
author | Joseph Myers <joseph@codesourcery.com> | 2012-05-25 19:19:30 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2012-05-25 19:19:30 +0000 |
commit | 21708942c9b115a91dc03318a5f9e14328c5a71e (patch) | |
tree | e0b3797820e23ab73ebdab3c34d20943e911669b | |
parent | a386f1cc229e7de02740bef18bdd5d272d1e7537 (diff) | |
download | glibc-21708942c9b115a91dc03318a5f9e14328c5a71e.tar.gz glibc-21708942c9b115a91dc03318a5f9e14328c5a71e.tar.xz glibc-21708942c9b115a91dc03318a5f9e14328c5a71e.zip |
Remove pre-2.4 Linux kernel support.
39 files changed, 240 insertions, 1426 deletions
diff --git a/ChangeLog b/ChangeLog index 2f6a533a7a..8ddc57e880 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,163 @@ +2012-05-25 Joseph Myers <joseph@codesourcery.com> + + [BZ #13717] + * sysdeps/unix/sysv/linux/configure.in (arch_minimum_kernel): Set + to 2.4.0 where earlier. + * sysdeps/unix/sysv/linux/configure: Regenerated. + * sysdeps/unix/sysv/linux/i386/chown.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/fchown.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/fchownat.c (fchownat) + [__ASSUME_32BITUIDS]: Make code unconditional. + (fchownat) [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/getegid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/geteuid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/getgid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/getgroups.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/getresgid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/getresuid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/getuid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/lchown.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/msgctl.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/semctl.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setegid.c: Do not include + <kernel-features.h>. + [__NR_setresgid] (__setresgid): Do not declare. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/seteuid.c: Do not include + <kernel-features.h>. + [__NR_setresuid] (__setresuid): Do not declare. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setfsgid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setfsuid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setgid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setgroups.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setregid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setresgid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setresuid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setreuid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/setuid.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/i386/shmctl.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/kernel-features.h + (__ASSUME_SETRESUID_SYSCALL): Remove. + (__ASSUME_SETRESGID_SYSCALL): Likewise. + (__ASSUME_32BITUIDS): Likewise. + (__ASSUME_LDT_WORKS): Likewise. + (__ASSUME_O_DIRECTORY): Likewise. + (__ASSUME_NEW_GETRLIMIT_SYSCALL): Define conditional on + architecture but not kernel version. + (__ASSUME_TRUNCATE64_SYSCALL): Likewise. + (__ASSUME_MMAP2_SYSCALL): Likewise. + (__ASSUME_STAT64_SYSCALL): Likewise. + (__ASSUME_IPC64): Likewise. + * sysdeps/unix/sysv/linux/local-setxid.h: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/opendir.c: Do not include + <kernel-features.h>. + [__ASSUME_O_DIRECTORY]: Make code unconditional. + * sysdeps/unix/sysv/linux/opensock.c [__LINUX_KERNEL_VERSION < + 132096]: Remove conditional code. + [__LINUX_KERNEL_VERSION >= 132096]: Make code unconditional. + * sysdeps/unix/sysv/linux/s390/s390-32/chown.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/s390/s390-32/lchown.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/setegid.c: Do not include + <kernel-features.h>. + [__NR_setresgid || __ASSUME_SETRESGID_SYSCALL]: Make code + unconditional. + (__setresgid): Do not declare. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/seteuid.c: Do not include + <kernel-features.h>. + [__NR_setresuid || __ASSUME_SETRESUID_SYSCALL]: Make code + unconditional. + (__setresuid): Do not declare. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/sh/chown.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + * sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c: Do not include + <kernel-features.h>. + [__ASSUME_32BITUIDS]: Make code unconditional. + [!__ASSUME_32BITUIDS]: Remove conditional code. + 2012-05-25 Richard Henderson <rth@twiddle.net> * sysdeps/powerpc/powerpc32/dl-irel.h (elf_ifunc_invoke): Pass diff --git a/NEWS b/NEWS index 1e8c777784..761e36ae60 100644 --- a/NEWS +++ b/NEWS @@ -67,7 +67,7 @@ Version 2.16 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. +* Compatibility code for Linux kernel versions before 2.4 has been removed. Note that glibc is not expected to work with any Linux kernel version before 2.6. diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure index fe61c111be..ef2f715782 100644 --- a/sysdeps/unix/sysv/linux/configure +++ b/sysdeps/unix/sysv/linux/configure @@ -284,25 +284,25 @@ test -n "$arch_minimum_kernel" || case "$machine" in i386*) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.2.0 + arch_minimum_kernel=2.4.0 ;; powerpc/powerpc32) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.2.0 + arch_minimum_kernel=2.4.0 ;; powerpc/powerpc64) arch_minimum_kernel=2.4.21 ;; s390/s390-32) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.2.10 + arch_minimum_kernel=2.4.0 ;; s390/s390-64) libc_cv_gcc_unwind_find_fde=yes arch_minimum_kernel=2.4.0 ;; sh*) - arch_minimum_kernel=2.3.99 + arch_minimum_kernel=2.4.0 libc_cv_gcc_unwind_find_fde=yes ;; sparc/sparc64*) @@ -311,13 +311,10 @@ case "$machine" in ;; sparc*) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.2.0 - ;; - x86_64*) arch_minimum_kernel=2.4.0 ;; *) - arch_minimum_kernel=2.2.0 + arch_minimum_kernel=2.4.0 ;; esac if test -n "$minimum_kernel"; then diff --git a/sysdeps/unix/sysv/linux/configure.in b/sysdeps/unix/sysv/linux/configure.in index 72fbe8422b..c3ec328b9e 100644 --- a/sysdeps/unix/sysv/linux/configure.in +++ b/sysdeps/unix/sysv/linux/configure.in @@ -41,25 +41,25 @@ test -n "$arch_minimum_kernel" || case "$machine" in i386*) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.2.0 + arch_minimum_kernel=2.4.0 ;; powerpc/powerpc32) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.2.0 + arch_minimum_kernel=2.4.0 ;; powerpc/powerpc64) arch_minimum_kernel=2.4.21 ;; s390/s390-32) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.2.10 + arch_minimum_kernel=2.4.0 ;; s390/s390-64) libc_cv_gcc_unwind_find_fde=yes arch_minimum_kernel=2.4.0 ;; sh*) - arch_minimum_kernel=2.3.99 + arch_minimum_kernel=2.4.0 libc_cv_gcc_unwind_find_fde=yes ;; sparc/sparc64*) @@ -68,13 +68,10 @@ case "$machine" in ;; sparc*) libc_cv_gcc_unwind_find_fde=yes - arch_minimum_kernel=2.2.0 - ;; - x86_64*) arch_minimum_kernel=2.4.0 ;; *) - arch_minimum_kernel=2.2.0 + arch_minimum_kernel=2.4.0 ;; esac if test -n "$minimum_kernel"; then diff --git a/sysdeps/unix/sysv/linux/i386/chown.c b/sysdeps/unix/sysv/linux/i386/chown.c index c8e53e4e00..5ea3cfd869 100644 --- a/sysdeps/unix/sysv/linux/i386/chown.c +++ b/sysdeps/unix/sysv/linux/i386/chown.c @@ -24,7 +24,6 @@ #include <bp-checks.h> #include <linux/posix_types.h> -#include <kernel-features.h> /* In Linux 2.1.x the chown functions have been changed. A new function lchown @@ -41,44 +40,12 @@ extern int __chown_is_lchown (const char *__file, uid_t __owner, extern int __real_chown (const char *__file, uid_t __owner, gid_t __group); -#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 */ +/* Consider moving to syscalls.list. */ int __real_chown (const char *file, uid_t owner, gid_t group) { -#if __ASSUME_32BITUIDS return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group); -#else - /* !__ASSUME_32BITUIDS */ -# 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; - } - - return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group); -#endif } diff --git a/sysdeps/unix/sysv/linux/i386/fchown.c b/sysdeps/unix/sysv/linux/i386/fchown.c index e520db9fea..4d76538b6c 100644 --- a/sysdeps/unix/sysv/linux/i386/fchown.c +++ b/sysdeps/unix/sysv/linux/i386/fchown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2003, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-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 @@ -22,46 +22,13 @@ #include <sys/syscall.h> #include <linux/posix_types.h> -#include <kernel-features.h> -#ifdef __NR_fchown32 -# 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_fchown32 */ +/* Consider moving to syscalls.list. */ int __fchown (int fd, uid_t owner, gid_t group) { -#if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (fchown32, 3, fd, owner, group); -#else -# ifdef __NR_fchown32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - int saved_errno = errno; - - result = INLINE_SYSCALL (fchown32, 3, fd, owner, group); - if (result == 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_fchown32 */ - - if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U)) - || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - return INLINE_SYSCALL (fchown, 3, fd, owner, group); -#endif } weak_alias (__fchown, fchown) diff --git a/sysdeps/unix/sysv/linux/i386/fchownat.c b/sysdeps/unix/sysv/linux/i386/fchownat.c index 6b748d16ba..18c8f0b317 100644 --- a/sysdeps/unix/sysv/linux/i386/fchownat.c +++ b/sysdeps/unix/sysv/linux/i386/fchownat.c @@ -83,7 +83,6 @@ fchownat (int fd, const char *file, uid_t owner, gid_t group, int flag) file = buf; } -# if __ASSUME_32BITUIDS > 0 INTERNAL_SYSCALL_DECL (err); if (flag & AT_SYMLINK_NOFOLLOW) @@ -98,15 +97,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; diff --git a/sysdeps/unix/sysv/linux/i386/getegid.c b/sysdeps/unix/sysv/linux/i386/getegid.c index 8461be9e42..41c4d08c8a 100644 --- a/sysdeps/unix/sysv/linux/i386/getegid.c +++ b/sysdeps/unix/sysv/linux/i386/getegid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2003, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-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 @@ -20,41 +20,14 @@ #include <sysdep.h> #include <sys/syscall.h> -#include <kernel-features.h> -#ifdef __NR_getegid32 -# if __ASSUME_32BITUIDS == 0 -/* This variable is shared with all files that need to check for 32bit - uids. */ -extern int __libc_missing_32bit_uids attribute_hidden; -# endif -#endif /* __NR_getegid32 */ +/* Consider moving to syscalls.list. */ gid_t __getegid (void) { INTERNAL_SYSCALL_DECL (err); -#if __ASSUME_32BITUIDS > 0 - /* No error checking. */ return INTERNAL_SYSCALL (getegid32, err, 0); -#else -# ifdef __NR_getegid32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - - result = INTERNAL_SYSCALL (getegid32, err, 0); - if (! INTERNAL_SYSCALL_ERROR_P (result, err) - || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - return result; - - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_getegid32 */ - - /* No error checking. */ - return INTERNAL_SYSCALL (getegid, err, 0); -#endif } weak_alias (__getegid, getegid) diff --git a/sysdeps/unix/sysv/linux/i386/geteuid.c b/sysdeps/unix/sysv/linux/i386/geteuid.c index a0e4864dee..42e7686170 100644 --- a/sysdeps/unix/sysv/linux/i386/geteuid.c +++ b/sysdeps/unix/sysv/linux/i386/geteuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2003, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-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 @@ -20,41 +20,14 @@ #include <sysdep.h> #include <sys/syscall.h> -#include <kernel-features.h> -#ifdef __NR_geteuid32 -# if __ASSUME_32BITUIDS == 0 -/* This variable is shared with all files that need to check for 32bit - uids. */ -extern int __libc_missing_32bit_uids attribute_hidden; -# endif -#endif /* __NR_geteuid32 */ +/* Consider moving to syscalls.list. */ uid_t __geteuid (void) { INTERNAL_SYSCALL_DECL (err); -#if __ASSUME_32BITUIDS > 0 - /* No error checking. */ return INTERNAL_SYSCALL (geteuid32, err, 0); -#else -# ifdef __NR_geteuid32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - - result = INTERNAL_SYSCALL (geteuid32, err, 0); - if (! INTERNAL_SYSCALL_ERROR_P (result, err) - || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - return result; - - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_geteuid32 */ - - /* No error checking. */ - return INTERNAL_SYSCALL (geteuid, err, 0); -#endif } weak_alias (__geteuid, geteuid) diff --git a/sysdeps/unix/sysv/linux/i386/getgid.c b/sysdeps/unix/sysv/linux/i386/getgid.c index 30c4bc840b..e611fb494e 100644 --- a/sysdeps/unix/sysv/linux/i386/getgid.c +++ b/sysdeps/unix/sysv/linux/i386/getgid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2003, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-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 @@ -21,41 +21,13 @@ #include <sysdep.h> #include <sys/syscall.h> -#include <kernel-features.h> - -#ifdef __NR_getgid32 -# if __ASSUME_32BITUIDS == 0 -/* This variable is shared with all files that need to check for 32bit - uids. */ -extern int __libc_missing_32bit_uids attribute_hidden; -# endif -#endif /* __NR_getgid32 */ +/* Consider moving to syscalls.list. */ gid_t __getgid (void) { INTERNAL_SYSCALL_DECL (err); -#if __ASSUME_32BITUIDS > 0 - /* No error checking. */ return INTERNAL_SYSCALL (getgid32, err, 0); -#else -# ifdef __NR_getgid32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - - result = INTERNAL_SYSCALL (getgid32, err, 0); - if (! INTERNAL_SYSCALL_ERROR_P (result, err) - || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - return result; - - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_getgid32 */ - - /* No error checking. */ - return INTERNAL_SYSCALL (getgid, err, 0); -#endif } weak_alias (__getgid, getgid) diff --git a/sysdeps/unix/sysv/linux/i386/getgroups.c b/sysdeps/unix/sysv/linux/i386/getgroups.c index 97e1b0abef..e0871ec2d2 100644 --- a/sysdeps/unix/sysv/linux/i386/getgroups.c +++ b/sysdeps/unix/sysv/linux/i386/getgroups.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 2000, 2001, 2003 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 @@ -25,57 +25,16 @@ #include <bp-checks.h> #include <linux/posix_types.h> -#include <kernel-features.h> -#ifdef __NR_getgroups32 -# if __ASSUME_32BITUIDS == 0 -/* This variable is shared with all files that need to check for 32bit - uids. */ -extern int __libc_missing_32bit_uids attribute_hidden; -# endif -#endif /* __NR_getgroups32 */ +/* Consider moving to syscalls.list. */ /* For Linux we must convert the array of groups from the format that the kernel returns. */ int __getgroups (int n, gid_t *groups) { -#if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (getgroups32, 2, n, CHECK_N (groups, n)); -#else - if (__builtin_expect (n, 1) < 0) - { - __set_errno (EINVAL); - return -1; - } - else - { -# ifdef __NR_getgroups32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - int saved_errno = errno; - - result = INLINE_SYSCALL (getgroups32, 2, n, CHECK_N (groups, n)); - if (result != -1 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_getgroups32 */ - - int i, ngids; - __kernel_gid_t kernel_groups[n = MIN (n, __sysconf (_SC_NGROUPS_MAX))]; - - ngids = INLINE_SYSCALL (getgroups, 2, n, CHECK_N (kernel_groups, n)); - if (n != 0 && ngids > 0) - for (i = 0; i < ngids; i++) - (__ptrvalue (groups))[i] = kernel_groups[i]; - return ngids; - } -#endif } weak_alias (__getgroups, getgroups) diff --git a/sysdeps/unix/sysv/linux/i386/getresgid.c b/sysdeps/unix/sysv/linux/i386/getresgid.c index c01497e7e7..d9ce513b1d 100644 --- a/sysdeps/unix/sysv/linux/i386/getresgid.c +++ b/sysdeps/unix/sysv/linux/i386/getresgid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,2002,2003,2005,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 @@ -25,60 +25,13 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include <kernel-features.h> - -#ifdef __NR_getresgid - -# ifdef __NR_getresgid32 -# 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_getresgid32 */ - +/* Consider moving to syscalls.list. */ int __getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid) { -# if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (getresgid32, 3, CHECK_1 (rgid), CHECK_1 (egid), CHECK_1 (sgid)); -# else - __kernel_gid_t k_rgid, k_egid, k_sgid; - int result; -# ifdef __NR_getresgid32 - if (__libc_missing_32bit_uids <= 0) - { - int r; - int saved_errno = errno; - - r = INLINE_SYSCALL (getresgid32, 3, CHECK_1 (rgid), - CHECK_1 (egid), CHECK_1 (sgid)); - if (r == 0 || errno != ENOSYS) - return r; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_getresgid32 */ - - result = INLINE_SYSCALL (getresgid, 3, __ptrvalue (&k_rgid), - __ptrvalue (&k_egid), __ptrvalue (&k_sgid)); - - if (result == 0) - { - *rgid = (gid_t) k_rgid; - *egid = (gid_t) k_egid; - *sgid = (gid_t) k_sgid; - } - - return result; -# endif } libc_hidden_def (__getresgid) weak_alias (__getresgid, getresgid) - -#else -# include <posix/getresgid.c> -#endif diff --git a/sysdeps/unix/sysv/linux/i386/getresuid.c b/sysdeps/unix/sysv/linux/i386/getresuid.c index cbad2d3da5..f9c3180fb1 100644 --- a/sysdeps/unix/sysv/linux/i386/getresuid.c +++ b/sysdeps/unix/sysv/linux/i386/getresuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,2002,2003,2005,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 @@ -25,59 +25,13 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include <kernel-features.h> - -#ifdef __NR_getresuid - -# ifdef __NR_getresuid32 -# 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_getresuid32 */ +/* Consider moving to syscalls.list. */ int __getresuid (uid_t *ruid, uid_t *euid, uid_t *suid) { -# if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (getresuid32, 3, CHECK_1 (ruid), CHECK_1 (euid), CHECK_1 (suid)); -# else - __kernel_uid_t k_ruid, k_euid, k_suid; - int result; -# ifdef __NR_getresuid32 - if (__libc_missing_32bit_uids <= 0) - { - int r; - int saved_errno = errno; - - r = INLINE_SYSCALL (getresuid32, 3, CHECK_1 (ruid), - CHECK_1 (euid), CHECK_1 (suid)); - if (r == 0 || errno != ENOSYS) - return r; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_getresuid32 */ - - result = INLINE_SYSCALL (getresuid, 3, __ptrvalue (&k_ruid), - __ptrvalue (&k_euid), __ptrvalue (&k_suid)); - - if (result == 0) - { - *ruid = (uid_t) k_ruid; - *euid = (uid_t) k_euid; - *suid = (uid_t) k_suid; - } - - return result; -# endif } libc_hidden_def (__getresuid) weak_alias (__getresuid, getresuid) - -#else -# include <posix/getresuid.c> -#endif diff --git a/sysdeps/unix/sysv/linux/i386/getuid.c b/sysdeps/unix/sysv/linux/i386/getuid.c index 6bbc74d4c5..67d63a416b 100644 --- a/sysdeps/unix/sysv/linux/i386/getuid.c +++ b/sysdeps/unix/sysv/linux/i386/getuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2003, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-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 @@ -21,44 +21,13 @@ #include <sysdep.h> #include <sys/syscall.h> -#include <kernel-features.h> - -#ifdef __NR_getuid32 -# if __ASSUME_32BITUIDS == 0 -/* This variable is shared with all files that need to check for 32bit - uids. This is the definition. - -1 if libc does not know yet whether kernel has 32bit uids or not. - 0 if it does have them. - 1 if it does not have them. */ -int __libc_missing_32bit_uids attribute_hidden = -1; -# endif -#endif /* __NR_getuid32 */ +/* Consider moving to syscalls.list. */ uid_t __getuid (void) { INTERNAL_SYSCALL_DECL (err); -#if __ASSUME_32BITUIDS > 0 - /* No error checking. */ return INTERNAL_SYSCALL (getuid32, err, 0); -#else -# ifdef __NR_getuid32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - - result = INTERNAL_SYSCALL (getuid32, err, 0); - if (! INTERNAL_SYSCALL_ERROR_P (result, err) - || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - return result; - - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_getuid32 */ - - /* No error checking. */ - return INTERNAL_SYSCALL (getuid, err, 0); -#endif } weak_alias (__getuid, getuid) diff --git a/sysdeps/unix/sysv/linux/i386/lchown.c b/sysdeps/unix/sysv/linux/i386/lchown.c index 2184c28600..6190d02a6f 100644 --- a/sysdeps/unix/sysv/linux/i386/lchown.c +++ b/sysdeps/unix/sysv/linux/i386/lchown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,2003,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-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 @@ -23,51 +23,13 @@ #include <bp-checks.h> #include <linux/posix_types.h> -#include <kernel-features.h> -#ifdef __NR_lchown -# ifdef __NR_lchown32 -# 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_lchown32 */ +/* Consider moving to syscalls.list. */ int __lchown (const char *file, uid_t owner, gid_t group) { -# if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group); -# else -# ifdef __NR_lchown32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - int saved_errno = errno; - - result = INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group); - if (result == 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_lchown32 */ - - if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U)) - || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - return INLINE_SYSCALL (lchown, 3, CHECK_STRING (file), owner, group); -# endif } weak_alias (__lchown, lchown) - -#else -# include <io/lchown.c> -#endif diff --git a/sysdeps/unix/sysv/linux/i386/msgctl.c b/sysdeps/unix/sysv/linux/i386/msgctl.c index fa5a82fa38..2125ae192c 100644 --- a/sysdeps/unix/sysv/linux/i386/msgctl.c +++ b/sysdeps/unix/sysv/linux/i386/msgctl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1997,1998,2000,2004,2006 Free Software Foundation, Inc. +/* Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. @@ -25,7 +25,6 @@ #include <sys/syscall.h> #include <bp-checks.h> -#include <kernel-features.h> #include <shlib-compat.h> struct __old_msqid_ds @@ -52,14 +51,6 @@ int __old_msgctl (int, int, struct __old_msqid_ds *); #endif int __new_msgctl (int, int, struct msqid_ds *); -#ifdef __NR_getuid32 -# 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 - #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) int attribute_compat_text_section @@ -74,85 +65,8 @@ compat_symbol (libc, __old_msgctl, msgctl, GLIBC_2_0); int __new_msgctl (int msqid, int cmd, struct msqid_ds *buf) { -#if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, msqid, cmd | __IPC_64, 0, CHECK_1 (buf)); -#else - switch (cmd) { - case MSG_STAT: - case IPC_STAT: - case IPC_SET: - break; - default: - return INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, - msqid, cmd, 0, CHECK_1 (buf)); - } - - { - int result; - struct __old_msqid_ds old; - -#ifdef __NR_getuid32 - if (__libc_missing_32bit_uids <= 0) - { - if (__libc_missing_32bit_uids < 0) - { - int save_errno = errno; - - /* Test presence of new IPC by testing for getuid32 syscall. */ - result = INLINE_SYSCALL (getuid32, 0); - if (result == -1 && errno == ENOSYS) - __libc_missing_32bit_uids = 1; - else - __libc_missing_32bit_uids = 0; - __set_errno(save_errno); - } - if (__libc_missing_32bit_uids <= 0) - { - result = INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, - msqid, cmd | __IPC_64, 0, CHECK_1 (buf)); - return result; - } - } -#endif - if (cmd == IPC_SET) - { - old.msg_perm.uid = buf->msg_perm.uid; - old.msg_perm.gid = buf->msg_perm.gid; - old.msg_perm.mode = buf->msg_perm.mode; - old.msg_qbytes = buf->msg_qbytes; - if (old.msg_perm.uid != buf->msg_perm.uid || - old.msg_perm.gid != buf->msg_perm.gid || - old.msg_qbytes != buf->msg_qbytes) - { - __set_errno (EINVAL); - return -1; - } - } - result = INLINE_SYSCALL (ipc, 5, IPCOP_msgctl, - msqid, cmd, 0, __ptrvalue (&old)); - if (result != -1 && cmd != IPC_SET) - { - memset(buf, 0, sizeof(*buf)); - buf->msg_perm.__key = old.msg_perm.__key; - buf->msg_perm.uid = old.msg_perm.uid; - buf->msg_perm.gid = old.msg_perm.gid; - buf->msg_perm.cuid = old.msg_perm.cuid; - buf->msg_perm.cgid = old.msg_perm.cgid; - buf->msg_perm.mode = old.msg_perm.mode; - buf->msg_perm.__seq = old.msg_perm.__seq; - buf->msg_stime = old.msg_stime; - buf->msg_rtime = old.msg_rtime; - buf->msg_ctime = old.msg_ctime; - buf->__msg_cbytes = old.__msg_cbytes; - buf->msg_qnum = old.msg_qnum; - buf->msg_qbytes = old.msg_qbytes; - buf->msg_lspid = old.msg_lspid; - buf->msg_lrpid = old.msg_lrpid; - } - return result; - } -#endif } versioned_symbol (libc, __new_msgctl, msgctl, GLIBC_2_2); diff --git a/sysdeps/unix/sysv/linux/i386/semctl.c b/sysdeps/unix/sysv/linux/i386/semctl.c index 0c4ad89f89..5e2d948059 100644 --- a/sysdeps/unix/sysv/linux/i386/semctl.c +++ b/sysdeps/unix/sysv/linux/i386/semctl.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1995,1997,1998,2000,2003,2004,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. @@ -26,7 +25,6 @@ #include <string.h> #include <sys/syscall.h> -#include <kernel-features.h> #include <shlib-compat.h> struct __old_semid_ds @@ -54,14 +52,6 @@ union semun #include <bp-checks.h> #include <bp-semctl.h> /* definition of CHECK_SEMCTL needs union semum */ -#ifdef __NR_getuid32 -# 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 - /* Return identifier for array of NSEMS semaphores associated with KEY. */ #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) @@ -103,82 +93,8 @@ __new_semctl (int semid, int semnum, int cmd, ...) va_end (ap); -#if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64, CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)); -#else - switch (cmd) { - case SEM_STAT: - case IPC_STAT: - case IPC_SET: - break; - default: - return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, - CHECK_SEMCTL (&arg, semid, cmd)); - } - - { - int result; - struct __old_semid_ds old; - struct semid_ds *buf; - -#ifdef __NR_getuid32 - if (__libc_missing_32bit_uids <= 0) - { - if (__libc_missing_32bit_uids < 0) - { - int save_errno = errno; - - /* Test presence of new IPC by testing for getuid32 syscall. */ - result = INLINE_SYSCALL (getuid32, 0); - if (result == -1 && errno == ENOSYS) - __libc_missing_32bit_uids = 1; - else - __libc_missing_32bit_uids = 0; - __set_errno(save_errno); - } - if (__libc_missing_32bit_uids <= 0) - { - result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64, - CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)); - return result; - } - } -#endif - - buf = arg.buf; - arg.__old_buf = &old; - if (cmd == IPC_SET) - { - old.sem_perm.uid = buf->sem_perm.uid; - old.sem_perm.gid = buf->sem_perm.gid; - old.sem_perm.mode = buf->sem_perm.mode; - if (old.sem_perm.uid != buf->sem_perm.uid || - old.sem_perm.gid != buf->sem_perm.gid) - { - __set_errno (EINVAL); - return -1; - } - } - result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, - CHECK_SEMCTL (&arg, semid, cmd)); - if (result != -1 && cmd != IPC_SET) - { - memset(buf, 0, sizeof(*buf)); - buf->sem_perm.__key = old.sem_perm.__key; - buf->sem_perm.uid = old.sem_perm.uid; - buf->sem_perm.gid = old.sem_perm.gid; - buf->sem_perm.cuid = old.sem_perm.cuid; - buf->sem_perm.cgid = old.sem_perm.cgid; - buf->sem_perm.mode = old.sem_perm.mode; - buf->sem_perm.__seq = old.sem_perm.__seq; - buf->sem_otime = old.sem_otime; - buf->sem_ctime = old.sem_ctime; - buf->sem_nsems = old.sem_nsems; - } - return result; - } -#endif } versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2); diff --git a/sysdeps/unix/sysv/linux/i386/setegid.c b/sysdeps/unix/sysv/linux/i386/setegid.c index e0b82ccf94..20170e327e 100644 --- a/sysdeps/unix/sysv/linux/i386/setegid.c +++ b/sysdeps/unix/sysv/linux/i386/setegid.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1995-1998,2000,2002,2003,2004,2006 - Free Software Foundation, Inc. +/* Copyright (C) 1995-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,13 +18,8 @@ #include <errno.h> #include <unistd.h> #include <setxid.h> -#include <kernel-features.h> -#ifdef __NR_setresgid -extern int __setresgid (uid_t rgid, uid_t egid, uid_t sgid); -#endif - int setegid (gid) gid_t gid; @@ -38,23 +32,7 @@ setegid (gid) return -1; } -#if __ASSUME_32BITUIDS > 0 result = INLINE_SETXID_SYSCALL (setresgid32, 3, -1, gid, -1); -#else - /* First try the syscall. */ -# ifdef __NR_setresgid - result = __setresgid (-1, gid, -1); -# if __ASSUME_SETRESGID_SYSCALL > 0 - if (0) -# else - if (result == -1 && errno == ENOSYS) -# endif - /* No system call available. Use emulation. This may not work - since `setregid' also sets the saved user ID when GID is not - equal to the real user ID, making it impossible to switch back. */ -# endif - result = __setregid (-1, gid); -#endif return result; } diff --git a/sysdeps/unix/sysv/linux/i386/seteuid.c b/sysdeps/unix/sysv/linux/i386/seteuid.c index af3231d84b..d41e51b294 100644 --- a/sysdeps/unix/sysv/linux/i386/seteuid.c +++ b/sysdeps/unix/sysv/linux/i386/seteuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,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 @@ -18,13 +18,8 @@ #include <errno.h> #include <unistd.h> #include <setxid.h> -#include <kernel-features.h> -#ifdef __NR_setresuid -extern int __setresuid (uid_t ruid, uid_t euid, uid_t suid); -#endif - int seteuid (uid_t uid) { @@ -36,23 +31,7 @@ seteuid (uid_t uid) return -1; } -#if __ASSUME_32BITUIDS > 0 result = INLINE_SETXID_SYSCALL (setresuid32, 3, -1, uid, -1); -#else - /* First try the syscall. */ -# ifdef __NR_setresuid - result = __setresuid (-1, uid, -1); -# if __ASSUME_SETRESUID_SYSCALL > 0 - if (0) -# else - if (result == -1 && errno == ENOSYS) -# endif - /* No system call available. Use emulation. This may not work - since `setreuid' also sets the saved user ID when UID is not - equal to the real user ID, making it impossible to switch back. */ -# endif - result = __setreuid (-1, uid); -#endif return result; } diff --git a/sysdeps/unix/sysv/linux/i386/setfsgid.c b/sysdeps/unix/sysv/linux/i386/setfsgid.c index 12c66c5b6e..fe5fd86596 100644 --- a/sysdeps/unix/sysv/linux/i386/setfsgid.c +++ b/sysdeps/unix/sysv/linux/i386/setfsgid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2003, 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 @@ -22,48 +22,12 @@ #include <sysdep.h> #include <sys/syscall.h> #include <linux/posix_types.h> -#include <kernel-features.h> - -#ifdef __NR_setfsgid - -# ifdef __NR_setfsgid32 -# if __ASSUME_32BITUIDS == 0 -/* This variable is shared with all files that need to check for 32bit - uids. */ -extern int __libc_missing_32bit_uids attribute_hidden; -# endif -# endif /* __NR_setfsgid32 */ +/* Consider moving to syscalls.list. */ int setfsgid (gid_t gid) { INTERNAL_SYSCALL_DECL (err); -# if __ASSUME_32BITUIDS > 0 - /* No error checking. */ return INTERNAL_SYSCALL (setfsgid32, err, 1, gid); -# else -# ifdef __NR_setfsgid32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - - result = INTERNAL_SYSCALL (setfsgid32, err, 1, gid); - if (! INTERNAL_SYSCALL_ERROR_P (result, err) - || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - return result; - - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_setfsgid32 */ - if (gid != (gid_t) ((__kernel_gid_t) gid)) - { - __set_errno (EINVAL); - return -1; - } - - /* No error checking. */ - return INTERNAL_SYSCALL (setfsgid, err, 1, gid); -# endif } -#endif diff --git a/sysdeps/unix/sysv/linux/i386/setfsuid.c b/sysdeps/unix/sysv/linux/i386/setfsuid.c index 5194ce1edc..3e0dc97289 100644 --- a/sysdeps/unix/sysv/linux/i386/setfsuid.c +++ b/sysdeps/unix/sysv/linux/i386/setfsuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 2003, 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 @@ -23,48 +23,12 @@ #include <sys/syscall.h> #include <linux/posix_types.h> -#include <kernel-features.h> -#ifdef __NR_setfsuid - -# ifdef __NR_setfsuid32 -# if __ASSUME_32BITUIDS == 0 -/* This variable is shared with all files that need to check for 32bit - uids. */ -extern int __libc_missing_32bit_uids attribute_hidden; -# endif -# endif /* __NR_setfsuid32 */ +/* Consider moving to syscalls.list. */ int setfsuid (uid_t uid) { INTERNAL_SYSCALL_DECL (err); -# if __ASSUME_32BITUIDS > 0 - /* No error checking. */ return INTERNAL_SYSCALL (setfsuid32, err, 1, uid); -# else -# ifdef __NR_setfsuid32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - - result = INTERNAL_SYSCALL (setfsuid32, err, 1, uid); - if (! INTERNAL_SYSCALL_ERROR_P (result, err) - || INTERNAL_SYSCALL_ERRNO (result, err) != ENOSYS) - return result; - - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_setfsuid32 */ - - if (uid != (uid_t) ((__kernel_uid_t) uid)) - { - __set_errno (EINVAL); - return -1; - } - - /* No error checking. */ - return INTERNAL_SYSCALL (setfsuid, err, 1, uid); -# endif } -#endif diff --git a/sysdeps/unix/sysv/linux/i386/setgid.c b/sysdeps/unix/sysv/linux/i386/setgid.c index dacc41dab2..b067368209 100644 --- a/sysdeps/unix/sysv/linux/i386/setgid.c +++ b/sysdeps/unix/sysv/linux/i386/setgid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998, 2000, 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 @@ -19,54 +19,13 @@ #include <unistd.h> #include <setxid.h> #include <linux/posix_types.h> -#include <kernel-features.h> - - -#ifdef __NR_setgid32 -# 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_setgid32 */ int __setgid (gid_t gid) { int result; -#if __ASSUME_32BITUIDS > 0 result = INLINE_SETXID_SYSCALL (setgid32, 1, gid); -#else -# ifdef __NR_setgid32 - if (__libc_missing_32bit_uids <= 0) - { - int saved_errno = errno; - - result = INLINE_SETXID_SYSCALL (setgid32, 1, gid); - - if (result == 0) - goto out; - if (errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_setgid32 */ - - if (gid == (gid_t) ~0 - || gid != (gid_t) ((__kernel_gid_t) gid)) - { - __set_errno (EINVAL); - return -1; - } - - result = INLINE_SETXID_SYSCALL (setgid, 1, gid); -# ifdef __NR_setgid32 - out: -# endif -#endif return result; } diff --git a/sysdeps/unix/sysv/linux/i386/setgroups.c b/sysdeps/unix/sysv/linux/i386/setgroups.c index dd74cd2864..73b341ac53 100644 --- a/sysdeps/unix/sysv/linux/i386/setgroups.c +++ b/sysdeps/unix/sysv/linux/i386/setgroups.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1997,1998,2000,2002,2004,2006,2011 - 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,16 +26,6 @@ #include <setxid.h> #include <linux/posix_types.h> -#include <kernel-features.h> - - -#ifdef __NR_setgroups32 -# 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_setgroups32 */ /* Set the group set for the current user to GROUPS (N of them). For Linux we must convert the array of groups into the format that the @@ -44,47 +33,6 @@ extern int __libc_missing_32bit_uids; int setgroups (size_t n, const gid_t *groups) { -#if __ASSUME_32BITUIDS > 0 return INLINE_SETXID_SYSCALL (setgroups32, 2, n, CHECK_N (groups, n)); -#else - if (n > (size_t) __sysconf (_SC_NGROUPS_MAX)) - { - __set_errno (EINVAL); - return -1; - } - else - { - size_t i; - __kernel_gid_t kernel_groups[n]; - -# ifdef __NR_setgroups32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - int saved_errno = errno; - - result = INLINE_SETXID_SYSCALL (setgroups32, 2, n, - CHECK_N (groups, n)); - if (result == 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_setgroups32 */ - for (i = 0; i < n; i++) - { - kernel_groups[i] = (__ptrvalue (groups))[i]; - if (groups[i] != (gid_t) ((__kernel_gid_t) groups[i])) - { - __set_errno (EINVAL); - return -1; - } - } - - return INLINE_SETXID_SYSCALL (setgroups, 2, n, - CHECK_N (kernel_groups, n)); - } -#endif } libc_hidden_def (setgroups) diff --git a/sysdeps/unix/sysv/linux/i386/setregid.c b/sysdeps/unix/sysv/linux/i386/setregid.c index b48baf7b46..d2a1d55d50 100644 --- a/sysdeps/unix/sysv/linux/i386/setregid.c +++ b/sysdeps/unix/sysv/linux/i386/setregid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,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 @@ -19,53 +19,13 @@ #include <unistd.h> #include <setxid.h> #include <linux/posix_types.h> -#include <kernel-features.h> - - -#ifdef __NR_setregid32 -# 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_setregid32 */ int __setregid (gid_t rgid, gid_t egid) { int result; -#if __ASSUME_32BITUIDS > 0 result = INLINE_SETXID_SYSCALL (setregid32, 2, rgid, egid); -#else -# ifdef __NR_setregid32 - if (__libc_missing_32bit_uids <= 0) - { - int saved_errno = errno; - - result = INLINE_SETXID_SYSCALL (setregid32, 2, rgid, egid); - - if (result == 0) - goto out; - if (errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_setregid32 */ - if (((rgid + 1) > (gid_t) ((__kernel_gid_t) -1U)) - || ((egid + 1) > (gid_t) ((__kernel_gid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - result = INLINE_SETXID_SYSCALL (setregid, 2, rgid, egid); -# ifdef __NR_setregid32 - out: -# endif -#endif return result; } diff --git a/sysdeps/unix/sysv/linux/i386/setresgid.c b/sysdeps/unix/sysv/linux/i386/setresgid.c index 24a0dd8eb7..569745bef2 100644 --- a/sysdeps/unix/sysv/linux/i386/setresgid.c +++ b/sysdeps/unix/sysv/linux/i386/setresgid.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1998,2000,2002,2003,2004,2005,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 @@ -20,56 +19,14 @@ #include <unistd.h> #include <setxid.h> #include <linux/posix_types.h> -#include <kernel-features.h> -#if defined __NR_setresgid || defined __NR_setresgid32 - -# ifdef __NR_setresgid32 -# 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_setresgid32 */ - int __setresgid (gid_t rgid, gid_t egid, gid_t sgid) { int result; -# if __ASSUME_32BITUIDS > 0 || !defined __NR_setresgid result = INLINE_SETXID_SYSCALL (setresgid32, 3, rgid, egid, sgid); -# else -# ifdef __NR_setresgid32 - if (__libc_missing_32bit_uids <= 0) - { - int saved_errno = errno; - - result = INLINE_SETXID_SYSCALL (setresgid32, 3, rgid, egid, sgid); - if (result == 0) - goto out; - if (errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_setresgid32 */ - - if (((rgid + 1) > (gid_t) ((__kernel_gid_t) -1U)) - || ((egid + 1) > (gid_t) ((__kernel_gid_t) -1U)) - || ((sgid + 1) > (gid_t) ((__kernel_gid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - result = INLINE_SETXID_SYSCALL (setresgid, 3, rgid, egid, sgid); -# ifdef __NR_setresgid32 - out: -# endif -# endif return result; } @@ -77,9 +34,3 @@ libc_hidden_def (__setresgid) #ifndef __setresgid weak_alias (__setresgid, setresgid) #endif - -#else - -#include <posix/setresgid.c> - -#endif diff --git a/sysdeps/unix/sysv/linux/i386/setresuid.c b/sysdeps/unix/sysv/linux/i386/setresuid.c index 1015dd74d9..33e464b7f4 100644 --- a/sysdeps/unix/sysv/linux/i386/setresuid.c +++ b/sysdeps/unix/sysv/linux/i386/setresuid.c @@ -1,5 +1,4 @@ -/* Copyright (C) 1998,2000,2002,2003,2004,2005,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 @@ -20,56 +19,14 @@ #include <unistd.h> #include <setxid.h> #include <linux/posix_types.h> -#include <kernel-features.h> -#if defined __NR_setresuid || defined __NR_setresuid32 - -# ifdef __NR_setresuid32 -# 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_setresuid32 */ - int __setresuid (uid_t ruid, uid_t euid, uid_t suid) { int result; -# if __ASSUME_32BITUIDS > 0 || !defined __NR_setresuid result = INLINE_SETXID_SYSCALL (setresuid32, 3, ruid, euid, suid); -# else -# ifdef __NR_setresuid32 - if (__libc_missing_32bit_uids <= 0) - { - int saved_errno = errno; - - result = INLINE_SETXID_SYSCALL (setresuid32, 3, ruid, euid, suid); - if (result == 0) - goto out; - if (errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_setresuid32 */ - - if (((ruid + 1) > (uid_t) ((__kernel_uid_t) -1U)) - || ((euid + 1) > (uid_t) ((__kernel_uid_t) -1U)) - || ((suid + 1) > (uid_t) ((__kernel_uid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - result = INLINE_SETXID_SYSCALL (setresuid, 3, ruid, euid, suid); -# ifdef __NR_setresuid32 - out: -# endif -# endif return result; } @@ -77,9 +34,3 @@ libc_hidden_def (__setresuid) #ifndef __setresuid weak_alias (__setresuid, setresuid) #endif - -#else - -#include <posix/setresuid.c> - -#endif diff --git a/sysdeps/unix/sysv/linux/i386/setreuid.c b/sysdeps/unix/sysv/linux/i386/setreuid.c index 7c8b4af9dc..e17455f8c8 100644 --- a/sysdeps/unix/sysv/linux/i386/setreuid.c +++ b/sysdeps/unix/sysv/linux/i386/setreuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,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 @@ -19,53 +19,14 @@ #include <unistd.h> #include <setxid.h> #include <linux/posix_types.h> -#include <kernel-features.h> -#ifdef __NR_setreuid32 -# 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_setreuid32 */ - int __setreuid (uid_t ruid, uid_t euid) { int result; -#if __ASSUME_32BITUIDS > 0 result = INLINE_SETXID_SYSCALL (setreuid32, 2, ruid, euid); -#else -# ifdef __NR_setreuid32 - if (__libc_missing_32bit_uids <= 0) - { - int saved_errno = errno; - - result = INLINE_SETXID_SYSCALL (setreuid32, 2, ruid, euid); - - if (result == 0) - goto out; - if (errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_setreuid32 */ - if (((ruid + 1) > (uid_t) ((__kernel_uid_t) -1U)) - || ((euid + 1) > (uid_t) ((__kernel_uid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - result = INLINE_SETXID_SYSCALL (setreuid, 2, ruid, euid); -# ifdef __NR_setreuid32 - out: -# endif -#endif return result; } diff --git a/sysdeps/unix/sysv/linux/i386/setuid.c b/sysdeps/unix/sysv/linux/i386/setuid.c index 54ed9ba34a..cab40671e7 100644 --- a/sysdeps/unix/sysv/linux/i386/setuid.c +++ b/sysdeps/unix/sysv/linux/i386/setuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,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 @@ -19,53 +19,14 @@ #include <unistd.h> #include <setxid.h> #include <linux/posix_types.h> -#include <kernel-features.h> -#ifdef __NR_setuid32 -# 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_setuid32 */ - int __setuid (uid_t uid) { int result; -#if __ASSUME_32BITUIDS > 0 && defined __NR_setuid32 result = INLINE_SETXID_SYSCALL (setuid32, 1, uid); -#else -# ifdef __NR_setuid32 - if (__libc_missing_32bit_uids <= 0) - { - int saved_errno = errno; - - result = INLINE_SETXID_SYSCALL (setuid32, 1, uid); - if (result == 0) - goto out; - if (errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_setuid32 */ - - if (uid == (uid_t) ~0 - || uid != (uid_t) ((__kernel_uid_t) uid)) - { - __set_errno (EINVAL); - return -1; - } - - result = INLINE_SETXID_SYSCALL (setuid, 1, uid); -# ifdef __NR_setuid32 - out: -# endif -#endif return result; } diff --git a/sysdeps/unix/sysv/linux/i386/shmctl.c b/sysdeps/unix/sysv/linux/i386/shmctl.c index fb38ed79cd..dd2167d9a7 100644 --- a/sysdeps/unix/sysv/linux/i386/shmctl.c +++ b/sysdeps/unix/sysv/linux/i386/shmctl.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995,1997,1998,2000,2004,2006 Free Software Foundation, Inc. +/* Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. @@ -26,7 +26,6 @@ #include <bits/wordsize.h> #include <bp-checks.h> -#include <kernel-features.h> #include <shlib-compat.h> struct __old_shmid_ds @@ -53,14 +52,6 @@ struct __old_shminfo int shmall; }; -#ifdef __NR_getuid32 -# 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 - /* Provide operations to control over shared memory segments. */ #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) int __old_shmctl (int, int, struct __old_shmid_ds *); @@ -81,97 +72,8 @@ compat_symbol (libc, __old_shmctl, shmctl, GLIBC_2_0); int __new_shmctl (int shmid, int cmd, struct shmid_ds *buf) { -#if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, shmid, cmd | __IPC_64, 0, CHECK_1 (buf)); -#else - switch (cmd) { - case SHM_STAT: - case IPC_STAT: - case IPC_SET: -# if __WORDSIZE != 32 - case IPC_INFO: -# endif - break; - default: - return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, - shmid, cmd, 0, CHECK_1 (buf)); - } - - { - struct __old_shmid_ds old; - int result; - -# ifdef __NR_getuid32 - if (__libc_missing_32bit_uids <= 0) - { - if (__libc_missing_32bit_uids < 0) - { - int save_errno = errno; - - /* Test presence of new IPC by testing for getuid32 syscall. */ - result = INLINE_SYSCALL (getuid32, 0); - if (result == -1 && errno == ENOSYS) - __libc_missing_32bit_uids = 1; - else - __libc_missing_32bit_uids = 0; - __set_errno(save_errno); - } - if (__libc_missing_32bit_uids <= 0) - return INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, - shmid, cmd | __IPC_64, 0, CHECK_1 (buf)); - } -# endif - - if (cmd == IPC_SET) - { - old.shm_perm.uid = buf->shm_perm.uid; - old.shm_perm.gid = buf->shm_perm.gid; - old.shm_perm.mode = buf->shm_perm.mode; - if (old.shm_perm.uid != buf->shm_perm.uid || - old.shm_perm.gid != buf->shm_perm.gid) - { - __set_errno (EINVAL); - return -1; - } - } - result = INLINE_SYSCALL (ipc, 5, IPCOP_shmctl, - shmid, cmd, 0, __ptrvalue (&old)); - if (result != -1 && (cmd == SHM_STAT || cmd == IPC_STAT)) - { - memset(buf, 0, sizeof(*buf)); - buf->shm_perm.__key = old.shm_perm.__key; - buf->shm_perm.uid = old.shm_perm.uid; - buf->shm_perm.gid = old.shm_perm.gid; - buf->shm_perm.cuid = old.shm_perm.cuid; - buf->shm_perm.cgid = old.shm_perm.cgid; - buf->shm_perm.mode = old.shm_perm.mode; - buf->shm_perm.__seq = old.shm_perm.__seq; - buf->shm_atime = old.shm_atime; - buf->shm_dtime = old.shm_dtime; - buf->shm_ctime = old.shm_ctime; - buf->shm_segsz = old.shm_segsz; - buf->shm_nattch = old.shm_nattch; - buf->shm_cpid = old.shm_cpid; - buf->shm_lpid = old.shm_lpid; - } -# if __WORDSIZE != 32 - else if (result != -1 && cmd == IPC_INFO) - { - struct __old_shminfo *oldi = (struct __old_shminfo *)&old; - struct shminfo *i = (struct shminfo *)buf; - - memset(i, 0, sizeof(*i)); - i->shmmax = oldi->shmmax; - i->shmmin = oldi->shmmin; - i->shmmni = oldi->shmmni; - i->shmseg = oldi->shmseg; - i->shmall = oldi->shmall; - } -# endif - return result; - } -#endif } versioned_symbol (libc, __new_shmctl, shmctl, GLIBC_2_2); diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h index 1090f8a809..fd2f1dbd01 100644 --- a/sysdeps/unix/sysv/linux/kernel-features.h +++ b/sysdeps/unix/sysv/linux/kernel-features.h @@ -37,91 +37,58 @@ introduced. If somebody cares these values can afterwards be corrected. */ -/* When did the `setresuid' syscall became available? By 2.2.0 except - on SPARC. */ -#if !defined __sparc__ -# define __ASSUME_SETRESUID_SYSCALL 1 -#endif - /* The sendfile syscall was introduced in 2.2.0. */ #define __ASSUME_SENDFILE 1 /* On x86 another `getrlimit' syscall was added in 2.3.25. */ -#if __LINUX_KERNEL_VERSION >= 131865 && defined __i386__ +#ifdef __i386__ # define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 #endif /* On x86 the truncate64/ftruncate64 syscalls were introduced in 2.3.31. */ -#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ +#ifdef __i386__ # define __ASSUME_TRUNCATE64_SYSCALL 1 #endif /* On x86 the mmap2 syscall was introduced in 2.3.31. */ -#if __LINUX_KERNEL_VERSION >= 131871 && defined __i386__ +#ifdef __i386__ # define __ASSUME_MMAP2_SYSCALL 1 #endif /* On x86 the stat64/lstat64/fstat64 syscalls were introduced in 2.3.34. */ -#if __LINUX_KERNEL_VERSION >= 131874 && defined __i386__ +#ifdef __i386__ # define __ASSUME_STAT64_SYSCALL 1 #endif /* On sparc the truncate64/ftruncate64/mmap2/stat64/lstat64/fstat64 syscalls were introduced in 2.3.35. */ -#if __LINUX_KERNEL_VERSION >= 131875 \ - && (defined __sparc__ && !defined __arch64__) +#if defined __sparc__ && !defined __arch64__ # define __ASSUME_TRUNCATE64_SYSCALL 1 # define __ASSUME_MMAP2_SYSCALL 1 # define __ASSUME_STAT64_SYSCALL 1 #endif /* I know for sure that getrlimit are in 2.3.35 on powerpc. */ -#if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ +#ifdef __powerpc__ # define __ASSUME_NEW_GETRLIMIT_SYSCALL 1 #endif /* I know for sure that these are in 2.3.35 on powerpc. But PowerPC64 does not support separate 64-bit syscalls, already 64-bit. */ -#if __LINUX_KERNEL_VERSION >= 131875 && defined __powerpc__ \ - && !defined __powerpc64__ +#if defined __powerpc__ && !defined __powerpc64__ # define __ASSUME_TRUNCATE64_SYSCALL 1 # define __ASSUME_STAT64_SYSCALL 1 #endif -/* Linux 2.3.39 introduced 32bit UID/GIDs. Some platforms had 32 - bit type all along. */ -#if __LINUX_KERNEL_VERSION >= 131879 || defined __powerpc__ -# define __ASSUME_32BITUIDS 1 -#endif - -/* Linux 2.3.39 sparc added setresuid. */ -#if __LINUX_KERNEL_VERSION >= 131879 && defined __sparc__ -# define __ASSUME_SETRESUID_SYSCALL 1 -#endif - -#if __LINUX_KERNEL_VERSION >= 131879 -# define __ASSUME_SETRESGID_SYSCALL 1 -#endif - -/* Linux 2.3.39 introduced IPC64. Except for powerpc. */ -#if __LINUX_KERNEL_VERSION >= 131879 && !defined __powerpc__ +/* Linux 2.3.39 introduced IPC64. Except for powerpc. Linux 2.4.0 on + PPC introduced a correct IPC64. But PowerPC64 does not support a + separate 64-bit syscall, already 64-bit. */ +#ifndef __powerpc64__ # define __ASSUME_IPC64 1 #endif -/* We can use the LDTs for threading with Linux 2.3.99 and newer. */ -#if __LINUX_KERNEL_VERSION >= 131939 -# define __ASSUME_LDT_WORKS 1 -#endif - -/* Linux 2.4.0 on PPC introduced a correct IPC64. But PowerPC64 does not - support a separate 64-bit syscall, already 64-bit. */ -#if __LINUX_KERNEL_VERSION >= 132096 && defined __powerpc__ \ - && !defined __powerpc64__ -# define __ASSUME_IPC64 1 -#endif - /* SH kernels got stat64, mmap2, and truncate64 during 2.4.0-test. */ -#if __LINUX_KERNEL_VERSION >= 132096 && defined __sh__ +#ifdef __sh__ # define __ASSUME_TRUNCATE64_SYSCALL 1 # define __ASSUME_MMAP2_SYSCALL 1 # define __ASSUME_STAT64_SYSCALL 1 @@ -163,12 +130,6 @@ # define __ASSUME_GETDENTS64_SYSCALL 1 #endif -/* When did O_DIRECTORY become available? Early in 2.3 but when? - Be safe, use 2.3.99. */ -#if __LINUX_KERNEL_VERSION >= 131939 -# define __ASSUME_O_DIRECTORY 1 -#endif - /* Starting with one of the 2.4.0 pre-releases the Linux kernel passes up the page size information. */ #if __LINUX_KERNEL_VERSION >= 132097 diff --git a/sysdeps/unix/sysv/linux/local-setxid.h b/sysdeps/unix/sysv/linux/local-setxid.h index 0579687982..97d787d942 100644 --- a/sysdeps/unix/sysv/linux/local-setxid.h +++ b/sysdeps/unix/sysv/linux/local-setxid.h @@ -1,23 +1,16 @@ /* SETxID functions which only have to change the local thread and none of the possible other threads. */ -#include <kernel-features.h> #include <sysdep.h> -/* If we can use the syscall directly, use it. */ -#if __ASSUME_32BITUIDS > 0 && defined __NR_setresuid32 +#ifdef __NR_setresuid32 # define local_seteuid(id) INLINE_SYSCALL (setresuid32, 3, -1, id, -1) -#elif __ASSUME_SETRESUID_SYSCALL > 0 -# define local_seteuid(id) INLINE_SYSCALL (setresuid, 3, -1, id, -1) #else -# define local_seteuid(id) seteuid (id) +# define local_seteuid(id) INLINE_SYSCALL (setresuid, 3, -1, id, -1) #endif -/* If we can use the syscall directly, use it. */ -#if __ASSUME_32BITUIDS > 0 && defined __NR_setresgid32 +#ifdef __NR_setresgid32 # define local_setegid(id) INLINE_SYSCALL (setresgid32, 3, -1, id, -1) -#elif __ASSUME_SETRESGID_SYSCALL > 0 -# define local_setegid(id) INLINE_SYSCALL (setresgid, 3, -1, id, -1) #else -# define local_setegid(id) setegid (id) +# define local_setegid(id) INLINE_SYSCALL (setresgid, 3, -1, id, -1) #endif diff --git a/sysdeps/unix/sysv/linux/opendir.c b/sysdeps/unix/sysv/linux/opendir.c index 2c6c557a09..b0bb80d397 100644 --- a/sysdeps/unix/sysv/linux/opendir.c +++ b/sysdeps/unix/sysv/linux/opendir.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-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 @@ -15,11 +15,6 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <kernel-features.h> - - -#ifdef __ASSUME_O_DIRECTORY -# define O_DIRECTORY_WORKS 1 -#endif +#define O_DIRECTORY_WORKS 1 #include <sysdeps/unix/opendir.c> diff --git a/sysdeps/unix/sysv/linux/opensock.c b/sysdeps/unix/sysv/linux/opensock.c index 5959380621..d4674229ea 100644 --- a/sysdeps/unix/sysv/linux/opensock.c +++ b/sysdeps/unix/sysv/linux/opensock.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1999, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1999-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 @@ -36,15 +36,8 @@ __opensock (void) const char procname[15]; } afs[] = { - /* The 2.2 kernels cannot handle ioctl(SIOCGIFCONF) on AF_UNIX sockets. - Give the kernel a chance to user inet sockets on old kernels. */ -#if __LINUX_KERNEL_VERSION < 132096 - { AF_INET, "" }, - { AF_UNIX, "net/unix" }, -#else { AF_UNIX, "net/unix" }, { AF_INET, "" }, -#endif { AF_INET6, "net/if_inet6" }, { AF_AX25, "net/ax25" }, { AF_NETROM, "net/nr" }, diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c index bc471454e4..cc0503cbca 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/chown.c +++ b/sysdeps/unix/sysv/linux/s390/s390-32/chown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000,2001,2002,2003,2004,2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-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 @@ -24,7 +24,6 @@ #include <bp-checks.h> #include <linux/posix_types.h> -#include <kernel-features.h> /* In Linux 2.1.x the chown functions have been changed. A new function lchown @@ -38,58 +37,12 @@ /* Running under Linux > 2.1.80. */ -#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 */ +/* Consider moving to syscalls.list. */ int __real_chown (const char *file, uid_t owner, gid_t group) { -#if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group); -#else - 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); -#endif } diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c index 754245a8fd..6190d02a6f 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c +++ b/sysdeps/unix/sysv/linux/s390/s390-32/lchown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000, 2001, 2003, 2006 Free Software Foundation, Inc. +/* Copyright (C) 2000-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 @@ -23,46 +23,13 @@ #include <bp-checks.h> #include <linux/posix_types.h> -#include <kernel-features.h> -# ifdef __NR_lchown32 -# 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_lchown32 */ +/* Consider moving to syscalls.list. */ int __lchown (const char *file, uid_t owner, gid_t group) { -# if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group); -# else -# ifdef __NR_lchown32 - if (__libc_missing_32bit_uids <= 0) - { - int result; - int saved_errno = errno; - - result = INLINE_SYSCALL (lchown32, 3, CHECK_STRING (file), owner, group); - if (result == 0 || errno != ENOSYS) - return result; - - __set_errno (saved_errno); - __libc_missing_32bit_uids = 1; - } -# endif /* __NR_lchown32 */ - - if (((owner + 1) > (uid_t) ((__kernel_uid_t) -1U)) - || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - return INLINE_SYSCALL (lchown, 3, CHECK_STRING (file), owner, group); -# endif } weak_alias (__lchown, lchown) diff --git a/sysdeps/unix/sysv/linux/setegid.c b/sysdeps/unix/sysv/linux/setegid.c index bc26c99ef7..5ed44ed70f 100644 --- a/sysdeps/unix/sysv/linux/setegid.c +++ b/sysdeps/unix/sysv/linux/setegid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,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 @@ -18,13 +18,8 @@ #include <errno.h> #include <unistd.h> #include <setxid.h> -#include <kernel-features.h> -#if defined __NR_setresgid || __ASSUME_SETRESGID_SYSCALL > 0 - -extern int __setresgid (gid_t rgid, gid_t egid, gid_t sgid); - int setegid (gid_t gid) { @@ -36,25 +31,14 @@ setegid (gid_t gid) return -1; } -# if __ASSUME_32BITUIDS > 0 && defined __NR_setresgid32 +#ifdef __NR_setresgid32 result = INLINE_SETXID_SYSCALL (setresgid32, 3, -1, gid, -1); -# else - /* First try the syscall. */ +#else result = INLINE_SETXID_SYSCALL (setresgid, 3, -1, gid, -1); -# if __ASSUME_SETRESGID_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use emulation. This may not work - since `setregid' also sets the saved group ID when GID is not - equal to the real group ID, making it impossible to switch back. */ - result = __setregid (-1, gid); -# endif -# endif +#endif return result; } #ifndef setegid libc_hidden_def (setegid) #endif -#else -# include <sysdeps/unix/bsd/setegid.c> -#endif diff --git a/sysdeps/unix/sysv/linux/seteuid.c b/sysdeps/unix/sysv/linux/seteuid.c index 21625b406f..e9bd82d86e 100644 --- a/sysdeps/unix/sysv/linux/seteuid.c +++ b/sysdeps/unix/sysv/linux/seteuid.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,1999,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 @@ -18,13 +18,8 @@ #include <errno.h> #include <unistd.h> #include <setxid.h> -#include <kernel-features.h> -#if defined __NR_setresuid || __ASSUME_SETRESUID_SYSCALL > 0 - -extern int __setresuid (uid_t ruid, uid_t euid, uid_t suid); - int seteuid (uid_t uid) { @@ -36,25 +31,14 @@ seteuid (uid_t uid) return -1; } -# if __ASSUME_32BITUIDS > 0 && defined __NR_setresuid32 +#ifdef __NR_setresuid32 result = INLINE_SETXID_SYSCALL (setresuid32, 3, -1, uid, -1); -# else - /* First try the syscall. */ +#else result = INLINE_SETXID_SYSCALL (setresuid, 3, -1, uid, -1); -# if __ASSUME_SETRESUID_SYSCALL == 0 - if (result == -1 && errno == ENOSYS) - /* No system call available. Use emulation. This may not work - since `setreuid' also sets the saved user ID when UID is not - equal to the real user ID, making it impossible to switch back. */ - result = __setreuid (-1, uid); -# endif -# endif +#endif return result; } #ifndef seteuid libc_hidden_def (seteuid) #endif -#else -# include <sysdeps/unix/bsd/seteuid.c> -#endif diff --git a/sysdeps/unix/sysv/linux/sh/chown.c b/sysdeps/unix/sysv/linux/sh/chown.c index 72582b9a43..5ae94b6b25 100644 --- a/sysdeps/unix/sysv/linux/sh/chown.c +++ b/sysdeps/unix/sysv/linux/sh/chown.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1998,2000,2002,2003,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 @@ -23,46 +23,13 @@ #include <bp-checks.h> #include <linux/posix_types.h> -#include <kernel-features.h> -#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 */ +/* Consider moving to syscalls.list. */ int __chown (const char *file, uid_t owner, gid_t group) { -#if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (chown32, 3, CHECK_STRING (file), owner, group); -#else -# 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) > (gid_t) ((__kernel_uid_t) -1U)) - || ((group + 1) > (gid_t) ((__kernel_gid_t) -1U))) - { - __set_errno (EINVAL); - return -1; - } - - return INLINE_SYSCALL (chown, 3, CHECK_STRING (file), owner, group); -#endif } libc_hidden_def (__chown) weak_alias (__chown, chown) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c b/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c index 87cb23a517..464f0b502d 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/semctl.c @@ -1,6 +1,5 @@ /* Semctl for architectures where word sized unions are passed indirectly - Copyright (C) 1995,1997,1998,2000,2002,2003,2004,2006 - Free Software Foundation, Inc. + Copyright (C) 1995-2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@gnu.ai.mit.edu>, August 1995. @@ -27,7 +26,6 @@ #include <string.h> #include <sys/syscall.h> -#include <kernel-features.h> #include <shlib-compat.h> struct __old_semid_ds @@ -55,14 +53,6 @@ union semun #include <bp-checks.h> #include <bp-semctl.h> /* definition of CHECK_SEMCTL needs union semum */ -#ifdef __NR_getuid32 -# 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 - /* Return identifier for array of NSEMS semaphores associated with KEY. */ #if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_2) @@ -126,82 +116,8 @@ __new_semctl (int semid, int semnum, int cmd, ...) break; } -#if __ASSUME_32BITUIDS > 0 return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64, CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)); -#else - switch (cmd) { - case SEM_STAT: - case IPC_STAT: - case IPC_SET: - break; - default: - return INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, - CHECK_SEMCTL (&arg, semid, cmd)); - } - - { - int result; - struct __old_semid_ds old; - struct semid_ds *buf; - -#ifdef __NR_getuid32 - if (__libc_missing_32bit_uids <= 0) - { - if (__libc_missing_32bit_uids < 0) - { - int save_errno = errno; - - /* Test presence of new IPC by testing for getuid32 syscall. */ - result = INLINE_SYSCALL (getuid32, 0); - if (result == -1 && errno == ENOSYS) - __libc_missing_32bit_uids = 1; - else - __libc_missing_32bit_uids = 0; - __set_errno(save_errno); - } - if (__libc_missing_32bit_uids <= 0) - { - result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd | __IPC_64, - CHECK_SEMCTL (&arg, semid, cmd | __IPC_64)); - return result; - } - } -#endif - - buf = arg.buf; - arg.__old_buf = &old; - if (cmd == IPC_SET) - { - old.sem_perm.uid = buf->sem_perm.uid; - old.sem_perm.gid = buf->sem_perm.gid; - old.sem_perm.mode = buf->sem_perm.mode; - if (old.sem_perm.uid != buf->sem_perm.uid || - old.sem_perm.gid != buf->sem_perm.gid) - { - __set_errno (EINVAL); - return -1; - } - } - result = INLINE_SYSCALL (ipc, 5, IPCOP_semctl, semid, semnum, cmd, - CHECK_SEMCTL (&arg, semid, cmd)); - if (result != -1 && cmd != IPC_SET) - { - memset(buf, 0, sizeof(*buf)); - buf->sem_perm.__key = old.sem_perm.__key; - buf->sem_perm.uid = old.sem_perm.uid; - buf->sem_perm.gid = old.sem_perm.gid; - buf->sem_perm.cuid = old.sem_perm.cuid; - buf->sem_perm.cgid = old.sem_perm.cgid; - buf->sem_perm.mode = old.sem_perm.mode; - buf->sem_perm.__seq = old.sem_perm.__seq; - buf->sem_otime = old.sem_otime; - buf->sem_ctime = old.sem_ctime; - buf->sem_nsems = old.sem_nsems; - } - return result; - } -#endif } versioned_symbol (libc, __new_semctl, semctl, GLIBC_2_2); |