4 extern volatile Sjmp_buf gNetTimeoutJmp
;
5 extern volatile Sjmp_buf gPipeJmp
;
11 SRecvmsg(int sfd
, void *const msg
, int fl
, int tlen
)
14 vsio_sigproc_t sigalrm
, sigpipe
;
20 nread
= recvmsg(sfd
, (struct msghdr
*) msg
, fl
);
21 if ((nread
>= 0) || (errno
!= EINTR
))
26 if (SSetjmp(gNetTimeoutJmp
) != 0) {
28 (void) SSignal(SIGALRM
, (sio_sigproc_t
) sigalrm
);
29 (void) SSignal(SIGPIPE
, (sio_sigproc_t
) sigpipe
);
34 if (SSetjmp(gPipeJmp
) != 0) {
36 (void) SSignal(SIGALRM
, (sio_sigproc_t
) sigalrm
);
37 (void) SSignal(SIGPIPE
, (sio_sigproc_t
) sigpipe
);
39 return (kBrokenPipeErr
);
42 sigalrm
= (vsio_sigproc_t
) SSignal(SIGALRM
, SIOHandler
);
43 sigpipe
= (vsio_sigproc_t
) SSignal(SIGPIPE
, SIOHandler
);
47 tleft
= (int) (done
- now
);
49 (void) alarm((unsigned int) tleft
);
50 nread
= recvmsg(sfd
, (struct msghdr
*) msg
, fl
);
55 break; /* Fatal error. */
58 tleft
= (int) (done
- now
);
66 (void) SSignal(SIGALRM
, (sio_sigproc_t
) sigalrm
);
67 (void) SSignal(SIGPIPE
, (sio_sigproc_t
) sigpipe
);
72 #elif defined(HAVE_RECVMSG)
75 SRecvmsg(int sfd
, void *const msg
, int fl
, int tlen
)
86 nread
= recvmsg(sfd
, (struct msghdr
*) msg
, fl
);
87 if ((nread
>= 0) || (errno
!= EINTR
))
94 tleft
= (int) (done
- now
);
103 result
= select(sfd
+ 1, SELECT_TYPE_ARG234
&ss
, NULL
, NULL
, SELECT_TYPE_ARG5
&tv
);
107 } else if (result
== 0) {
111 return (kTimeoutErr
);
112 } else if (errno
!= EINTR
) {
117 nread
= recvmsg(sfd
, (struct msghdr
*) msg
, fl
);
122 break; /* Fatal error. */
125 tleft
= (int) (done
- now
);