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 /sysdeps/unix/sysv/linux/i386 | |
parent | a386f1cc229e7de02740bef18bdd5d272d1e7537 (diff) | |
download | glibc-21708942c9b115a91dc03318a5f9e14328c5a71e.tar.gz glibc-21708942c9b115a91dc03318a5f9e14328c5a71e.tar.xz glibc-21708942c9b115a91dc03318a5f9e14328c5a71e.zip |
Remove pre-2.4 Linux kernel support.
Diffstat (limited to 'sysdeps/unix/sysv/linux/i386')
25 files changed, 35 insertions, 1088 deletions
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); |