From patchwork Wed Dec 29 05:10:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stafford Horne X-Patchwork-Id: 49373 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 DFEBB385843E for ; Wed, 29 Dec 2021 05:11:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DFEBB385843E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1640754674; bh=0BfHTRXz9oPsforRzozuFD6Sn6gsc46v1LAIEvJSnRk=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=sSqfWGJMA0hQeaRhb9mD7A8OICYtKdN0eIWi2GiS97i+wHkqGZZYfN/nMk7ju4gP0 dXPFdzQytj3wMgXiReuSYJ2rdJpj7EsVHQcpM94M+NwMQMQCgnoI3zNAxCe+jOwHsw K88NUGec6q/mXAgQOYqEBT3dNY1Oj28G3gFew58w= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by sourceware.org (Postfix) with ESMTPS id 2EDDF3858D39 for ; Wed, 29 Dec 2021 05:10:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2EDDF3858D39 Received: by mail-pf1-x42d.google.com with SMTP id v13so17841797pfi.3 for ; Tue, 28 Dec 2021 21:10:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0BfHTRXz9oPsforRzozuFD6Sn6gsc46v1LAIEvJSnRk=; b=kLdy5eWZCiMgdq5Pv7blAAF/v/ZIEHwB0ASXp+0xVOPtvAe26SKyWDucGjWg0BQvKY Sc93wTJ30tyRKLMRATi7Leax37qIIAtPBLLlEfqmoLMCOeSaTPrMO2q1zXVxwD7aszps UugQ/vajC+isNO5zNeOfePxPUibWhtBYHATGYbTPhee7yYKq48ZlWVpGdo3IJcPbP4D4 VJPAMN3ND6xrKZxAfLQI6JDyBYXWcYBbnsSjUMZQZzO/c4iJo12RzLszxPEDp1tXLpPi 0ydM1Jn+dcW0m3QwiOpnMpVCDVI9LiroUwb6DBTlwTkpN8l+MC8YgqHGmqc2fqSyNlLv a/qA== X-Gm-Message-State: AOAM532PuFJ4b6+/ntgi1hMxapQN2n3Z5oqDB4dUQjMqdg+CW59ujkTG 2q1TAXEZ9Re5/TbVEFng/7BriNcPGWM= X-Google-Smtp-Source: ABdhPJzb8J62b0fpTCaX/nXth5Q3CrVUKh7Eg9kauTHpVe0y1k/0JrkuhP2kz+e4T/0tY1UWo8NXVw== X-Received: by 2002:a63:82c2:: with SMTP id w185mr21989162pgd.390.1640754652829; Tue, 28 Dec 2021 21:10:52 -0800 (PST) Received: from localhost ([2409:10:24a0:4700:e8ad:216a:2a9d:6d0c]) by smtp.gmail.com with ESMTPSA id t191sm18887194pgd.3.2021.12.28.21.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Dec 2021 21:10:52 -0800 (PST) To: GLIBC patches Subject: [PATCH v2] open64: Force O_LARGEFILE on all architectures Date: Wed, 29 Dec 2021 14:10:36 +0900 Message-Id: <20211229051036.2245590-1-shorne@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Stafford Horne via Libc-alpha From: Stafford Horne Reply-To: Stafford Horne Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" When running tests on OpenRISC which has 32-bit wordsize but 64-bit timesize it was found that O_LARGEFILE is not being set when calling open64. For 64-bit architectures the O_LARGEFILE flag is generally implied by the kernel according to force_o_largefile. However, for 32-bit architectures this is not done. For this patch we unconditionally now set the O_LARGEFILE flag for open64 class syscalls as there is no harm in doing so. Tested on the OpenRISC the build works and timezone/tst-tzset passes which was failing before. I would expect this also would fix arc. Reviewed-by: Adhemerval Zanella --- Changes since v1: - Replace ifdef with just using O_LARGEFILE in all cases as discussed with Adhemerval. sysdeps/unix/sysv/linux/open64.c | 9 +-------- sysdeps/unix/sysv/linux/open64_nocancel.c | 8 +------- sysdeps/unix/sysv/linux/openat64.c | 8 +------- sysdeps/unix/sysv/linux/openat64_nocancel.c | 8 +------- 4 files changed, 4 insertions(+), 29 deletions(-) diff --git a/sysdeps/unix/sysv/linux/open64.c b/sysdeps/unix/sysv/linux/open64.c index 0904696973..8e2eb0bad8 100644 --- a/sysdeps/unix/sysv/linux/open64.c +++ b/sysdeps/unix/sysv/linux/open64.c @@ -23,13 +23,6 @@ #include #include - -#ifdef __OFF_T_MATCHES_OFF64_T -# define EXTRA_OPEN_FLAGS 0 -#else -# define EXTRA_OPEN_FLAGS O_LARGEFILE -#endif - /* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG, a third argument is the file protection. */ int @@ -45,7 +38,7 @@ __libc_open64 (const char *file, int oflag, ...) va_end (arg); } - return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | EXTRA_OPEN_FLAGS, + return SYSCALL_CANCEL (openat, AT_FDCWD, file, oflag | O_LARGEFILE, mode); } diff --git a/sysdeps/unix/sysv/linux/open64_nocancel.c b/sysdeps/unix/sysv/linux/open64_nocancel.c index d7f35656a1..a270891dc8 100644 --- a/sysdeps/unix/sysv/linux/open64_nocancel.c +++ b/sysdeps/unix/sysv/linux/open64_nocancel.c @@ -23,12 +23,6 @@ #include -#ifdef __OFF_T_MATCHES_OFF64_T -# define EXTRA_OPEN_FLAGS 0 -#else -# define EXTRA_OPEN_FLAGS O_LARGEFILE -#endif - int __open64_nocancel (const char *file, int oflag, ...) { @@ -42,7 +36,7 @@ __open64_nocancel (const char *file, int oflag, ...) va_end (arg); } - return INLINE_SYSCALL_CALL (openat, AT_FDCWD, file, oflag | EXTRA_OPEN_FLAGS, + return INLINE_SYSCALL_CALL (openat, AT_FDCWD, file, oflag | O_LARGEFILE, mode); } diff --git a/sysdeps/unix/sysv/linux/openat64.c b/sysdeps/unix/sysv/linux/openat64.c index dc226567c1..9019d2b48f 100644 --- a/sysdeps/unix/sysv/linux/openat64.c +++ b/sysdeps/unix/sysv/linux/openat64.c @@ -21,12 +21,6 @@ #include -#ifdef __OFF_T_MATCHES_OFF64_T -# define EXTRA_OPEN_FLAGS 0 -#else -# define EXTRA_OPEN_FLAGS O_LARGEFILE -#endif - /* Open FILE with access OFLAG. Interpret relative paths relative to the directory associated with FD. If OFLAG includes O_CREAT or O_TMPFILE, a fourth argument is the file protection. */ @@ -42,7 +36,7 @@ __libc_openat64 (int fd, const char *file, int oflag, ...) va_end (arg); } - return SYSCALL_CANCEL (openat, fd, file, oflag | EXTRA_OPEN_FLAGS, mode); + return SYSCALL_CANCEL (openat, fd, file, oflag | O_LARGEFILE, mode); } strong_alias (__libc_openat64, __openat64) diff --git a/sysdeps/unix/sysv/linux/openat64_nocancel.c b/sysdeps/unix/sysv/linux/openat64_nocancel.c index 51377aea45..b9c0d98770 100644 --- a/sysdeps/unix/sysv/linux/openat64_nocancel.c +++ b/sysdeps/unix/sysv/linux/openat64_nocancel.c @@ -22,12 +22,6 @@ #include #include -#ifdef __OFF_T_MATCHES_OFF64_T -# define EXTRA_OPEN_FLAGS 0 -#else -# define EXTRA_OPEN_FLAGS O_LARGEFILE -#endif - int __openat64_nocancel (int fd, const char *file, int oflag, ...) { @@ -40,7 +34,7 @@ __openat64_nocancel (int fd, const char *file, int oflag, ...) va_end (arg); } - return INLINE_SYSCALL_CALL (openat, fd, file, oflag | EXTRA_OPEN_FLAGS, + return INLINE_SYSCALL_CALL (openat, fd, file, oflag | O_LARGEFILE, mode); } hidden_def (__openat64_nocancel)