From dfa2d21450f44b3ea7129858764c1508d87ae27a Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Wed, 17 Jun 2015 20:19:04 +0000 Subject: Fix mq_receive, mq_send mq_timed* namespace (bug 18545). mq_receive calls mq_timedreceive, and mq_send calls mq_timedsend. But mq_receive and mq_send were in POSIX by 1996, while mq_timed* were added in the 2001 edition of POSIX. This patch fixes this by making mq_timed* into weak aliases for __mq_timed* and calling the __mq_timed* names. Tested for x86_64 and x86 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). [BZ #18545] * rt/mq_timedreceive.c (mq_timedreceive): Rename to __mq_timedreceive and define as alias of __mq_timedreceive. Use hidden_weak. * rt/mq_timedsend.c (mq_timedsend): Rename to __mq_timedsend and define as alias of __mq_timedsend. Use hidden_weak. * sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Use __mq_timedsend as strong name. (mq_timedreceive): Use __mq_timedreceive as strong name. * include/mqueue.h (__mq_timedsend): Declare. Use hidden_proto. (__mq_timedreceive): Likewise. * sysdeps/unix/sysv/linux/mq_receive.c (mq_receive): Call __mq_timedreceive instead of mq_timedreceive. * sysdeps/unix/sysv/linux/mq_send.c (mq_send): Call __mq_timedsend instead of mq_timedsend. * conform/Makefile (test-xfail-UNIX98/mqueue.h/linknamespace): Remove variable. --- ChangeLog | 18 ++++++++++++++++++ NEWS | 2 +- conform/Makefile | 1 - include/mqueue.h | 4 ++++ rt/mq_timedreceive.c | 6 ++++-- rt/mq_timedsend.c | 6 ++++-- sysdeps/unix/sysv/linux/mq_receive.c | 2 +- sysdeps/unix/sysv/linux/mq_send.c | 2 +- sysdeps/unix/sysv/linux/syscalls.list | 4 ++-- 9 files changed, 35 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2ec139f1a4..9e45c2eb3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 2015-06-17 Joseph Myers + [BZ #18545] + * rt/mq_timedreceive.c (mq_timedreceive): Rename to + __mq_timedreceive and define as alias of __mq_timedreceive. Use + hidden_weak. + * rt/mq_timedsend.c (mq_timedsend): Rename to __mq_timedsend and + define as alias of __mq_timedsend. Use hidden_weak. + * sysdeps/unix/sysv/linux/syscalls.list (mq_timedsend): Use + __mq_timedsend as strong name. + (mq_timedreceive): Use __mq_timedreceive as strong name. + * include/mqueue.h (__mq_timedsend): Declare. Use hidden_proto. + (__mq_timedreceive): Likewise. + * sysdeps/unix/sysv/linux/mq_receive.c (mq_receive): Call + __mq_timedreceive instead of mq_timedreceive. + * sysdeps/unix/sysv/linux/mq_send.c (mq_send): Call __mq_timedsend + instead of mq_timedsend. + * conform/Makefile (test-xfail-UNIX98/mqueue.h/linknamespace): + Remove variable. + * sysdeps/unix/make-syscalls.sh (emit_weak_aliases): Use hidden_def and hidden_weak instead of libc_hidden_def and libc_hidden_weak. diff --git a/NEWS b/NEWS index 59586d41df..004d769b79 100644 --- a/NEWS +++ b/NEWS @@ -22,7 +22,7 @@ Version 2.22 18324, 18333, 18346, 18397, 18409, 18410, 18412, 18418, 18422, 18434, 18444, 18468, 18469, 18470, 18479, 18483, 18495, 18496, 18497, 18498, 18507, 18512, 18519, 18520, 18522, 18527, 18528, 18529, 18530, 18532, - 18533, 18534, 18536, 18539, 18540, 18542, 18544. + 18533, 18534, 18536, 18539, 18540, 18542, 18544, 18545. * Cache information can be queried via sysconf() function on s390 e.g. with _SC_LEVEL1_ICACHE_SIZE as argument. diff --git a/conform/Makefile b/conform/Makefile index 0b061037cd..fa25aa8105 100644 --- a/conform/Makefile +++ b/conform/Makefile @@ -347,4 +347,3 @@ test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes test-xfail-XPG3/unistd.h/linknamespace = yes test-xfail-XPG4/unistd.h/linknamespace = yes test-xfail-POSIX/mqueue.h/linknamespace = yes -test-xfail-UNIX98/mqueue.h/linknamespace = yes diff --git a/include/mqueue.h b/include/mqueue.h index eb47b9b34e..3c66f1711e 100644 --- a/include/mqueue.h +++ b/include/mqueue.h @@ -3,7 +3,11 @@ #ifndef _ISOMAC # if IS_IN (librt) hidden_proto (mq_timedsend) +extern __typeof (mq_timedsend) __mq_timedsend __nonnull ((2, 5)); +hidden_proto (__mq_timedsend) hidden_proto (mq_timedreceive) +extern __typeof (mq_timedreceive) __mq_timedreceive __nonnull ((2, 5)); +hidden_proto (__mq_timedreceive) hidden_proto (mq_setattr) # endif #endif diff --git a/rt/mq_timedreceive.c b/rt/mq_timedreceive.c index b6c1d2a5e1..c476c68696 100644 --- a/rt/mq_timedreceive.c +++ b/rt/mq_timedreceive.c @@ -21,12 +21,14 @@ /* Receive the oldest from highest priority messages in message queue MQDES, stop waiting if ABS_TIMEOUT expires. */ ssize_t -mq_timedreceive (mqd_t mqdes, char *__restrict msg_ptr, size_t msg_len, +__mq_timedreceive (mqd_t mqdes, char *__restrict msg_ptr, size_t msg_len, unsigned int *__restrict msg_prio, const struct timespec *__restrict abs_timeout) { __set_errno (ENOSYS); return -1; } -hidden_def (mq_timedreceive) +hidden_def (__mq_timedreceive) +weak_alias (__mq_timedreceive, mq_timedreceive) +hidden_weak (mq_timedreceive) stub_warning (mq_timedreceive) diff --git a/rt/mq_timedsend.c b/rt/mq_timedsend.c index ce76e0fd41..30caaf13cb 100644 --- a/rt/mq_timedsend.c +++ b/rt/mq_timedsend.c @@ -21,11 +21,13 @@ /* Add message pointed by MSG_PTR to message queue MQDES, stop blocking on full message queue if ABS_TIMEOUT expires. */ int -mq_timedsend (mqd_t mqdes, const char *msg_ptr, size_t msg_len, +__mq_timedsend (mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout) { __set_errno (ENOSYS); return -1; } -hidden_def (mq_timedsend) +hidden_def (__mq_timedsend) +weak_alias (__mq_timedsend, mq_timedsend) +hidden_weak (mq_timedsend) stub_warning (mq_timedsend) diff --git a/sysdeps/unix/sysv/linux/mq_receive.c b/sysdeps/unix/sysv/linux/mq_receive.c index 3c41ecf411..ff73d0a138 100644 --- a/sysdeps/unix/sysv/linux/mq_receive.c +++ b/sysdeps/unix/sysv/linux/mq_receive.c @@ -28,7 +28,7 @@ ssize_t mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio) { - return mq_timedreceive (mqdes, msg_ptr, msg_len, msg_prio, NULL); + return __mq_timedreceive (mqdes, msg_ptr, msg_len, msg_prio, NULL); } #else diff --git a/sysdeps/unix/sysv/linux/mq_send.c b/sysdeps/unix/sysv/linux/mq_send.c index 4022cf1fee..9013657aa0 100644 --- a/sysdeps/unix/sysv/linux/mq_send.c +++ b/sysdeps/unix/sysv/linux/mq_send.c @@ -27,7 +27,7 @@ int mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio) { - return mq_timedsend (mqdes, msg_ptr, msg_len, msg_prio, NULL); + return __mq_timedsend (mqdes, msg_ptr, msg_len, msg_prio, NULL); } #else diff --git a/sysdeps/unix/sysv/linux/syscalls.list b/sysdeps/unix/sysv/linux/syscalls.list index 09dd10d1ab..ed5d38f622 100644 --- a/sysdeps/unix/sysv/linux/syscalls.list +++ b/sysdeps/unix/sysv/linux/syscalls.list @@ -106,8 +106,8 @@ removexattr - removexattr i:ss removexattr lremovexattr - lremovexattr i:ss lremovexattr fremovexattr - fremovexattr i:is fremovexattr -mq_timedsend - mq_timedsend Ci:ipiip mq_timedsend -mq_timedreceive - mq_timedreceive Ci:ipipp mq_timedreceive +mq_timedsend - mq_timedsend Ci:ipiip __mq_timedsend mq_timedsend +mq_timedreceive - mq_timedreceive Ci:ipipp __mq_timedreceive mq_timedreceive mq_setattr - mq_getsetattr i:ipp mq_setattr timerfd_create EXTRA timerfd_create i:ii timerfd_create -- cgit 1.4.1