From patchwork Mon Jul 13 17:10:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 40075 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id B77B9388E813; Mon, 13 Jul 2020 17:10:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B77B9388E813 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1594660247; bh=tOm28MJ10DFnjRbjU8y94BHe1pMCT32YXOii8aDFUGo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=vK/DjNskT7drjQETqSAxYt4JO6tanR6LoLOUmFtOwm9PUSU8NMccPSzdgqraJ6iLK i8nOgOAbfOU2XX47g0vGnxmp4btk2usWlSS5o0xI3gYluGegMJYVeG5NPq7YYdjkSe ZX55ky+JgqZVxsAtR+YCfK11tbpwpXOOHN7UWFZc= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qt1-x842.google.com (mail-qt1-x842.google.com [IPv6:2607:f8b0:4864:20::842]) by sourceware.org (Postfix) with ESMTPS id DF814388E813 for ; Mon, 13 Jul 2020 17:10:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DF814388E813 Received: by mail-qt1-x842.google.com with SMTP id j10so10487565qtq.11 for ; Mon, 13 Jul 2020 10:10:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tOm28MJ10DFnjRbjU8y94BHe1pMCT32YXOii8aDFUGo=; b=SlMBn2O0aOOFrfpYSa1IG8I7W9W+qcc4Ym2eIyIWsS0rAECTtOuCb+TBI9Ns/xCh9D tyGdEpr/SxSgQRL35CEtYDILJUAPajlHpHsJIETz61nHwAY4bnN9iCs8vot6s+0iJ5IO mNPDLEETPDqHhNbG3iCe5YRcZe3kFz6jUTS7UPyAcO160rmLPXLkcHh10nyxrc0cYi1d oF8ZIoYymMUCN7DDxRkxV7mkuTpAlK8UL/IWkPFHyDshFgaHmuOsJzNapvji6+RNlHhK K6/STsTtMgpC03ZcTY+O/b9MGMwie1wRHcXDWVNpu4KOO6WuRa3+VxuK2fOWNNE0znta jHcA== X-Gm-Message-State: AOAM530PWxWdcBnnxDfKmaxJy1Na/teO8yX8Z/PTzJB7BuqtNNdSQMkr j/MOfSQ9zWbgKBT36tFit25AlGAlhzA= X-Google-Smtp-Source: ABdhPJxqcp2a0yobaF8qjexI2gUkNeiryxAt3AvBLSvI+d0Nq2mcfSYusRTnArMRYr0zpH0OtZbO+w== X-Received: by 2002:aed:2aa5:: with SMTP id t34mr290535qtd.363.1594660244219; Mon, 13 Jul 2020 10:10:44 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id v10sm19767919qtk.14.2020.07.13.10.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 10:10:43 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 10/23] linux: Simplify timerfd_settime Date: Mon, 13 Jul 2020 14:10:12 -0300 Message-Id: <20200713171025.3661832-10-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200713171025.3661832-1-adhemerval.zanella@linaro.org> References: <20200713171025.3661832-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-14.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" With arch-syscall.h it can now assumes the existance of either __NR_timer_settime or __NR_time_settime_time64. The 32-bit time_t support is now only build for !__ASSUME_TIME64_SYSCALLS. Checked on x86_64-linux-gnu and i686-linux-gnu (on 5.4 and on 4.15 kernel). Reviewed-by: Lukasz Majewski --- sysdeps/unix/sysv/linux/timerfd_settime.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/sysdeps/unix/sysv/linux/timerfd_settime.c b/sysdeps/unix/sysv/linux/timerfd_settime.c index 164b4e860a..7c55e7e8d6 100644 --- a/sysdeps/unix/sysv/linux/timerfd_settime.c +++ b/sysdeps/unix/sysv/linux/timerfd_settime.c @@ -26,18 +26,13 @@ int __timerfd_settime64 (int fd, int flags, const struct __itimerspec64 *value, struct __itimerspec64 *ovalue) { -#ifdef __ASSUME_TIME64_SYSCALLS -# ifndef __NR_timerfd_settime64 -# define __NR_timerfd_settime64 __NR_timerfd_settime -# endif - return INLINE_SYSCALL_CALL (timerfd_settime64, fd, flags, value, ovalue); -#else -# ifdef __NR_timerfd_settime64 +#ifndef __NR_timerfd_settime64 +# define __NR_timerfd_settime64 __NR_timerfd_settime +#endif int ret = INLINE_SYSCALL_CALL (timerfd_settime64, fd, flags, value, ovalue); +#ifndef __ASSUME_TIME64_SYSCALLS if (ret == 0 || errno != ENOSYS) return ret; -# endif - struct itimerspec its32, oits32; if (! in_time_t_range ((value->it_value).tv_sec) || ! in_time_t_range ((value->it_interval).tv_sec)) @@ -46,19 +41,19 @@ __timerfd_settime64 (int fd, int flags, const struct __itimerspec64 *value, return -1; } + struct itimerspec its32, oits32; its32.it_interval = valid_timespec64_to_timespec (value->it_interval); its32.it_value = valid_timespec64_to_timespec (value->it_value); - int retval = INLINE_SYSCALL_CALL (timerfd_settime, fd, flags, - &its32, ovalue ? &oits32 : NULL); - if (retval == 0 && ovalue) + ret = INLINE_SYSCALL_CALL (timerfd_settime, fd, flags, + &its32, ovalue ? &oits32 : NULL); + if (ret == 0 && ovalue != NULL) { ovalue->it_interval = valid_timespec_to_timespec64 (oits32.it_interval); ovalue->it_value = valid_timespec_to_timespec64 (oits32.it_value); } - - return retval; #endif + return ret; } #if __TIMESIZE != 64