diff options
author | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2017-09-08 00:42:00 +0200 |
---|---|---|
committer | Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr> | 2018-10-24 12:53:27 +0200 |
commit | 619f7917420cd973e01654631ff16c08d4e30193 (patch) | |
tree | 94ae797431192a48c2c380ed32d224bc0afb38a2 | |
parent | b065a273b0da04e590eaf0a8c27b136a97d20107 (diff) | |
download | glibc-619f7917420cd973e01654631ff16c08d4e30193.tar glibc-619f7917420cd973e01654631ff16c08d4e30193.tar.gz glibc-619f7917420cd973e01654631ff16c08d4e30193.tar.bz2 glibc-619f7917420cd973e01654631ff16c08d4e30193.zip |
Y2038: add function __mq_timedreceiv_time64
-rw-r--r-- | rt/Makefile | 3 | ||||
-rw-r--r-- | rt/Versions | 1 | ||||
-rw-r--r-- | rt/mq_timedreceiv_time64.c | 54 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/arm/librt.abilist | 1 | ||||
-rw-r--r-- | sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist | 1 |
5 files changed, 59 insertions, 1 deletions
diff --git a/rt/Makefile b/rt/Makefile index 994891e42d..928f90e4db 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -37,7 +37,8 @@ timer-routines := timer_create timer_delete timer_getoverr \ shm-routines := shm_open shm_unlink mq-routines := mq_open mq_close mq_unlink mq_getattr mq_setattr \ mq_notify mq_send mq_receive mq_timedsend \ - mq_timedreceive + mq_timedreceive \ + mq_timedreceiv_time64 routines = $(clock-routines) diff --git a/rt/Versions b/rt/Versions index 8f757ed5d9..25202cff11 100644 --- a/rt/Versions +++ b/rt/Versions @@ -42,5 +42,6 @@ librt { __timer_settime64; __timerfd_gettime64; __timerfd_settime64; + __mq_timedreceive64; } } diff --git a/rt/mq_timedreceiv_time64.c b/rt/mq_timedreceiv_time64.c new file mode 100644 index 0000000000..6d94efe47a --- /dev/null +++ b/rt/mq_timedreceiv_time64.c @@ -0,0 +1,54 @@ +/* Receive the oldest from highest priority messages in message queue + MQDES, stop waiting if ABS_TIMEOUT expires. + + Copyright (C) 2018 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#include <errno.h> +#include <mqueue.h> +#include <y2038-support.h> + +/* 64-bit time version */ + +ssize_t +__mq_timedreceiv_time64 (mqd_t mqdes, char *__restrict msg_ptr, size_t msg_len, + unsigned int *__restrict msg_prio, + const struct __timespec64 *__restrict abs_timeout) +{ + struct timespec ts32, *tsp32 = NULL; + +#ifdef __NR_timedreceiv_time64 + int result; + + if (__y2038_get_kernel_support () > 0) + { + result = INLINE_SYSCALL (mq_timedreceiv_time64, 5, mqdes, msg_ptr, msg_len, + msg_prio, abs_timeout); + if (result == 0 || errno != ENOSYS) + return result; + __y2038_set_kernel_support (-1); + } +#endif + + if (abs_timeout) + { + ts32.tv_sec = abs_timeout->tv_sec; + ts32.tv_nsec = abs_timeout->tv_nsec; + tsp32 = &ts32; + } + return mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, tsp32); +} diff --git a/sysdeps/unix/sysv/linux/arm/librt.abilist b/sysdeps/unix/sysv/linux/arm/librt.abilist index 344fa5b6a4..a056a935c0 100644 --- a/sysdeps/unix/sysv/linux/arm/librt.abilist +++ b/sysdeps/unix/sysv/linux/arm/librt.abilist @@ -1,3 +1,4 @@ +GLIBC_2.29 __mq_timedreceive64 F GLIBC_2.29 __timer_gettime64 F GLIBC_2.29 __timer_settime64 F GLIBC_2.29 __timerfd_gettime64 F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist index f34ae35671..8142325464 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist @@ -27,6 +27,7 @@ GLIBC_2.2 timer_delete F GLIBC_2.2 timer_getoverrun F GLIBC_2.2 timer_gettime F GLIBC_2.2 timer_settime F +GLIBC_2.29 __mq_timedreceive64 F GLIBC_2.29 __timer_gettime64 F GLIBC_2.29 __timer_settime64 F GLIBC_2.29 __timerfd_gettime64 F |