|
|
5f7b84 |
commit fed33b0fb03d1942a6713286176d42869c0f1580
|
|
|
5f7b84 |
Author: Leandro Pereira <leandro.pereira@microsoft.com>
|
|
|
5f7b84 |
Date: Wed Oct 2 12:42:28 2019 -0400
|
|
|
5f7b84 |
|
|
|
5f7b84 |
Add nocancel version of pread64()
|
|
|
5f7b84 |
|
|
|
5f7b84 |
This is in preparation for changes in the dynamic linker so that
|
|
|
5f7b84 |
pread() is used instead of lseek()+read().
|
|
|
5f7b84 |
|
|
|
5f7b84 |
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
|
5f7b84 |
|
|
|
5f7b84 |
Conflicts:
|
|
|
5f7b84 |
sysdeps/unix/sysv/linux/Makefile
|
|
|
5f7b84 |
(Textual conflict in routines list.)
|
|
|
5f7b84 |
|
|
|
5f7b84 |
diff --git a/sysdeps/generic/not-cancel.h b/sysdeps/generic/not-cancel.h
|
|
|
5f7b84 |
index d9f8a75dbda85ed5..260e6e4081f5fe16 100644
|
|
|
5f7b84 |
--- a/sysdeps/generic/not-cancel.h
|
|
|
5f7b84 |
+++ b/sysdeps/generic/not-cancel.h
|
|
|
5f7b84 |
@@ -41,6 +41,8 @@
|
|
|
5f7b84 |
(void) __close (fd)
|
|
|
5f7b84 |
#define __read_nocancel(fd, buf, n) \
|
|
|
5f7b84 |
__read (fd, buf, n)
|
|
|
5f7b84 |
+#define __pread64_nocancel(fd, buf, count, offset) \
|
|
|
5f7b84 |
+ __pread64 (fd, buf, count, offset)
|
|
|
5f7b84 |
#define __write_nocancel(fd, buf, n) \
|
|
|
5f7b84 |
__write (fd, buf, n)
|
|
|
5f7b84 |
#define __writev_nocancel_nostatus(fd, iov, n) \
|
|
|
5f7b84 |
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
|
|
|
5f7b84 |
index 773aaea0e980bdd6..fb4ccd63ddec7eca 100644
|
|
|
5f7b84 |
--- a/sysdeps/unix/sysv/linux/Makefile
|
|
|
5f7b84 |
+++ b/sysdeps/unix/sysv/linux/Makefile
|
|
|
5f7b84 |
@@ -174,7 +174,8 @@ sysdep_routines += xstatconv internal_statvfs internal_statvfs64 \
|
|
|
5f7b84 |
close_nocancel fcntl_nocancel nanosleep_nocancel \
|
|
|
5f7b84 |
open_nocancel open64_nocancel \
|
|
|
5f7b84 |
openat_nocancel openat64_nocancel \
|
|
|
5f7b84 |
- pause_nocancel read_nocancel waitpid_nocancel write_nocancel
|
|
|
5f7b84 |
+ pause_nocancel read_nocancel pread64_nocancel \
|
|
|
5f7b84 |
+ waitpid_nocancel write_nocancel
|
|
|
5f7b84 |
|
|
|
5f7b84 |
sysdep_headers += bits/fcntl-linux.h
|
|
|
5f7b84 |
|
|
|
5f7b84 |
diff --git a/sysdeps/unix/sysv/linux/Versions b/sysdeps/unix/sysv/linux/Versions
|
|
|
5f7b84 |
index 336c13b57dba727a..95759bead1b0b3ca 100644
|
|
|
5f7b84 |
--- a/sysdeps/unix/sysv/linux/Versions
|
|
|
5f7b84 |
+++ b/sysdeps/unix/sysv/linux/Versions
|
|
|
5f7b84 |
@@ -176,6 +176,7 @@ libc {
|
|
|
5f7b84 |
__syscall_rt_sigqueueinfo;
|
|
|
5f7b84 |
__open_nocancel;
|
|
|
5f7b84 |
__read_nocancel;
|
|
|
5f7b84 |
+ __pread64_nocancel;
|
|
|
5f7b84 |
__close_nocancel;
|
|
|
5f7b84 |
__sigtimedwait;
|
|
|
5f7b84 |
# functions used by nscd
|
|
|
5f7b84 |
diff --git a/sysdeps/unix/sysv/linux/not-cancel.h b/sysdeps/unix/sysv/linux/not-cancel.h
|
|
|
5f7b84 |
index 09de92dee9437d98..e58db475682a8c6a 100644
|
|
|
5f7b84 |
--- a/sysdeps/unix/sysv/linux/not-cancel.h
|
|
|
5f7b84 |
+++ b/sysdeps/unix/sysv/linux/not-cancel.h
|
|
|
5f7b84 |
@@ -43,6 +43,9 @@ __typeof (openat64) __openat64_nocancel;
|
|
|
5f7b84 |
/* Non cancellable read syscall. */
|
|
|
5f7b84 |
__typeof (__read) __read_nocancel;
|
|
|
5f7b84 |
|
|
|
5f7b84 |
+/* Non cancellable pread syscall (LFS version). */
|
|
|
5f7b84 |
+__typeof (__pread64) __pread64_nocancel;
|
|
|
5f7b84 |
+
|
|
|
5f7b84 |
/* Uncancelable write. */
|
|
|
5f7b84 |
__typeof (__write) __write_nocancel;
|
|
|
5f7b84 |
|
|
|
5f7b84 |
@@ -84,6 +87,7 @@ hidden_proto (__open64_nocancel)
|
|
|
5f7b84 |
hidden_proto (__openat_nocancel)
|
|
|
5f7b84 |
hidden_proto (__openat64_nocancel)
|
|
|
5f7b84 |
hidden_proto (__read_nocancel)
|
|
|
5f7b84 |
+hidden_proto (__pread64_nocancel)
|
|
|
5f7b84 |
hidden_proto (__write_nocancel)
|
|
|
5f7b84 |
hidden_proto (__close_nocancel)
|
|
|
5f7b84 |
hidden_proto (__waitpid_nocancel)
|
|
|
5f7b84 |
diff --git a/sysdeps/unix/sysv/linux/pread64_nocancel.c b/sysdeps/unix/sysv/linux/pread64_nocancel.c
|
|
|
5f7b84 |
new file mode 100644
|
|
|
5f7b84 |
index 0000000000000000..dab61260e5db43b5
|
|
|
5f7b84 |
--- /dev/null
|
|
|
5f7b84 |
+++ b/sysdeps/unix/sysv/linux/pread64_nocancel.c
|
|
|
5f7b84 |
@@ -0,0 +1,32 @@
|
|
|
5f7b84 |
+/* Linux pread64() syscall implementation -- non-cancellable.
|
|
|
5f7b84 |
+ Copyright (C) 2019 Free Software Foundation, Inc.
|
|
|
5f7b84 |
+ This file is part of the GNU C Library.
|
|
|
5f7b84 |
+
|
|
|
5f7b84 |
+ The GNU C Library is free software; you can redistribute it and/or
|
|
|
5f7b84 |
+ modify it under the terms of the GNU Lesser General Public
|
|
|
5f7b84 |
+ License as published by the Free Software Foundation; either
|
|
|
5f7b84 |
+ version 2.1 of the License, or (at your option) any later version.
|
|
|
5f7b84 |
+
|
|
|
5f7b84 |
+ The GNU C Library is distributed in the hope that it will be useful,
|
|
|
5f7b84 |
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
5f7b84 |
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
5f7b84 |
+ Lesser General Public License for more details.
|
|
|
5f7b84 |
+
|
|
|
5f7b84 |
+ You should have received a copy of the GNU Lesser General Public
|
|
|
5f7b84 |
+ License along with the GNU C Library; if not, see
|
|
|
5f7b84 |
+ <http://www.gnu.org/licenses/>. */
|
|
|
5f7b84 |
+
|
|
|
5f7b84 |
+#include <unistd.h>
|
|
|
5f7b84 |
+#include <sysdep-cancel.h>
|
|
|
5f7b84 |
+#include <not-cancel.h>
|
|
|
5f7b84 |
+
|
|
|
5f7b84 |
+#ifndef __NR_pread64
|
|
|
5f7b84 |
+# define __NR_pread64 __NR_pread
|
|
|
5f7b84 |
+#endif
|
|
|
5f7b84 |
+
|
|
|
5f7b84 |
+ssize_t
|
|
|
5f7b84 |
+__pread64_nocancel (int fd, void *buf, size_t count, off64_t offset)
|
|
|
5f7b84 |
+{
|
|
|
5f7b84 |
+ return INLINE_SYSCALL_CALL (pread64, fd, buf, count, SYSCALL_LL64_PRW (offset));
|
|
|
5f7b84 |
+}
|
|
|
5f7b84 |
+hidden_def (__pread64_nocancel)
|