]> sourceware.org Git - glibc.git/commitdiff
Add nocancel version of pread64()
authorLeandro Pereira <leandro.pereira@microsoft.com>
Wed, 2 Oct 2019 16:42:28 +0000 (12:42 -0400)
committerCarlos O'Donell <carlos@redhat.com>
Fri, 18 Oct 2019 19:55:33 +0000 (15:55 -0400)
This is in preparation for changes in the dynamic linker so that
pread() is used instead of lseek()+read().

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
ChangeLog.old/ChangeLog.19
sysdeps/generic/not-cancel.h
sysdeps/unix/sysv/linux/Makefile
sysdeps/unix/sysv/linux/Versions
sysdeps/unix/sysv/linux/not-cancel.h
sysdeps/unix/sysv/linux/pread64_nocancel.c [new file with mode: 0644]

index be1ab6469e9a07db6abfc4fd5f568213a50f7027..0f2b72ff238b991e0615872b351fe17e8e939b7c 100644 (file)
@@ -1,7 +1,3 @@
-2019-10-11  Florian Weimer  <fweimer@redhat.com>
-
-       * manual/startup.texi (Aborting a Program): Remove warning.
-
 2019-10-10  Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
        [BZ #18231]
        (test_memset): Likewise.
 
 2019-10-02  Ćukasz Majewski <lukma@denx.de>
+
        * include/time.h: Add #include <bits/types/struct_timeval.h>
 
 2019-10-02  Paul A. Clarke  <pc@us.ibm.com>
index 968f81279faf83ff6ed00dcd80b269c21cba20a5..5df48f3da7413542ad85848dc2c082f117b762b0 100644 (file)
@@ -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) \
index 0e09d61a7a2b7d168a6079a6cdf3bef677f6156e..bbab8f8cc3b160aa116854cc55fb1091295912f9 100644 (file)
@@ -215,8 +215,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
 
index 1ca102a9e2ed9c2bcf7a56d583e3bea6f86b81a7..d385085c611aabe4e3104c9836a9c5c66f0334d2 100644 (file)
@@ -182,6 +182,7 @@ libc {
     __syscall_rt_sigqueueinfo;
     __open_nocancel;
     __read_nocancel;
+    __pread64_nocancel;
     __close_nocancel;
     __sigtimedwait;
     # functions used by nscd
index 95da1544b66c24d04b84d4c0704d5409f6100f27..041fd00111afc55320a85db8954cc530eec0f2d5 100644 (file)
@@ -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 (file)
index 0000000..dab6126
--- /dev/null
@@ -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
+   <http://www.gnu.org/licenses/>.  */
+
+#include <unistd.h>
+#include <sysdep-cancel.h>
+#include <not-cancel.h>
+
+#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)
This page took 0.074619 seconds and 5 git commands to generate.