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 (3ADEV)" X-Patchwork-Id: 900381 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-91674-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="Q0Zd1Jlg"; 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 40RDCm23HKz9s0x for ; Thu, 19 Apr 2018 06:26:12 +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=ZrFhLRJJcKCqQjAIW+McEVI8lav0Qz5 cQbrnbm/qCOeTsqPnUvA8nOMImXAtF2ZI8+pPX9acr9qFjrSsEC70kpd7E21gCKr JJMAlzl9aZm6vD3VoRHlPWjllHyXXByBk+R3qtTIyJJ82T/ieeW8TfVeBmfWwXF/ +iDD9RrXu3jw= 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=9S9geKYmttVydnTQQ8XlrCfk7xg=; b=Q0Zd1 JlgAJDMdF12pX8RdFJPF6sNGH9bEMQhhd/+a4bY5V8SDVUPgbC3TpwTlOkHRTeew 3gtxy/batNEGELQ2584qlfwu4Z9Sn90SVpBZzP75dXnF68xj/5unWrKc2F+19M0E SMhKA4eATMLac+zHd+D2KLEDyLlq2oraasv/sc= 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; +}