diff options
| author | John Polstra <jdp@FreeBSD.org> | 1999-11-18 03:01:06 +0000 |
|---|---|---|
| committer | John Polstra <jdp@FreeBSD.org> | 1999-11-18 03:01:06 +0000 |
| commit | e2e3d0a401f5e0cfcf049dc6063cc7f9f9407426 (patch) | |
| tree | 1ea3f99b25d3246b7e2c966bb5e32cec83f0760a /lib/libc | |
| parent | 1815eed869e8880e3460fe5ca25fbaf00b07a145 (diff) | |
Notes
Diffstat (limited to 'lib/libc')
| -rw-r--r-- | lib/libc/rpc/svc_tcp.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c index b0aafbfe745b..90e37a00dfab 100644 --- a/lib/libc/rpc/svc_tcp.c +++ b/lib/libc/rpc/svc_tcp.c @@ -49,6 +49,7 @@ static char *rcsid = "$FreeBSD$"; #include <string.h> #include <rpc/rpc.h> #include <sys/socket.h> +#include <sys/ioctl.h> #include <errno.h> /* @@ -131,6 +132,7 @@ svctcp_create(sock, sendsize, recvsize) register struct tcp_rendezvous *r; struct sockaddr_in addr; int len = sizeof(struct sockaddr_in); + int on; if (sock == RPC_ANYSOCK) { if ((sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { @@ -139,6 +141,13 @@ svctcp_create(sock, sendsize, recvsize) } madesock = TRUE; } + on = 1; + if (ioctl(sock, FIONBIO, &on) < 0) { + perror("svc_tcp.c - cannot turn on non-blocking mode"); + if (madesock) + (void)close(sock); + return ((SVCXPRT *)NULL); + } memset(&addr, 0, sizeof (addr)); addr.sin_len = sizeof(struct sockaddr_in); addr.sin_family = AF_INET; @@ -233,6 +242,7 @@ rendezvous_request(xprt) struct tcp_rendezvous *r; struct sockaddr_in addr; int len; + int off; r = (struct tcp_rendezvous *)xprt->xp_p1; again: @@ -251,6 +261,14 @@ rendezvous_request(xprt) return (FALSE); } /* + * The listening socket is in FIONBIO mode and we inherit it. + */ + off = 0; + if (ioctl(sock, FIONBIO, &off) < 0) { + close(sock); + return (FALSE); + } + /* * make a new transporter (re-uses xprt) */ xprt = makefd_xprt(sock, r->sendsize, r->recvsize); |
