From patchwork Mon Aug 10 13:01:29 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Schwab X-Patchwork-Id: 8112 Received: (qmail 96415 invoked by alias); 10 Aug 2015 13:01:34 -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 96405 invoked by uid 89); 10 Aug 2015 13:01:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx2.suse.de From: Andreas Schwab To: libc-alpha@sourceware.org Subject: [PATCH] Readd O_LARGEFILE flag for openat64 X-Yow: I'm having fun HITCHHIKING to CINCINNATI or FAR ROCKAWAY!! Date: Mon, 10 Aug 2015 15:01:29 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 This was broken by commit c6bb095. Andreas. [BZ #18781] * sysdeps/unix/sysv/linux/openat.c (__OPENAT) [MORE_OFLAGS]: Add MORE_OFLAGS to oflag. * io/test-lfs.c (do_test): Test openat64. --- io/test-lfs.c | 21 ++++++++++++++++++++- sysdeps/unix/sysv/linux/openat.c | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/io/test-lfs.c b/io/test-lfs.c index 539c2a2..457e16a 100644 --- a/io/test-lfs.c +++ b/io/test-lfs.c @@ -144,7 +144,7 @@ test_ftello (void) int do_test (int argc, char *argv[]) { - int ret; + int ret, fd2; struct stat64 statbuf; ret = lseek64 (fd, TWO_GB+100, SEEK_SET); @@ -195,6 +195,25 @@ do_test (int argc, char *argv[]) error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.", (long long int) statbuf.st_size, (TWO_GB + 100 + 5)); + fd2 = openat64 (AT_FDCWD, name, O_RDWR); + if (fd2 == -1) + { + if (errno == ENOSYS) + { + /* Silently ignore this test. */ + error (0, 0, "openat64 is not supported"); + } + else + error (EXIT_FAILURE, errno, "openat64 failed to open big file"); + } + else + { + ret = close (fd2); + + if (ret == -1) + error (EXIT_FAILURE, errno, "error closing file"); + } + test_ftello (); return 0; diff --git a/sysdeps/unix/sysv/linux/openat.c b/sysdeps/unix/sysv/linux/openat.c index 6777123..ad8e31d 100644 --- a/sysdeps/unix/sysv/linux/openat.c +++ b/sysdeps/unix/sysv/linux/openat.c @@ -68,6 +68,11 @@ __OPENAT (int fd, const char *file, int oflag, ...) va_end (arg); } + /* We have to add the O_LARGEFILE flag for openat64. */ +#ifdef MORE_OFLAGS + oflag |= MORE_OFLAGS; +#endif + return SYSCALL_CANCEL (openat, fd, file, oflag, mode); } libc_hidden_def (__OPENAT)