From c36213513490412941512daccf447513e442651b Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 17 Jun 2015 20:22:39 +0000 Subject: Fix nice getpriority, setpriority namespace (bug 18553). nice (XPG3) calls getpriority and setpriority (in XPG4 but not XPG3, i.e. UX-shaded in XPG4). This patch fixes this by making those functions into weak aliases of __* functions and calling the __* versions as needed. Tested for x86_64 and x86 (testsuite, and that disassembly of installed shared libraries is unchanged by this patch). This completes cleaning up the unsorted linknamespace test XFAILs. [BZ #18553] * resource/getpriority.c (getpriority): Rename to __getpriority and define as weak alias of __getpriority. * resource/setpriority.c (setpriority): Rename to __setpriority and define as weak alias of __setpriority. * sysdeps/mach/hurd/getpriority.c (getpriority): Rename to __getpriority and define as weak alias of __getpriority. * sysdeps/mach/hurd/setpriority.c (setpriority): Rename to __setpriority and define as weak alias of __setpriority. * sysdeps/unix/syscalls.list (getpriority): Use __getpriority as strong name. (setpriority): Use __setpriority as strong name. * sysdeps/unix/sysv/linux/getpriority.c (getpriority): Rename to __getpriority and define as weak alias of __getpriority. * include/sys/resource.h (__getpriority): Declare. Use libc_hidden_proto. (__setpriority): Likewise. (getpriority): Don't use libc_hidden_proto. (setpriority): Likewise. * sysdeps/posix/nice.c (nice): Call __getpriority instead of getpriority. Call __setpriority instead of setpriority. * conform/Makefile (test-xfail-XPG3/unistd.h/linknamespace): Remove variable. --- include/sys/resource.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'include/sys') diff --git a/include/sys/resource.h b/include/sys/resource.h index 7622da969a..688c46c4ae 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -2,8 +2,14 @@ #include #ifndef _ISOMAC -libc_hidden_proto (getpriority) -libc_hidden_proto (setpriority) +/* Prototypes repeated instead of using __typeof because + sys/resource.h is included in C++ tests, and declaring functions + with __typeof and __THROW doesn't work for C++. */ +extern int __getpriority (__priority_which_t __which, id_t __who) __THROW; +libc_hidden_proto (__getpriority) +extern int __setpriority (__priority_which_t __which, id_t __who, int __prio) + __THROW; +libc_hidden_proto (__setpriority) libc_hidden_proto (getrlimit64) extern __typeof (getrlimit64) __getrlimit64; libc_hidden_proto (__getrlimit64); -- cgit v1.2.3