]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Y2038: add function __mq_timedreceiv_time64
authorAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
Thu, 7 Sep 2017 22:42:00 +0000 (00:42 +0200)
committerAlbert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
Wed, 24 Oct 2018 10:53:27 +0000 (12:53 +0200)
rt/Makefile
rt/Versions
rt/mq_timedreceiv_time64.c [new file with mode: 0644]
sysdeps/unix/sysv/linux/arm/librt.abilist
sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist

index 994891e42d0657b62fb279a9adc06eae3f05605d..928f90e4dba8b522af82415e6c93a1fc12e78f60 100644 (file)
@@ -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)
 
index 8f757ed5d9fba3966302da36e7093fe4858f2bc6..25202cff1182006e1374df6bb172341dce11dcad 100644 (file)
@@ -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 (file)
index 0000000..6d94efe
--- /dev/null
@@ -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);
+}
index 344fa5b6a48bfbf095962a54204dbfa086d381e6..a056a935c0cf564819f27b63a23c6522195be26a 100644 (file)
@@ -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
index f34ae35671adad930315b5626c8e2db5da56dfe7..814232546413ae3999de6d463e8f26f1cab4fef4 100644 (file)
@@ -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