From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 93578 invoked by alias); 17 Jan 2020 14:05:03 -0000 Mailing-List: contact libc-stable-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Archive: Sender: libc-stable-owner@sourceware.org Received: (qmail 93487 invoked by uid 89); 17 Jan 2020 14:05:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-18.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=Non, Versions, sk:waitpid X-Spam-Status: No, score=-18.7 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_SHORT,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: us-smtp-1.mimecast.com Received: from us-smtp-delivery-1.mimecast.com (HELO us-smtp-1.mimecast.com) (205.139.110.120) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Jan 2020 14:04:45 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579269883; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qXXYOUbAKtdTcn4ck6IvocYB09HpIyXBCTVnHF6YFM0=; b=XgZ6zYE42a8n75z1y9ZXrCSfatzGHti106NkGedQ0jK/LkFJj5TwOf2clDcmMnBGPY3q9U 6MT6ZIo82j6toJQoehwXudNOKl1FAcdKrhM2VOtjmJfYEZfrSDfLWiUkLkw2Hk+DbwmqQU Tu5c16r6GjhoNUVuzhu8E0jhRDsR9+g= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-272-yywcBxSWOm2uVK3lGeeTuQ-1; Fri, 17 Jan 2020 09:04:42 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B26908017CC for ; Fri, 17 Jan 2020 14:04:41 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-117-165.ams2.redhat.com [10.36.117.165]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8638380F40 for ; Fri, 17 Jan 2020 14:04:41 +0000 (UTC) Received: by oldenburg2.str.redhat.com (Postfix, from userid 1000) id 1E63E8299EE2; Fri, 17 Jan 2020 15:04:40 +0100 (CET) Date: Wed, 01 Jan 2020 00:00:00 -0000 To: libc-stable@sourceware.org Subject: [2.30 COMMITTED] Add nocancel version of pread64() User-Agent: Heirloom mailx 12.5 7/5/10 MIME-Version: 1.0 Message-Id: <20200117140440.1E63E8299EE2@oldenburg2.str.redhat.com> From: Florian Weimer X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: yywcBxSWOm2uVK3lGeeTuQ-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00009.txt.bz2 From: Leandro Pereira This is in preparation for changes in the dynamic linker so that pread() is used instead of lseek()+read(). Reviewed-by: Carlos O'Donell (cherry picked from commit fed33b0fb03d1942a6713286176d42869c0f1580) diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h index f3d862651e..724c3e5e71 100644 --- a/sysdeps/generic/not-cancel.h +++ b/sysdeps/generic/not-cancel.h @@ -41,6 +41,8 @@ (void) __close (fd) #define __read_nocancel(fd, buf, n) \ __read (fd, buf, n) +#define __pread64_nocancel(fd, buf, count, offset) \ + __pread64 (fd, buf, count, offset) #define __write_nocancel(fd, buf, n) \ __write (fd, buf, n) #define __writev_nocancel_nostatus(fd, iov, n) \ diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 1ab6bcbfc8..a7980a60f6 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -212,8 +212,8 @@ sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \ close_nocancel fcntl_nocancel nanosleep_nocancel \ open_nocancel open64_nocancel \ openat_nocancel openat64_nocancel \ - pause_nocancel read_nocancel waitpid_nocancel \ - write_nocancel statx_cp + pause_nocancel read_nocancel pread64_nocancel \ + waitpid_nocancel write_nocancel statx_cp sysdep_headers += bits/fcntl-linux.h diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions index 1ca102a9e2..d385085c61 100644 --- a/sysdeps/unix/sysv/linux/Versions +++ b/sysdeps/unix/sysv/linux/Versions @@ -182,6 +182,7 @@ libc { __syscall_rt_sigqueueinfo; __open_nocancel; __read_nocancel; + __pread64_nocancel; __close_nocancel; __sigtimedwait; # functions used by nscd diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h index 16cc31cba5..bf7d80125a 100644 --- a/sysdeps/unix/sysv/linux/not-cancel.h +++ b/sysdeps/unix/sysv/linux/not-cancel.h @@ -43,6 +43,9 @@ __typeof (openat64) __openat64_nocancel; /* Non cancellable read syscall. */ __typeof (__read) __read_nocancel; +/* Non cancellable pread syscall (LFS version). */ +__typeof (__pread64) __pread64_nocancel; + /* Uncancelable write. */ __typeof (__write) __write_nocancel; @@ -84,6 +87,7 @@ hidden_proto (__open64_nocancel) hidden_proto (__openat_nocancel) hidden_proto (__openat64_nocancel) hidden_proto (__read_nocancel) +hidden_proto (__pread64_nocancel) hidden_proto (__write_nocancel) hidden_proto (__close_nocancel) hidden_proto (__waitpid_nocancel) diff --git a/sysdeps/unix/sysv/linux/pread64_nocancel.c b/sysdeps/unix/sysv/linux/pread64_nocancel.c new file mode 100644 index 0000000000..dab61260e5 --- /dev/null +++ b/sysdeps/unix/sysv/linux/pread64_nocancel.c @@ -0,0 +1,32 @@ +/* Linux pread64() syscall implementation -- non-cancellable. + Copyright (C) 2019 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + 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 + +#ifndef __NR_pread64 +# define __NR_pread64 __NR_pread +#endif + +ssize_t +__pread64_nocancel (int fd, void *buf, size_t count, off64_t offset) +{ + return INLINE_SYSCALL_CALL (pread64, fd, buf, count, SYSCALL_LL64_PRW (offset)); +} +hidden_def (__pread64_nocancel)