< prev index next >

src/java.base/solaris/native/libnet/solaris_close.c

Print this page

        

*** 42,51 **** --- 42,55 ---- int NET_Read(int s, void* buf, size_t len) { RESTARTABLE_RETURN_INT(recv(s, buf, len, 0)); } + int NET_NonBlockingRead(int s, void* buf, size_t len) { + RESTARTABLE_RETURN_INT(recv(s, buf, len, MSG_DONTWAIT)); + } + int NET_RecvFrom(int s, void *buf, int len, unsigned int flags, struct sockaddr *from, socklen_t *fromlen) { RESTARTABLE_RETURN_INT(recvfrom(s, buf, len, flags, from, fromlen)); }
*** 84,106 **** int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { RESTARTABLE_RETURN_INT(poll(ufds, nfds, timeout)); } ! int NET_Timeout(int s, long timeout) { int result; struct timeval t; ! long prevtime, newtime; struct pollfd pfd; pfd.fd = s; pfd.events = POLLIN; - if (timeout > 0) { - gettimeofday(&t, NULL); - prevtime = (t.tv_sec * 1000) + t.tv_usec / 1000; - } - for(;;) { result = poll(&pfd, 1, timeout); if (result < 0 && errno == EINTR) { if (timeout > 0) { gettimeofday(&t, NULL); --- 88,105 ---- int NET_Poll(struct pollfd *ufds, unsigned int nfds, int timeout) { RESTARTABLE_RETURN_INT(poll(ufds, nfds, timeout)); } ! int NET_Timeout0(int s, long timeout,long currentTime) { int result; struct timeval t; ! long prevtime = currentTime, newtime; struct pollfd pfd; pfd.fd = s; pfd.events = POLLIN; for(;;) { result = poll(&pfd, 1, timeout); if (result < 0 && errno == EINTR) { if (timeout > 0) { gettimeofday(&t, NULL);
*** 113,117 **** --- 112,130 ---- } else { return result; } } } + + int NET_TimeoutWithCurrentTime(int s,long timeout,long currentTime){ + return NET_Timeout0(s, timeout, currentTime); + } + + int NET_Timeout(int s, long timeout) { + long currentTime = 0; + struct timeval t; + if (timeout > 0) { + gettimeofday(&t, NULL); + currentTime = t.tv_sec * 1000 + t.tv_usec / 1000; + } + return NET_Timeout0(s, timeout, currentTime); + }
< prev index next >