From patchwork Wed Apr 18 20:17:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 900361 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-91654-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=3adev.fr Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="qJuAbsWa"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40RD895mJ5z9s0x for ; Thu, 19 Apr 2018 06:23:05 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=cvCaM9l9l/t2ehMONcJtPfmIq68QqUM yOD7Fff2wlVdnLhrOH8J6T78kcoh6E0nME3hjYFFqn+irxtmTplRx61EU9RUz6nU 4sjNAOITMygf4I0Eg0UrAT02KfNPfi8FrkqFLjEj4qgB47G3n5aaHkTt/BDA3NSS KDtayQOiIL0Y= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id:in-reply-to :references; s=default; bh=iwmmJAld1CFLEI0Z/jCwc/KD2dY=; b=qJuAb sWauh/DShIjysKQ/wjhIJvoKhOrKGwF8MAUujkAST9JWyxnVM+GcF8y1QK3+VOPj kZsJYYyJsn0nrafe8r1nT0DnH/5vsYG6RGNYQGID2T298Ge5x5xGudq9O5qr7wB2 btrZ1z66nYZ23ys/7PPtX9g+6ZNfcbOAGdcUwE= Received: (qmail 113642 invoked by alias); 18 Apr 2018 20:20:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 113537 invoked by uid 89); 18 Apr 2018 20:20:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.8 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, KAM_NUMSUBJECT, KAM_SHORT, RCVD_IN_DNSWL_LOW, RCVD_IN_RP_RNBL autolearn=ham version=3.3.2 spammy= X-HELO: smtp3-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [[PATCH RFC 2] 29/63] Y2038: add function __timerfd_gettime64 Date: Wed, 18 Apr 2018 22:17:45 +0200 Message-Id: <20180418201819.15952-30-albert.aribaud@3adev.fr> In-Reply-To: <20180418201819.15952-29-albert.aribaud@3adev.fr> References: <20180418201819.15952-1-albert.aribaud@3adev.fr> <20180418201819.15952-2-albert.aribaud@3adev.fr> <20180418201819.15952-3-albert.aribaud@3adev.fr> <20180418201819.15952-4-albert.aribaud@3adev.fr> <20180418201819.15952-5-albert.aribaud@3adev.fr> <20180418201819.15952-6-albert.aribaud@3adev.fr> <20180418201819.15952-7-albert.aribaud@3adev.fr> <20180418201819.15952-8-albert.aribaud@3adev.fr> <20180418201819.15952-9-albert.aribaud@3adev.fr> <20180418201819.15952-10-albert.aribaud@3adev.fr> <20180418201819.15952-11-albert.aribaud@3adev.fr> <20180418201819.15952-12-albert.aribaud@3adev.fr> <20180418201819.15952-13-albert.aribaud@3adev.fr> <20180418201819.15952-14-albert.aribaud@3adev.fr> <20180418201819.15952-15-albert.aribaud@3adev.fr> <20180418201819.15952-16-albert.aribaud@3adev.fr> <20180418201819.15952-17-albert.aribaud@3adev.fr> <20180418201819.15952-18-albert.aribaud@3adev.fr> <20180418201819.15952-19-albert.aribaud@3adev.fr> <20180418201819.15952-20-albert.aribaud@3adev.fr> <20180418201819.15952-21-albert.aribaud@3adev.fr> <20180418201819.15952-22-albert.aribaud@3adev.fr> <20180418201819.15952-23-albert.aribaud@3adev.fr> <20180418201819.15952-24-albert.aribaud@3adev.fr> <20180418201819.15952-25-albert.aribaud@3adev.fr> <20180418201819.15952-26-albert.aribaud@3adev.fr> <20180418201819.15952-27-albert.aribaud@3adev.fr> <20180418201819.15952-28-albert.aribaud@3adev.fr> <20180418201819.15952-29-albert.aribaud@3adev.fr> For Linux this uses the 32-bit time syscall so it converts the syscall output from 32-bit time to 64-bit time. --- rt/Makefile | 3 +- rt/Versions | 1 + rt/timerfd_gettime64.c | 29 +++++++++++++++ sysdeps/unix/sysv/linux/arm/librt.abilist | 1 + .../sysv/linux/powerpc/powerpc32/librt.abilist | 1 + sysdeps/unix/sysv/linux/timerfd_gettime64.c | 43 ++++++++++++++++++++++ 6 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 rt/timerfd_gettime64.c create mode 100644 sysdeps/unix/sysv/linux/timerfd_gettime64.c diff --git a/rt/Makefile b/rt/Makefile index 6d6b896ee9..c0aad5d8e2 100644 --- a/rt/Makefile +++ b/rt/Makefile @@ -32,7 +32,8 @@ clock-routines := get_clockfreq clock_getcpuclockid \ clock_getres clock_gettime clock_settime \ clock_nanosleep timer-routines := timer_create timer_delete timer_getoverr \ - timer_gettime timer_settime + timer_gettime timer_settime \ + timerfd_gettime64 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 \ diff --git a/rt/Versions b/rt/Versions index 181e5e16ad..ad1e50748a 100644 --- a/rt/Versions +++ b/rt/Versions @@ -40,5 +40,6 @@ librt { GLIBC_2.27 { __timer_gettime64; __timer_settime64; + __timerfd_gettime64; } } diff --git a/rt/timerfd_gettime64.c b/rt/timerfd_gettime64.c new file mode 100644 index 0000000000..72d0b68a4a --- /dev/null +++ b/rt/timerfd_gettime64.c @@ -0,0 +1,29 @@ +/* Get current value of timer TIMERID and store it in VALUE. + + 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 + +int +__timerfd_gettime64 (int fd, struct itimerspec *value) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (__timerfd_gettime64) diff --git a/sysdeps/unix/sysv/linux/arm/librt.abilist b/sysdeps/unix/sysv/linux/arm/librt.abilist index d76ec99c0a..a329b25661 100644 --- a/sysdeps/unix/sysv/linux/arm/librt.abilist +++ b/sysdeps/unix/sysv/linux/arm/librt.abilist @@ -1,6 +1,7 @@ GLIBC_2.27 GLIBC_2.27 A GLIBC_2.27 __timer_gettime64 F GLIBC_2.27 __timer_settime64 F +GLIBC_2.27 __timerfd_gettime64 F GLIBC_2.4 GLIBC_2.4 A GLIBC_2.4 aio_cancel F GLIBC_2.4 aio_cancel64 F diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist index cd7b5f1b97..ec80f749ae 100644 --- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist +++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/librt.abilist @@ -32,6 +32,7 @@ GLIBC_2.2 timer_settime F GLIBC_2.27 GLIBC_2.27 A GLIBC_2.27 __timer_gettime64 F GLIBC_2.27 __timer_settime64 F +GLIBC_2.27 __timerfd_gettime64 F GLIBC_2.3.4 GLIBC_2.3.4 A GLIBC_2.3.4 mq_close F GLIBC_2.3.4 mq_getattr F diff --git a/sysdeps/unix/sysv/linux/timerfd_gettime64.c b/sysdeps/unix/sysv/linux/timerfd_gettime64.c new file mode 100644 index 0000000000..0c79ba41f1 --- /dev/null +++ b/sysdeps/unix/sysv/linux/timerfd_gettime64.c @@ -0,0 +1,43 @@ +/* Get current value of timer TIMERID and store it in VALUE. + + 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; see the file COPYING.LIB. If + not, see . */ + +#include +#include +#include +#include +#include "kernel-posix-timers.h" + +int +__timerfd_gettime64 (int fd, struct __itimerspec64 *value) +{ + int res; + struct itimerspec value32; + + res = INLINE_SYSCALL (timerfd_gettime, 2, fd, &value32); + + if (res == 0) + { + value->it_value.tv_sec = value32.it_value.tv_sec; + value->it_value.tv_nsec = value32.it_value.tv_nsec; + value->it_interval.tv_sec = value32.it_interval.tv_sec; + value->it_interval.tv_nsec = value32.it_interval.tv_nsec; + } + + return res; +}