From patchwork Thu Sep 7 22:41:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Albert ARIBAUD (3ADEV)" X-Patchwork-Id: 811208 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-84330-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="OqTrIriT"; 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 3xpFrl33KWz9sCZ for ; Fri, 8 Sep 2017 08:44:55 +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=IAd8yZurkWaFCdKrli2tpHn+CvSTfvm /tRvJhgfbpZ/Xo7ZVhdhKk8PsMz4+uA3ZZNaAoZLzLXfus0pWCDkrSeULWrPn4sR /v9ORe+dyLRZfJAAoSDL+3glRuRaDgUxbFACSLYb1GeOa//G2LXnGmnIid5v3aXT hkWC+xNhap9s= 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=WySO/d+HvxYcXfr9oRcUDtTpQ6w=; b=OqTrI riTwY41t0P7mwuQ6S3SqmMJa+A1xfhPYGCCz3Zj0tPw1rwTEb7FMD5KnWFHk5Dov zdn8vAK+vES5vrgLf26dcnNR1WEGXEvAHRtzfTjc6DqLGcfm19it8JkJz0riPjmx JmC4Q8udHexPpAPSlPmlEEM0vOcxgPsbikNZ6s= Received: (qmail 69740 invoked by alias); 7 Sep 2017 22:43:20 -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 69649 invoked by uid 89); 7 Sep 2017 22:43:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy= X-HELO: smtp6-g21.free.fr From: "Albert ARIBAUD (3ADEV)" To: libc-alpha@sourceware.org Cc: "Albert ARIBAUD (3ADEV)" Subject: [RFC PATCH 12/52] Y2038: add function __futimens64 Date: Fri, 8 Sep 2017 00:41:39 +0200 Message-Id: <20170907224219.12483-13-albert.aribaud@3adev.fr> In-Reply-To: <20170907224219.12483-12-albert.aribaud@3adev.fr> References: <20170907224219.12483-1-albert.aribaud@3adev.fr> <20170907224219.12483-2-albert.aribaud@3adev.fr> <20170907224219.12483-3-albert.aribaud@3adev.fr> <20170907224219.12483-4-albert.aribaud@3adev.fr> <20170907224219.12483-5-albert.aribaud@3adev.fr> <20170907224219.12483-6-albert.aribaud@3adev.fr> <20170907224219.12483-7-albert.aribaud@3adev.fr> <20170907224219.12483-8-albert.aribaud@3adev.fr> <20170907224219.12483-9-albert.aribaud@3adev.fr> <20170907224219.12483-10-albert.aribaud@3adev.fr> <20170907224219.12483-11-albert.aribaud@3adev.fr> <20170907224219.12483-12-albert.aribaud@3adev.fr> Signed-off-by: Albert ARIBAUD (3ADEV) --- io/futimens.c | 9 +++++++++ sysdeps/unix/sysv/linux/arm/Versions | 1 + sysdeps/unix/sysv/linux/futimens.c | 38 ++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/io/futimens.c b/io/futimens.c index 27fc1ae6ef..516e64efde 100644 --- a/io/futimens.c +++ b/io/futimens.c @@ -21,6 +21,7 @@ #include #include #include +#include /* Change the access time of the file associated with FD to TSP[0] and @@ -32,3 +33,11 @@ futimens (int fd, const struct timespec tsp[2]) return -1; } stub_warning (futimens) + +int +__futimens64 (int fd, const struct __timespec64 tsp[2]) +{ + __set_errno (ENOSYS); + return -1; +} +stub_warning (__futimens64) diff --git a/sysdeps/unix/sysv/linux/arm/Versions b/sysdeps/unix/sysv/linux/arm/Versions index fd94c63672..08dfae2b61 100644 --- a/sysdeps/unix/sysv/linux/arm/Versions +++ b/sysdeps/unix/sysv/linux/arm/Versions @@ -33,5 +33,6 @@ libc { __clock_settime64; __clock_getres64; __clock_nanosleep64; + __futimens64; } } diff --git a/sysdeps/unix/sysv/linux/futimens.c b/sysdeps/unix/sysv/linux/futimens.c index b4985e034c..64f1a35663 100644 --- a/sysdeps/unix/sysv/linux/futimens.c +++ b/sysdeps/unix/sysv/linux/futimens.c @@ -36,3 +36,41 @@ futimens (int fd, const struct timespec tsp[2]) /* Avoid implicit array coercion in syscall macros. */ return INLINE_SYSCALL (utimensat, 4, fd, NULL, &tsp[0], 0); } + +/* 64-bit time version */ + +extern int __y2038_linux_support; + +int +__futimens64 (int fd, const struct __timespec64 tsp[2]) +{ + struct __timespec64 ts64[2]; + struct timespec ts32[2]; + + if (fd < 0) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EBADF); + + if (__y2038_linux_support) + { + if (fd < 0) + return INLINE_SYSCALL_ERROR_RETURN_VALUE (EBADF); + ts64[0].tv_sec = tsp[0].tv_sec; + ts64[0].tv_nsec = tsp[0].tv_nsec; + ts64[0].tv_pad = 0; + ts64[1].tv_sec = tsp[1].tv_sec; + ts64[1].tv_nsec = tsp[1].tv_nsec; + ts64[1].tv_pad = 0; + return INLINE_SYSCALL (utimensat64, 4, fd, NULL, &ts64[0], 0); + } + + if (tsp[0].tv_sec > INT_MAX || tsp[1].tv_sec > INT_MAX) + { + return EOVERFLOW; + } + + ts32[0].tv_sec = tsp[0].tv_sec; + ts32[0].tv_nsec = tsp[0].tv_nsec; + ts32[1].tv_sec = tsp[1].tv_sec; + ts32[1].tv_nsec = tsp[1].tv_nsec; + return INLINE_SYSCALL (utimensat, 4, fd, NULL, &ts32[0], 0); +}