From patchwork Tue May 2 14:33:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 98449 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1904034qgf; Tue, 2 May 2017 07:34:00 -0700 (PDT) X-Received: by 10.98.107.73 with SMTP id g70mr33049880pfc.22.1493735640570; Tue, 02 May 2017 07:34:00 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id y3si18037417pgc.222.2017.05.02.07.34.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 07:34:00 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-78995-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-78995-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-78995-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:subject:date:message-id; q=dns; s= default; b=oKUh5dJcOgAloe1N5pDiW9bJ89mBuna8Bcd4Zrj8Eo1HoWnZIiPG8 vJCs+7XymIGWe5QM3Qtk/56h3Y0cIQC7Qa5X5mlRTyBzmU0NYX4L1dRaB34L9tel OV+GwiJR0gI8mqz4u4rSlhSSphjn1YrmoAFLTuns5l2NkWRSAqoox8= 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:subject:date:message-id; s=default; bh=ELuADAo4Mi3BhTK24FaDYCyVxtw=; b=DQG6zbfi+fWxW16tN2v5bULNEUDb kovmJWoDi4FqH+BhQ7uILLG3qELDwiQhP5j8cFf7sNWsBSrceYpWAlJJ7HyIPJuA 0J88SK9vPIjWeeaqfNkWuSZuQ/4d3dhr0hsiXsFnDaerFp2eY0IC6nckC4aCjhCJ 4te8AeX3A3Kc8Es= Received: (qmail 82207 invoked by alias); 2 May 2017 14:33:46 -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 82190 invoked by uid 89); 2 May 2017 14:33:45 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=H*p:D*org X-HELO: mail-qt0-f177.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=3NO5L3fWCvyYC8qy7sWFXVZa9IQN1cDd37jauH3vxe4=; b=t9fsn+D/crlW3UwQhBzVcqno10Eb2JhLx6L631C6kAjynwTY2VwzLkhBcU5mQJ8V2A vVoD6vILAMA8u5ID0qgOLJ/qUU18Lnm59smPB2OGiz4Cj9u1D512N93l4nL5WDr1QmLU DuXNFXNUPhXL1bbRXtKerSn+vpMXESUPeIGU9i4/sgCwRFvmhnnEtLRaXc6/WysjVe0f b3pGw4Y+NATfYpi5OTDjVzMMNbQY1SaaLeGw0OLMWnPmATDlnhYLXAofoDoQn3xXsWV1 KvQ4NDn819ESEJgSPKlL14dDehTmwL5a5EmGDWIweQO6KruL5J5UdP1caGOxOPap7eJm E/uQ== X-Gm-Message-State: AN3rC/4wRkPW9lwIqVEM+UqTQwM9CwhqdUKVtCiKRc6SO7/PNEaSJ0nF vqpojvOhatmErebkIvwz8g== X-Received: by 10.200.53.45 with SMTP id y42mr27377312qtb.136.1493735624032; Tue, 02 May 2017 07:33:44 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 1/3] posix: Fix internal p{read,write} plt usage Date: Tue, 2 May 2017 11:33:30 -0300 Message-Id: <1493735612-26045-1-git-send-email-adhemerval.zanella@linaro.org> This patch adds internal alias for __pread, __pread64, and __pwrite following the already in place one for __pwrite64. This is not used in any implementation but on microblaze on preadv/pwritev fallback (since it does not define __ASSUME_PREADV). In fact it was signaled by commit c35db50ff5 which update the expected localptl.data for the architecture based on resulted value. This patch updates the plt for microblaze now that p{read,write}{64} are correctly routed to use internal alias. Checked on x86_64-linux-gnu and a build for all supported architectures (no all variants although). * include/unistd.h (__pread): Add libc_hidden_proto. (__pread64): Likewise. (__pwrite): Likewise. * sysdeps/unix/sysv/linux/microblaze/localplt.data [libc.so] (__pread64): Remove. * sysdeps/unix/sysv/linux/pread.c (__pread64): Add libc_hidden_weak. * sysdeps/unix/sysv/linux/pread64.c (__pread64): Likewise. * sysdeps/unix/sysv/linux/pwrite.c (__pwrite): Likewise. --- ChangeLog | 9 +++++++++ include/unistd.h | 3 +++ sysdeps/unix/sysv/linux/microblaze/localplt.data | 1 - sysdeps/unix/sysv/linux/pread.c | 1 + sysdeps/unix/sysv/linux/pread64.c | 1 + sysdeps/unix/sysv/linux/pwrite.c | 1 + 6 files changed, 15 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/include/unistd.h b/include/unistd.h index 16a8815..f36759b 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -33,14 +33,17 @@ extern __off_t __libc_lseek (int __fd, __off_t __offset, int __whence); extern __off64_t __libc_lseek64 (int __fd, __off64_t __offset, int __whence); extern ssize_t __pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset); +libc_hidden_proto (__pread); extern ssize_t __libc_pread (int __fd, void *__buf, size_t __nbytes, __off_t __offset); extern ssize_t __pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset); +libc_hidden_proto (__pread64); extern ssize_t __libc_pread64 (int __fd, void *__buf, size_t __nbytes, __off64_t __offset); extern ssize_t __pwrite (int __fd, const void *__buf, size_t __n, __off_t __offset); +libc_hidden_proto (__pwrite) extern ssize_t __libc_pwrite (int __fd, const void *__buf, size_t __n, __off_t __offset); extern ssize_t __pwrite64 (int __fd, const void *__buf, size_t __n, diff --git a/sysdeps/unix/sysv/linux/microblaze/localplt.data b/sysdeps/unix/sysv/linux/microblaze/localplt.data index 4187832..a61b94d 100644 --- a/sysdeps/unix/sysv/linux/microblaze/localplt.data +++ b/sysdeps/unix/sysv/linux/microblaze/localplt.data @@ -1,5 +1,4 @@ libc.so: __errno_location -libc.so: __pread64 libc.so: calloc libc.so: free libc.so: malloc diff --git a/sysdeps/unix/sysv/linux/pread.c b/sysdeps/unix/sysv/linux/pread.c index b4f1b87..96df997 100644 --- a/sysdeps/unix/sysv/linux/pread.c +++ b/sysdeps/unix/sysv/linux/pread.c @@ -32,5 +32,6 @@ __libc_pread (int fd, void *buf, size_t count, off_t offset) } strong_alias (__libc_pread, __pread) +libc_hidden_weak (__pread) weak_alias (__libc_pread, pread) #endif diff --git a/sysdeps/unix/sysv/linux/pread64.c b/sysdeps/unix/sysv/linux/pread64.c index c7f9cb1..0c2c80e 100644 --- a/sysdeps/unix/sysv/linux/pread64.c +++ b/sysdeps/unix/sysv/linux/pread64.c @@ -30,6 +30,7 @@ __libc_pread64 (int fd, void *buf, size_t count, off64_t offset) } weak_alias (__libc_pread64, __pread64) +libc_hidden_weak (__pread64) weak_alias (__libc_pread64, pread64) #ifdef __OFF_T_MATCHES_OFF64_T diff --git a/sysdeps/unix/sysv/linux/pwrite.c b/sysdeps/unix/sysv/linux/pwrite.c index ef1bb01..ef11d8f 100644 --- a/sysdeps/unix/sysv/linux/pwrite.c +++ b/sysdeps/unix/sysv/linux/pwrite.c @@ -32,5 +32,6 @@ __libc_pwrite (int fd, const void *buf, size_t count, off_t offset) } strong_alias (__libc_pwrite, __pwrite) +libc_hidden_weak (__pwrite) weak_alias (__libc_pwrite, pwrite) #endif From patchwork Tue May 2 14:33:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 98450 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1904117qgf; Tue, 2 May 2017 07:34:13 -0700 (PDT) X-Received: by 10.99.124.69 with SMTP id l5mr34169014pgn.227.1493735653447; Tue, 02 May 2017 07:34:13 -0700 (PDT) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id i9si11147147pgn.205.2017.05.02.07.34.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 May 2017 07:34:13 -0700 (PDT) Received-SPF: pass (google.com: domain of libc-alpha-return-78996-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org; spf=pass (google.com: domain of libc-alpha-return-78996-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=libc-alpha-return-78996-patch=linaro.org@sourceware.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:subject:date:message-id:in-reply-to :references; q=dns; s=default; b=PwiToRUPJKcpKaHbsUR4O3eMvIqZzmk gn0Dh1CE1vt3Y4qi+tvp8KvWderi9QZNZ6Nj4YQefRQNh3ulV01ROlHuyw3NZlKW XE5w32/qAb5Hn8vxdlI3M6n5eom4PKzB340fSEk8pIwm/mcSgolKRcn5r/5kXVxH tstv/Kq1QcCU= 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:subject:date:message-id:in-reply-to :references; s=default; bh=q7lcogO09Dyhkf4pYD9ANPjt7TE=; b=jjPj+ d5xhqkSyq6DPY8R1JalbXKj7Qhqx9YsATqOmpv/WX0lWeQOHUYjV77fd0HO0nCGu gIZv9ySam0BeLhPPZLib5flIeMKtw/UjPprttX0ujDQ8wvka9X/qcHVpLITK2DXR yMDUu4VBvQ/Z7GybS+JPvk+eaK7oYLP+ZhckeQ= Received: (qmail 82355 invoked by alias); 2 May 2017 14:33:47 -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 82219 invoked by uid 89); 2 May 2017 14:33:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, RCVD_IN_SORBS_SPAM, SPF_PASS autolearn=ham version=3.3.2 spammy=6626 X-HELO: mail-qt0-f175.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=93WDapybS45iMSZiTjdQx7sqFn3TPzWYcetT54SrVAs=; b=hPzpvY9Q3b7XweieB/HbF8OjyiEaLt9RMyolb94+s8nLMEZYbZxsUXxvx+jNWoDpRw 0qKACAnn+jlbwNIkdGbvALdEEfNLMJVaAEpu/D8d9Iik9vCTh6jaPmax1ZGLZfdqfF/Y EPF1S3ChJ55xrbUAJqwsnDiPB2T2qtWVakwhgeZZuAsG5ZFCFe4R7vhRNGCoWe7F1Y8p Yib2l9jdRzWXdPjMAtU5drqWwwluFi4T292AJUHLXJVNku0zaDKVoZaF2IN7nr3hQHKM stFTjkprRvqQSWEjV0RxWi8pLMwGX6zNZbEQxbW7Zwh1uGw97qi7AORLfTsUXAgrPTN2 0h8A== X-Gm-Message-State: AN3rC/51/WTbmK7cSdzcwQTQ4ge6Ffuw+feTCFmVM64hs8/HKwUIDvw8 IrAgw6VN5LwMJAAS9WC0rA== X-Received: by 10.237.47.164 with SMTP id m33mr26974424qtd.231.1493735625404; Tue, 02 May 2017 07:33:45 -0700 (PDT) From: Adhemerval Zanella To: libc-alpha@sourceware.org Subject: [PATCH 2/3] manual: Add preadv and pwritev documentation Date: Tue, 2 May 2017 11:33:31 -0300 Message-Id: <1493735612-26045-2-git-send-email-adhemerval.zanella@linaro.org> In-Reply-To: <1493735612-26045-1-git-send-email-adhemerval.zanella@linaro.org> References: <1493735612-26045-1-git-send-email-adhemerval.zanella@linaro.org> * manual/llio.texi: Add preadv and pwritev documentation. --- manual/llio.texi | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) -- 2.7.4 diff --git a/manual/llio.texi b/manual/llio.texi index 9643bcb..6187329 100644 --- a/manual/llio.texi +++ b/manual/llio.texi @@ -662,6 +662,100 @@ When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a @code{pwrite} and so transparently replaces the 32 bit interface. @end deftypefun +@comment sys/uio.h +@comment BSD +@deftypefun ssize_t preadv (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}) +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} +@c This is a syscall for Linux 3.2 for all architectures but microblaze +@c (which was added on 3.15). The sysdeps/posix fallback emulation +@c is also MT-Safe since it calls pread, and it is now a syscall on all +@c targets. + +This function is similar to the @code{readv} function, with the difference +it adds an extra @var{offset} parameter of type @code{off_t} similar to +@code{pread}. The data is written to the file starting at position +@var{offset}. The position of the file descriptor itself is not affected +by the operation. The value is the same as before the call. + +When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the +@code{preadv} function is in fact @code{preadv64} and the type +@code{off_t} has 64 bits, which makes it possible to handle files up to +@twoexp{63} bytes in length. + +The return value is a count of bytes (@emph{not} buffers) read, @math{0} +indicating end-of-file, or @math{-1} indicating an error. The possible +errors are the same as in @code{readv} and @code{pread}. +@end deftypefun + +@comment unistd.h +@comment BSD +@deftypefun ssize_t preadv64 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}) +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} +@c This is a syscall for Linux 3.2 for all architectures but microblaze +@c (which was added on 3.15). The sysdeps/posix fallback emulation +@c is also MT-Safe since it calls pread64, and it is now a syscall on all +@c targets. + +This function is similar to the @code{preadv} function with the difference +is that the @var{offset} parameter is of type @code{off64_t} instead of +@code{off_t}. It makes it possible on 32 bit machines to address +files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The +file descriptor @code{filedes} must be opened using @code{open64} since +otherwise the large offsets possible with @code{off64_t} will lead to +errors with a descriptor in small file mode. + +When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a +32 bit machine this function is actually available under the name +@code{preadv} and so transparently replaces the 32 bit interface. +@end deftypefun + +@comment sys/uio.h +@comment BSD +@deftypefun ssize_t pwritev (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off_t @var{offset}) +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} +@c This is a syscall for Linux 3.2 for all architectures but microblaze +@c (which was added on 3.15). The sysdeps/posix fallback emulation +@c is also MT-Safe since it calls pwrite, and it is now a syscall on all +@c targets. + +This function is similar to the @code{writev} function, with the difference +it adds an extra @var{offset} parameter of type @code{off_t} similar to +@code{pwrite}. The data is written to the file starting at position +@var{offset}. The position of the file descriptor itself is not affected +by the operation. The value is the same as before the call. + +When the source file is compiled with @code{_FILE_OFFSET_BITS == 64} the +@code{pwritev} function is in fact @code{pwritev64} and the type +@code{off_t} has 64 bits, which makes it possible to handle files up to +@twoexp{63} bytes in length. + +The return value is a count of bytes (@emph{not} buffers) written, @math{0} +indicating end-of-file, or @math{-1} indicating an error. The possible +errors are the same as in @code{writev} and @code{pwrite}. +@end deftypefun + +@comment unistd.h +@comment BSD +@deftypefun ssize_t pwritv64 (int @var{fd}, const struct iovec *@var{iov}, int @var{iovcnt}, off64_t @var{offset}) +@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}} +@c This is a syscall for Linux 3.2 for all architectures but microblaze +@c (which was added on 3.15). The sysdeps/posix fallback emulation +@c is also MT-Safe since it calls pwrite64, and it is now a syscall on all +@c targets. + +This function is similar to the @code{pwritev} function with the difference +is that the @var{offset} parameter is of type @code{off64_t} instead of +@code{off_t}. It makes it possible on 32 bit machines to address +files larger than @twoexp{31} bytes and up to @twoexp{63} bytes. The +file descriptor @code{filedes} must be opened using @code{open64} since +otherwise the large offsets possible with @code{off64_t} will lead to +errors with a descriptor in small file mode. + +When the source file is compiled using @code{_FILE_OFFSET_BITS == 64} on a +32 bit machine this function is actually available under the name +@code{pwritev} and so transparently replaces the 32 bit interface. +@end deftypefun + @node File Position Primitive @section Setting the File Position of a Descriptor