diff options
author | Roland McGrath <roland@gnu.org> | 1994-10-06 23:04:52 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 1994-10-06 23:04:52 +0000 |
commit | b00b44c43ccec2cbacb49a56daef7b4b4390375d (patch) | |
tree | 8f09b5db20ff3635cd6a566d56d6c239105f58f1 | |
parent | (_hurd_socket_server): Take new arg DEAD; explain its use in comment. (diff) | |
download | glibc-b00b44c43ccec2cbacb49a56daef7b4b4390375d.tar.gz glibc-b00b44c43ccec2cbacb49a56daef7b4b4390375d.tar.bz2 glibc-b00b44c43ccec2cbacb49a56daef7b4b4390375d.zip |
Pass new arg to _hurd_socket_server, cope with dead server on socket_create.
-rw-r--r-- | sysdeps/mach/hurd/pipe.c | 14 | ||||
-rw-r--r-- | sysdeps/mach/hurd/socket.c | 17 |
2 files changed, 27 insertions, 4 deletions
diff --git a/sysdeps/mach/hurd/pipe.c b/sysdeps/mach/hurd/pipe.c index 67a873ff2f..0e7a4dad67 100644 --- a/sysdeps/mach/hurd/pipe.c +++ b/sysdeps/mach/hurd/pipe.c @@ -41,13 +41,23 @@ DEFUN(__pipe, (fds), int fds[2]) return __hurd_fail (EINVAL); /* Find the local domain socket server. */ - server = _hurd_socket_server (PF_LOCAL); + server = _hurd_socket_server (PF_LOCAL, 0); if (server == MACH_PORT_NULL) return -1; /* Create two local domain sockets and connect them together. */ - if (err = __socket_create (server, SOCK_STREAM, 0, &sock1)) + err = __socket_create (server, SOCK_STREAM, 0, &sock1); + if (err == MACH_SEND_INVALID_DEST || err == MIG_SERVER_DIED) + { + /* On the first use of the socket server during the operation, + allow for the old server port dying. */ + server = _hurd_socket_server (PF_LOCAL, 1); + if (server == MACH_PORT_NULL) + return -1; + err = __socket_create (server, SOCK_STREAM, 0, &sock1); + } + if (err) return __hurd_fail (err); if (err = __socket_create (server, SOCK_STREAM, 0, &sock2)) { diff --git a/sysdeps/mach/hurd/socket.c b/sysdeps/mach/hurd/socket.c index 135ce2a09d..b779360780 100644 --- a/sysdeps/mach/hurd/socket.c +++ b/sysdeps/mach/hurd/socket.c @@ -32,12 +32,25 @@ DEFUN(socket, (domain, type, protocol), int domain AND enum __socket_type type AND int protocol) { error_t err; - socket_t sock, server = _hurd_socket_server (domain); + socket_t sock, server; + /* Find the socket server for DOMAIN. */ + server = _hurd_socket_server (domain, 0); if (server == MACH_PORT_NULL) return -1; - if (err = __socket_create (server, type, protocol, &sock)) + err = __socket_create (server, type, protocol, &sock); + if (err == MACH_SEND_INVALID_DEST || err == MIG_SERVER_DIED) + { + /* On the first use of the socket server during the operation, + allow for the old server port dying. */ + server = _hurd_socket_server (domain, 1); + if (server == MACH_PORT_NULL) + return -1; + err = __socket_create (server, type, protocol, &sock); + } + + if (err) return __hurd_fail (err); return _hurd_intern_fd (sock, O_IGNORE_CTTY, 1); |