From patchwork Wed Apr 18 20:18:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Albert ARIBAUD X-Patchwork-Id: 26828 Received: (qmail 125839 invoked by alias); 18 Apr 2018 20:22:14 -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 125755 invoked by uid 89); 18 Apr 2018 20:22:14 -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=WHICH X-HELO: smtp3-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [[PATCH RFC 2] 49/63] Y2038: add function __getitimer64 Date: Wed, 18 Apr 2018 22:18:05 +0200 Message-Id: <20180418201819.15952-50-albert.aribaud@3adev.fr> In-Reply-To: <20180418201819.15952-49-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> <20180418201819.15952-30-albert.aribaud@3adev.fr> <20180418201819.15952-31-albert.aribaud@3adev.fr> <20180418201819.15952-32-albert.aribaud@3adev.fr> <20180418201819.15952-33-albert.aribaud@3adev.fr> <20180418201819.15952-34-albert.aribaud@3adev.fr> <20180418201819.15952-35-albert.aribaud@3adev.fr> <20180418201819.15952-36-albert.aribaud@3adev.fr> <20180418201819.15952-37-albert.aribaud@3adev.fr> <20180418201819.15952-38-albert.aribaud@3adev.fr> <20180418201819.15952-39-albert.aribaud@3adev.fr> <20180418201819.15952-40-albert.aribaud@3adev.fr> <20180418201819.15952-41-albert.aribaud@3adev.fr> <20180418201819.15952-42-albert.aribaud@3adev.fr> <20180418201819.15952-43-albert.aribaud@3adev.fr> <20180418201819.15952-44-albert.aribaud@3adev.fr> <20180418201819.15952-45-albert.aribaud@3adev.fr> <20180418201819.15952-46-albert.aribaud@3adev.fr> <20180418201819.15952-47-albert.aribaud@3adev.fr> <20180418201819.15952-48-albert.aribaud@3adev.fr> <20180418201819.15952-49-albert.aribaud@3adev.fr> --- time/Makefile | 1 + time/Versions | 1 + time/getitimer64.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 time/getitimer64.c diff --git a/time/Makefile b/time/Makefile index fac49865a2..b1b026d163 100644 --- a/time/Makefile +++ b/time/Makefile @@ -35,6 +35,7 @@ routines := offtime asctime clock ctime ctime_r difftime \ gettimeofday settimeofday adjtime tzset \ gettimeofday64 settimeofday64 \ tzfile getitimer setitimer \ + getitimer64 \ stime dysize timegm ftime \ getdate strptime strptime_l \ strftime wcsftime strftime_l wcsftime_l \ diff --git a/time/Versions b/time/Versions index c7e9379243..b97d3f8449 100644 --- a/time/Versions +++ b/time/Versions @@ -90,5 +90,6 @@ libc { __stime64; __utimes64; __adjtime64; + __getitimer64; } } diff --git a/time/getitimer64.c b/time/getitimer64.c new file mode 100644 index 0000000000..e6f5443e33 --- /dev/null +++ b/time/getitimer64.c @@ -0,0 +1,53 @@ +/* Get the current value of an interval timer + + 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 + +extern int __y2038_linux_support; + +/* Set *VALUE to the current setting of timer WHICH. + Return 0 on success, -1 on errors. */ +int +__getitimer64 (enum __itimer_which which, + struct __itimerval64 *value) +{ + struct itimerval value32, *value32p= NULL; + + if (__y2038_linux_support) + { + /* TODO: use 64-bit syscall */ + } + + if (value != NULL) + value32p = &value32; + + int result = __getitimer(which, value32p); + + if (result == 0 && value != NULL) + { + value->it_interval.tv_sec = value32.it_interval.tv_sec; + value->it_interval.tv_usec = value32.it_interval.tv_usec; + value->it_value.tv_sec = value32.it_value.tv_sec; + value->it_value.tv_usec = value32.it_value.tv_usec; + } + + return result; +}