< prev index next >
src/java.base/solaris/native/libnet/solaris_close.c
Print this page
@@ -42,10 +42,14 @@
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,23 +88,18 @@
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 NET_Timeout0(int s, long timeout,long currentTime) {
int result;
struct timeval t;
- long prevtime, newtime;
+ long prevtime = currentTime, 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);
< prev index next >