about summary refs log tree commit diff
path: root/hurd
diff options
context:
space:
mode:
Diffstat (limited to 'hurd')
-rw-r--r--hurd/hurd/fd.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h
index 08d4407e88..d1aa867cbf 100644
--- a/hurd/hurd/fd.h
+++ b/hurd/hurd/fd.h
@@ -27,6 +27,7 @@
 
 #include <hurd/hurd_types.h>
 #include <hurd/port.h>
+#include <sys/socket.h>
 
 
 /* Structure representing a file descriptor.  */
@@ -179,6 +180,18 @@ __hurd_dfail (int fd, error_t err)
   errno = _hurd_fd_error (fd, err);
   return -1;
 }
+
+/* Likewise, but do not raise SIGPIPE on EPIPE if flags contain
+   MSG_NOSIGNAL.  */
+
+_HURD_FD_H_EXTERN_INLINE int
+__hurd_sockfail (int fd, int flags, error_t err)
+{
+  if (!(flags & MSG_NOSIGNAL) || err != EPIPE)
+    err = _hurd_fd_error (fd, err);
+  errno = err;
+  return -1;
+}
 
 /* Set up *FD to have PORT its server port, doing appropriate ctty magic.
    Does no locking or unlocking.  */