From: Albert ARIBAUD (3ADEV) Date: Thu, 7 Sep 2017 22:42:01 +0000 (+0200) Subject: Y2038: add function __mq_timedsend_time64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2db28845c198a77d1a060d1954fed28eb9b8d78a;p=thirdparty%2Fglibc.git Y2038: add function __mq_timedsend_time64 --- diff --git a/rt/Makefile b/rt/Makefile index 928f90e4dba..f6011f46d35 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -38,7 +38,7 @@ 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_timedreceiv_time64 + mq_timedreceiv_time64 mq_timedsend_time64 routines = $(clock-routines) diff --git a/rt/Versions b/rt/Versions index 25202cff118..4844d6b036e 100644 --- a/rt/Versions +++ b/rt/Versions @@ -43,5 +43,6 @@ librt { __timerfd_gettime64; __timerfd_settime64; __mq_timedreceive64; + __mq_timedsend_time64; } } diff --git a/rt/mq_timedsend_time64.c b/rt/mq_timedsend_time64.c new file mode 100644 index 00000000000..7459d9452d9 --- /dev/null +++ b/rt/mq_timedsend_time64.c @@ -0,0 +1,52 @@ +/* Add message pointed by MSG_PTR to message queue MQDES, stop blocking + on full message queue 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 + . */ + +#include +#include +#include + +/* 64-bit time version */ + +int +__mq_timedsend_time64 (mqd_t mqdes, const char *msg_ptr, size_t msg_len, + unsigned int msg_prio, const struct __timespec64 *abs_timeout) +{ + struct timespec ts32, *tsp32 = NULL; +#ifdef __NR_mq_timedsend_time64 + int result; + + if (__y2038_get_kernel_support () > 0) + { + result = INLINE_SYSCALL (mq_timedsend_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_timedsend(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 a056a935c0c..58e5f4baa1f 100644 --- a/sysdeps/unix/sysv/linux/arm/librt.abilist +++ b/sysdeps/unix/sysv/linux/arm/librt.abilist @@ -1,4 +1,5 @@ GLIBC_2.29 __mq_timedreceive64 F +GLIBC_2.29 __mq_timedsend_time64 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 81423254641..7027d8ac78b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist @@ -28,6 +28,7 @@ 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 __mq_timedsend_time64 F GLIBC_2.29 __timer_gettime64 F GLIBC_2.29 __timer_settime64 F GLIBC_2.29 __timerfd_gettime64 F