4 #include <sys/socket.h>
6 #include <net/gen/in.h>
7 #include <net/gen/tcp.h>
8 #include <net/gen/tcp_io.h>
12 static int _tcp_shutdown(int socket
, int how
);
14 int shutdown(int socket
, int how
)
17 nwio_tcpconf_t tcpconf
;
19 r
= ioctl(socket
, NWIOGTCPCONF
, &tcpconf
);
20 if (r
!= -1 || errno
!= ENOTTY
)
24 /* Bad file descriptor */
27 return _tcp_shutdown(socket
, how
);
30 fprintf(stderr
, "shutdown: not implemented for fd %d\n", socket
);
36 static int _tcp_shutdown(int socket
, int how
)
40 if (how
== SHUT_WR
|| how
== SHUT_RDWR
)
42 r
= ioctl(socket
, NWIOTCPSHUTDOWN
, NULL
);
49 /* We can't shutdown the read side of the socket. */