From patchwork Thu Oct 15 13:06:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40729 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 9F0623948AB3; Thu, 15 Oct 2020 13:06:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F0623948AB3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1602767202; bh=LjOs+r7ahGq6YbOu7ikQSozkpBxBC7ntObxSYtFQ+EQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jgd/I8oj9rKEW+xUR5swwGd2kG4z6pjg0M6IzfwzJTX+0V437cVcUnYTPgGjiAOkx duicBd4FHlEoBf9h4aORnN68A3GUVbXZu2KPSFi0KodnFXx98RzIiQT7fH6S3G2zlX w91RZ00CU4FZLgvDOBBeS7EqLnZqrs6AvZfuksNk= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by sourceware.org (Postfix) with ESMTPS id 85E5A386F009 for ; Thu, 15 Oct 2020 13:06:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 85E5A386F009 Received: by mail-qk1-x743.google.com with SMTP id 188so2219568qkk.12 for ; Thu, 15 Oct 2020 06:06:39 -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:mime-version :content-transfer-encoding; bh=LjOs+r7ahGq6YbOu7ikQSozkpBxBC7ntObxSYtFQ+EQ=; b=ZZedjAegFs/ecUJG6ZnU7YB7CJrucM7q7OLSVsc61voDCBZ/eUqYwTEH3HC/kLXSXF wU2yeOupl640XIPnxAaJ14w2f0gigbKw6/0Ds8l1j79umClyGcexuDacTc+opfAbeQAP qiWO677Xv6vEjJnNFZp3/uTy0lGgv7nSiYtSGVng+YQvv32UiZTEQd8vu8mRBUwtOR/s DSi3LWdmiRQA/Ugm8mLGNIAlCygc7swDbnX4O+q7R1zH/ntXhGty5jPitpsXSHrBD4Sf 9cKBMDL0eg6bBwOuz5BDe7Lexx/8r+lBRe7Kh5zGC4Nz4FL8aek0mrRLKHdR47fyC2NV NVQw== X-Gm-Message-State: AOAM530/TO4L0C5jCcRUWjTF2z5NPASaaEMpA0PqSyl7ftc3EEfOk5eV bvxmmMyx7rHgDVYZjDyop23+BANYWK682Q== X-Google-Smtp-Source: ABdhPJzIJS5ME01i4GZx99HNjGldPEcpNPB/k580uSrF9OIio+U0Z9bWTbsrWZ0URWNJNou5ZgUqjg== X-Received: by 2002:ae9:ed02:: with SMTP id c2mr3890567qkg.410.1602767197885; Thu, 15 Oct 2020 06:06:37 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id 6sm1093648qtz.31.2020.10.15.06.06.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 06:06:37 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 1/3] linux: Fix time64 support for futimesat Date: Thu, 15 Oct 2020 10:06:30 -0300 Message-Id: <20201015130632.90961-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 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, KAM_SHORT, 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 Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The generic implementation does not support time64 and the default one return overflow for invalid tv_sec with UTIME_NOW / UTIME_OMIT (which is valid since tv_sec in such cases is ignored by the kernel). 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/generic/futimesat.c | 52 --------------------- sysdeps/unix/sysv/linux/utimensat.c | 8 +++- 2 files changed, 6 insertions(+), 54 deletions(-) delete mode 100644 sysdeps/unix/sysv/linux/generic/futimesat.c diff --git a/sysdeps/unix/sysv/linux/generic/futimesat.c b/sysdeps/unix/sysv/linux/generic/futimesat.c deleted file mode 100644 index 7be1fbc252..0000000000 --- a/sysdeps/unix/sysv/linux/generic/futimesat.c +++ /dev/null @@ -1,52 +0,0 @@ -/* futimesat -- Change access and modification times of file. Linux version. - Copyright (C) 2005-2020 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Chris Metcalf , 2011. - - 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 -#include -#include -#include -#include -#include - - -/* Change the access time of FILE relative to FD to TVP[0] and - the modification time of FILE to TVP[1]. */ -int -futimesat (int fd, const char *file, const struct timeval tvp[2]) -{ - struct timespec tsp[2]; - int result; - - if (tvp) - { - if (tvp[0].tv_usec >= 1000000 || tvp[0].tv_usec < 0 - || tvp[1].tv_usec >= 1000000 || tvp[1].tv_usec < 0) - { - __set_errno (EINVAL); - return -1; - } - TIMEVAL_TO_TIMESPEC (&tvp[0], &tsp[0]); - TIMEVAL_TO_TIMESPEC (&tvp[1], &tsp[1]); - } - - result = INLINE_SYSCALL (utimensat, 4, fd, file, tvp ? tsp : NULL, 0); - return result; -} diff --git a/sysdeps/unix/sysv/linux/utimensat.c b/sysdeps/unix/sysv/linux/utimensat.c index ea23c2f051..72784d824a 100644 --- a/sysdeps/unix/sysv/linux/utimensat.c +++ b/sysdeps/unix/sysv/linux/utimensat.c @@ -36,9 +36,13 @@ __utimensat64_helper (int fd, const char *file, if (ret == 0 || errno != ENOSYS) return ret; + /* For UTIME_NOW and UTIME_OMIT the value of tv_sec field is ignored. */ +# define NS_VALID(ns) \ + ((((ns).tv_nsec == UTIME_NOW || (ns).tv_nsec == UTIME_OMIT) \ + || in_time_t_range ((ns).tv_sec))) + if (tsp64 != NULL - && (! in_time_t_range (tsp64[0].tv_sec) - || ! in_time_t_range (tsp64[1].tv_sec))) + && (!NS_VALID (tsp64[0]) || !NS_VALID (tsp64[1]))) { __set_errno (EOVERFLOW); return -1; From patchwork Thu Oct 15 13:06:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 40730 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 2A403394C803; Thu, 15 Oct 2020 13:06:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2A403394C803 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1602767203; bh=HonHM1yR+jDg1UguiodRSNEcsnNpglP1LgZ7siFLTxo=; 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=y3pqO4ElG/8Ky8nj5ez9rfhZIlYLGj29Z2tNn0TW3NpK4SENRDTq8ryToi0BCiSUA IAYXugCffaUXmnahqfl0HwSFnVZwfnI5oAcxVkCreyiQCdzLpttlFv9Kl5j8MOpu/x 7hbLImlMrRkb9HGBm/9ZJrgiQGUqxc8seVdGSaH4= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x72b.google.com (mail-qk1-x72b.google.com [IPv6:2607:f8b0:4864:20::72b]) by sourceware.org (Postfix) with ESMTPS id DB3DE3861969 for ; Thu, 15 Oct 2020 13:06:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org DB3DE3861969 Received: by mail-qk1-x72b.google.com with SMTP id x20so2271016qkn.1 for ; Thu, 15 Oct 2020 06:06:40 -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=HonHM1yR+jDg1UguiodRSNEcsnNpglP1LgZ7siFLTxo=; b=rzBHRZmXGMuk4YJd55Lx8moM1y94XxUGuX2W9TrYkEIn7OD15MEXNM49hu960eRWpO G9Kn9ZBBtpntPF3Fp0gzO1UX058iOky1eeiZMkNcfy/NkY7RPkj2v+E75LGTINX7Yp31 TEZmWMkrqjYbYlvB0XDjy3gWZ5PAIbZZjmrCtuuTYM3+YoPiL4yB2bzWcmXdNppl7ZFk 9EMMy7Ty6EjaxZt86d5AYnkfoBJLqm50dBptIYWI3fVNzfjlV80HBEXCd3N+pjJreJGq yOXqEDol2KMz/iLNYgl0snNFT0quf2keDb60lBBo4HAvWAWzycUDr/UeeYAi/gvpSdrt 2QMg== X-Gm-Message-State: AOAM532ppj+DfGUkPcPNCWsEk/azTVTeqbzkHcsjRL6uvQmroZK+MUVU F9SZZRHJrPB/Ug3+sl5GOWBUW2soCyqvwQ== X-Google-Smtp-Source: ABdhPJz5dF5XqDga9DIbr4pkRU5kIwQFMxOeQHt0+fh8gJbRScCccKmqXSUkIRvFdVTUNylG71Ti+w== X-Received: by 2002:a37:ba42:: with SMTP id k63mr3848011qkf.22.1602767199875; Thu, 15 Oct 2020 06:06:39 -0700 (PDT) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id 6sm1093648qtz.31.2020.10.15.06.06.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Oct 2020 06:06:39 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH 2/3] Move ftime to a compatibility symbol Date: Thu, 15 Oct 2020 10:06:31 -0300 Message-Id: <20201015130632.90961-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201015130632.90961-1-adhemerval.zanella@linaro.org> References: <20201015130632.90961-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, KAM_SHORT, 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 Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It was made deprecated on 2.31, so it moves to compat symbol after two releases. It was also removed from exported symbol for riscv32 (since ABI will be supported on for 2.33). Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- include/sys/timeb.h | 1 - .../unix/sysv/linux/riscv/rv32/libc.abilist | 1 - time/Makefile | 5 +- time/ftime.c | 19 +++++- time/sys/timeb.h | 44 -------------- time/tst-ftime.c | 59 ++++++++++--------- 6 files changed, 50 insertions(+), 79 deletions(-) delete mode 100644 include/sys/timeb.h delete mode 100644 time/sys/timeb.h diff --git a/include/sys/timeb.h b/include/sys/timeb.h deleted file mode 100644 index 9f4509c35e..0000000000 --- a/include/sys/timeb.h +++ /dev/null @@ -1 +0,0 @@ -#include