about summary refs log tree commit diff
path: root/sysdeps/mach
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-14 17:44:57 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-06-14 17:45:04 +0000
commitc1dcc541131bb090ddc792139545ffcd2511a1dc (patch)
treef062f6c64a1acf12c1ddda32bbd197083c424c0d /sysdeps/mach
parent0c46891442c0b4ca593691f62ad1213e022ff00b (diff)
downloadglibc-c1dcc541131bb090ddc792139545ffcd2511a1dc.tar.gz
glibc-c1dcc541131bb090ddc792139545ffcd2511a1dc.tar.xz
glibc-c1dcc541131bb090ddc792139545ffcd2511a1dc.zip
hurd: Fix __writev_nocancel_nostatus
* sysdeps/mach/hurd/Makefile [subdir=misc] (sysdep_routines): Add
writev_nocancel writev_nocancel_nostatus.
* sysdeps/mach/hurd/not-cancel.h (__writev_nocancel_nostatus): Replace
macro with function declaration (with hidden prototype in libc).
(__writev_nocancel): New function declaration (with hidden prototype in libc).
* sysdeps/mach/hurd/writev_nocancel_nostatus.c: New file.
* sysdeps/posix/writev_nocancel.c: New file, includes writev.c to make a
nocancel variant that calls __write_nocancel.
* sysdeps/posix/writev.c (writev): Do not define alias if __writev is
renamed.
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/Makefile4
-rw-r--r--sysdeps/mach/hurd/not-cancel.h10
-rw-r--r--sysdeps/mach/hurd/writev_nocancel_nostatus.c28
3 files changed, 40 insertions, 2 deletions
diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile
index 8b74d3f002..daa69c0dae 100644
--- a/sysdeps/mach/hurd/Makefile
+++ b/sysdeps/mach/hurd/Makefile
@@ -200,6 +200,10 @@ sysdep_routines += f_setlk close_nocancel_nostatus read_nocancel \
 		   pread64_nocancel write_nocancel pwrite64_nocancel
 endif
 
+ifeq (misc, $(subdir))
+sysdep_routines += writev_nocancel writev_nocancel_nostatus
+endif
+
 ifeq ($(subdir),sunrpc)
 sysdep_headers += nfs/nfs.h
 endif
diff --git a/sysdeps/mach/hurd/not-cancel.h b/sysdeps/mach/hurd/not-cancel.h
index d2c3e20019..202dca8792 100644
--- a/sysdeps/mach/hurd/not-cancel.h
+++ b/sysdeps/mach/hurd/not-cancel.h
@@ -54,8 +54,12 @@ __typeof (__write) __write_nocancel;
 /* Non cancellable pwrite syscall (LFS version).  */
 __typeof (__pwrite64) __pwrite64_nocancel;
 
-#define __writev_nocancel_nostatus(fd, iov, n) \
-  (void) __writev (fd, iov, n)
+/* Non cancellable writev syscall.  */
+__typeof (__writev) __writev_nocancel;
+
+/* Non cancellable writev syscall with no status.  */
+void __writev_nocancel_nostatus (int fd, const struct iovec *vector, int count);
+
 # define __waitpid_nocancel(pid, stat_loc, options) \
   __waitpid (pid, stat_loc, options)
 #define __fcntl64_nocancel(fd, cmd, ...) \
@@ -66,6 +70,8 @@ hidden_proto (__read_nocancel)
 hidden_proto (__pread64_nocancel)
 hidden_proto (__write_nocancel)
 hidden_proto (__pwrite64_nocancel)
+hidden_proto (__writev_nocancel)
+hidden_proto (__writev_nocancel_nostatus)
 hidden_proto (__close_nocancel_nostatus)
 #endif
 
diff --git a/sysdeps/mach/hurd/writev_nocancel_nostatus.c b/sysdeps/mach/hurd/writev_nocancel_nostatus.c
new file mode 100644
index 0000000000..6db24d1b53
--- /dev/null
+++ b/sysdeps/mach/hurd/writev_nocancel_nostatus.c
@@ -0,0 +1,28 @@
+/* Copyright (C) 1991-2020 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
+   <https://www.gnu.org/licenses/>.  */
+
+#include <errno.h>
+#include <not-cancel.h>
+
+void
+__writev_nocancel_nostatus (int fd, const struct iovec *vector, int count)
+{
+  int save = errno;
+  __writev_nocancel (fd, vector, count);
+  __set_errno (save);
+}
+libc_hidden_weak (__writev_nocancel_nostatus)