f5332bf7939e6053fafd7de3801560f2b36fa9ad
[ghc-hetmet.git] / ghc / lib / misc / cbits / shutdownSocket.c
1 #if 0
2 %
3 % (c) The GRASP/AQUA Project, Glasgow University, 1996
4 %
5 \subsection[shutdownSocket.lc]{Shut down part of full duplex connection}
6
7 \begin{code}
8 #endif
9
10 #define NON_POSIX_SOURCE
11 #include "rtsdefs.h"
12 #include "ghcSockets.h"
13
14 StgInt
15 shutdownSocket(I_ sockfd, I_ how)
16 {
17     StgInt rc;
18     
19     while ((rc = shutdown((int) sockfd, (int) how)) < 0) {
20       if (errno != EINTR) {
21           cvtErrno();
22           stdErrno();
23           return -1;
24       }
25     }
26     return rc;
27 }