aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/socket.c
diff options
context:
space:
mode:
authorThomas Quinot <quinot@act-europe.fr>2004-10-04 16:49:35 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2004-10-04 16:49:35 +0200
commitd6c7ed5017ae925f18acde16f02f9a0ed2f1b960 (patch)
tree7d917cde2a4fa0a26ee9117ad99650660d705a3f /gcc/ada/socket.c
parentfded8de7d64cf357aaeb7ccb51b6e850d9557e4a (diff)
downloadgcc-d6c7ed5017ae925f18acde16f02f9a0ed2f1b960.zip
gcc-d6c7ed5017ae925f18acde16f02f9a0ed2f1b960.tar.gz
gcc-d6c7ed5017ae925f18acde16f02f9a0ed2f1b960.tar.bz2
g-socket.ads, [...]: Add new sockets constant MSG_NOSIGNAL (Linux-specific).
2004-10-04 Thomas Quinot <quinot@act-europe.fr> * g-socket.ads, g-socket.adb, g-socthi.adb, socket.c, g-soccon-aix.ads, g-soccon-irix.ads, g-soccon-hpux.ads, g-soccon-interix.ads, g-soccon-solaris.ads, g-soccon-vms.adb, g-soccon-mingw.ads, g-soccon-vxworks.ads, g-soccon-freebsd.ads, g-soccon.ads, g-soccon-unixware.ads, g-soccon-tru64.ads: Add new sockets constant MSG_NOSIGNAL (Linux-specific). Add new sockets constant MSG_Forced_Flags, list of flags to be set on all Send operations. For Linux, set MSG_NOSIGNAL on all send operations to prevent them from trigerring SIGPIPE. Rename components to avoid clash with Ada 2005 possible reserved word 'interface'. (Check_Selector): When the select system call returns with an error condition, propagate Socket_Error to the caller. From-SVN: r88485
Diffstat (limited to 'gcc/ada/socket.c')
-rw-r--r--gcc/ada/socket.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c
index 89b8163..6f5067f 100644
--- a/gcc/ada/socket.c
+++ b/gcc/ada/socket.c
@@ -64,8 +64,13 @@
#include "system.h"
#endif
+#if !(defined (VMS) || defined (__MINGW32__))
+# include <sys/socket.h>
+#endif
+
#include "raise.h"
+extern void __gnat_disable_sigpipe (int fd);
extern void __gnat_free_socket_set (fd_set *);
extern void __gnat_last_socket_in_set (fd_set *, int *);
extern void __gnat_get_socket_from_set (fd_set *, int *, int *);
@@ -74,6 +79,16 @@ extern int __gnat_is_socket_in_set (fd_set *, int);
extern fd_set *__gnat_new_socket_set (fd_set *);
extern void __gnat_remove_socket_from_set (fd_set *, int);
+/* Disable the sending of SIGPIPE for writes on a broken stream */
+void
+__gnat_disable_sigpipe (int fd)
+{
+#ifdef SO_NOSIGPIPE
+ int val = 1;
+ (void) setsockopt (fd, SOL_SOCKET, SO_NOSIGPIPE, &val, sizeof val);
+#endif
+}
+
/* Free socket set. */
void