summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-06-17 20:22:39 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-06-17 20:22:39 +0000
commitc36213513490412941512daccf447513e442651b (patch)
treed5be56d7d716470d892ca65d847c73165866a28b /sysdeps
parentabccad04b4172d552dbdae948c0e567ba266ad76 (diff)
downloadglibc-c36213513490412941512daccf447513e442651b.tar.gz
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.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/getpriority.c5
-rw-r--r--sysdeps/mach/hurd/setpriority.c5
-rw-r--r--sysdeps/posix/nice.c6
-rw-r--r--sysdeps/unix/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/getpriority.c5
5 files changed, 14 insertions, 11 deletions
diff --git a/sysdeps/mach/hurd/getpriority.c b/sysdeps/mach/hurd/getpriority.c
index bb81ee69ef..73c7ad38c8 100644
--- a/sysdeps/mach/hurd/getpriority.c
+++ b/sysdeps/mach/hurd/getpriority.c
@@ -24,7 +24,7 @@
or user (as specified by WHO) is used. A lower priority number means higher
priority. Priorities range from PRIO_MIN to PRIO_MAX. */
int
-getpriority (enum __priority_which which, id_t who)
+__getpriority (enum __priority_which which, id_t who)
{
error_t err, onerr;
int maxpri = INT_MIN;
@@ -81,4 +81,5 @@ getpriority (enum __priority_which which, id_t who)
return MACH_PRIORITY_TO_NICE (maxpri);
}
-libc_hidden_def (getpriority)
+libc_hidden_def (__getpriority)
+weak_alias (__getpriority, getpriority)
diff --git a/sysdeps/mach/hurd/setpriority.c b/sysdeps/mach/hurd/setpriority.c
index 43b8877fa0..41d7aa41fe 100644
--- a/sysdeps/mach/hurd/setpriority.c
+++ b/sysdeps/mach/hurd/setpriority.c
@@ -21,7 +21,7 @@
/* Set the priority of all processes specified by WHICH and WHO
to PRIO. Returns 0 on success, -1 on errors. */
int
-setpriority (enum __priority_which which, id_t who, int prio)
+__setpriority (enum __priority_which which, id_t who, int prio)
{
error_t err;
error_t pidloser, priloser;
@@ -94,4 +94,5 @@ setpriority (enum __priority_which which, id_t who, int prio)
return err ? __hurd_fail (err) : 0;
}
-libc_hidden_def (setpriority)
+libc_hidden_def (__setpriority)
+weak_alias (__setpriority, setpriority)
diff --git a/sysdeps/posix/nice.c b/sysdeps/posix/nice.c
index 67b127348f..42bb99b7e1 100644
--- a/sysdeps/posix/nice.c
+++ b/sysdeps/posix/nice.c
@@ -31,7 +31,7 @@ nice (int incr)
/* -1 is a valid priority, so we use errno to check for an error. */
save = errno;
__set_errno (0);
- prio = getpriority (PRIO_PROCESS, 0);
+ prio = __getpriority (PRIO_PROCESS, 0);
if (prio == -1)
{
if (errno != 0)
@@ -40,12 +40,12 @@ nice (int incr)
__set_errno (save);
}
- result = setpriority (PRIO_PROCESS, 0, prio + incr);
+ result = __setpriority (PRIO_PROCESS, 0, prio + incr);
if (result == -1)
{
if (errno == EACCES)
errno = EPERM;
return -1;
}
- return getpriority (PRIO_PROCESS, 0);
+ return __getpriority (PRIO_PROCESS, 0);
}
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index b3358bd933..2254c761b4 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -29,7 +29,7 @@ gethostname - gethostname i:bn __gethostname gethostname
getitimer - getitimer i:ip __getitimer getitimer
getpeername - getpeername i:ibN __getpeername getpeername
getpid - getpid Ei: __getpid getpid
-getpriority - getpriority i:ii getpriority
+getpriority - getpriority i:ii __getpriority getpriority
getrlimit - getrlimit i:ip __getrlimit getrlimit
getrusage - getrusage i:ip __getrusage getrusage
getsockname - getsockname i:ibN __getsockname getsockname
@@ -72,7 +72,7 @@ sethostid - sethostid i:i sethostid
sethostname - sethostname i:pi sethostname
setitimer - setitimer i:ipp __setitimer setitimer
setpgid - setpgrp i:ii __setpgid setpgid
-setpriority - setpriority i:iii setpriority
+setpriority - setpriority i:iii __setpriority setpriority
setregid - setregid i:ii __setregid setregid
setreuid - setreuid i:ii __setreuid setreuid
setrlimit - setrlimit i:ip __setrlimit setrlimit
diff --git a/sysdeps/unix/sysv/linux/getpriority.c b/sysdeps/unix/sysv/linux/getpriority.c
index 96d9de3162..9c691bb387 100644
--- a/sysdeps/unix/sysv/linux/getpriority.c
+++ b/sysdeps/unix/sysv/linux/getpriority.c
@@ -32,7 +32,7 @@
priority. Priorities range from PRIO_MIN to PRIO_MAX. */
int
-getpriority (enum __priority_which which, id_t who)
+__getpriority (enum __priority_which which, id_t who)
{
int res;
@@ -41,4 +41,5 @@ getpriority (enum __priority_which which, id_t who)
res = PZERO - res;
return res;
}
-libc_hidden_def (getpriority)
+libc_hidden_def (__getpriority)
+weak_alias (__getpriority, getpriority)