int
NET_Read(
int
s, void
*
buf, size_t
len
) {
BLOCKING_IO_RETURN_INT( s, recv(s, buf,
len
,
0
) );
}
int
NET_ReadV(
int
s, const struct iovec
*
vector,
int
count) {
BLOCKING_IO_RETURN_INT( s, readv(s, vector, count) );
}
int
NET_RecvFrom(
int
s, void
*
buf,
int
len
, unsigned
int
flags,
struct sockaddr
*
from
,
int
*
fromlen) {
socklen_t socklen
=
*
fromlen;
BLOCKING_IO_RETURN_INT( s, recvfrom(s, buf,
len
, flags,
from
, &socklen) );
*
fromlen
=
socklen;
}
int
NET_Send(
int
s, void
*
msg,
int
len
, unsigned
int
flags) {
BLOCKING_IO_RETURN_INT( s, send(s, msg,
len
, flags) );
}
int
NET_WriteV(
int
s, const struct iovec
*
vector,
int
count) {
BLOCKING_IO_RETURN_INT( s, writev(s, vector, count) );
}
int
NET_SendTo(
int
s, const void
*
msg,
int
len
, unsigned
int
flags, const struct sockaddr
*
to,
int
tolen) {
BLOCKING_IO_RETURN_INT( s, sendto(s, msg,
len
, flags, to, tolen) );
}
int
NET_Accept(
int
s, struct sockaddr
*
addr,
int
*
addrlen) {
socklen_t socklen
=
*
addrlen;
BLOCKING_IO_RETURN_INT( s, accept(s, addr, &socklen) );
*
addrlen
=
socklen;
}
int
NET_Connect(
int
s, struct sockaddr
*
addr,
int
addrlen) {
BLOCKING_IO_RETURN_INT( s, connect(s, addr, addrlen) );
}
int
NET_Poll(struct pollfd
*
ufds, unsigned
int
nfds,
int
timeout) {
BLOCKING_IO_RETURN_INT( ufds[
0
].fd, poll(ufds, nfds, timeout) );
}
int
NET_Select(
int
s, fd_set
*
readfds, fd_set
*
writefds,
fd_set
*
exceptfds, struct timeval
*
timeout) {
BLOCKING_IO_RETURN_INT( s
-
1
,
select(s, readfds, writefds, exceptfds, timeout) );
}