Commit 49f60a1a by Tom Tromey Committed by Tom Tromey

natFileDescriptorPosix.cc (write): Try again on EINTR.

	* java/io/natFileDescriptorPosix.cc (write): Try again on EINTR.
	(write): Likewise.
	(read): Likewise.
	(read): Likewise.

From-SVN: r69807
parent 037af9d7
2003-07-25 Tom Tromey <tromey@redhat.com>
* java/io/natFileDescriptorPosix.cc (write): Try again on EINTR.
(write): Likewise.
(read): Likewise.
(read): Likewise.
2003-07-25 Mark Wielaard <mark@klomp.org> 2003-07-25 Mark Wielaard <mark@klomp.org>
* java/lang/natRuntime.cc (_load): Add library name to * java/lang/natRuntime.cc (_load): Add library name to
......
...@@ -150,6 +150,7 @@ java::io::FileDescriptor::write (jint b) ...@@ -150,6 +150,7 @@ java::io::FileDescriptor::write (jint b)
iioe->bytesTransferred = r == -1 ? 0 : r; iioe->bytesTransferred = r == -1 ? 0 : r;
throw iioe; throw iioe;
} }
if (errno != EINTR)
throw new IOException (JvNewStringLatin1 (strerror (errno))); throw new IOException (JvNewStringLatin1 (strerror (errno)));
} }
} }
...@@ -178,6 +179,7 @@ java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len) ...@@ -178,6 +179,7 @@ java::io::FileDescriptor::write (jbyteArray b, jint offset, jint len)
iioe->bytesTransferred = written; iioe->bytesTransferred = written;
throw iioe; throw iioe;
} }
if (errno != EINTR)
throw new IOException (JvNewStringLatin1 (strerror (errno))); throw new IOException (JvNewStringLatin1 (strerror (errno)));
} }
...@@ -282,7 +284,10 @@ jint ...@@ -282,7 +284,10 @@ jint
java::io::FileDescriptor::read (void) java::io::FileDescriptor::read (void)
{ {
jbyte b; jbyte b;
int r = ::read (fd, &b, 1); int r;
do
{
r = ::read (fd, &b, 1);
if (r == 0) if (r == 0)
return -1; return -1;
if (r == -1) if (r == -1)
...@@ -294,8 +299,11 @@ java::io::FileDescriptor::read (void) ...@@ -294,8 +299,11 @@ java::io::FileDescriptor::read (void)
iioe->bytesTransferred = r == -1 ? 0 : r; iioe->bytesTransferred = r == -1 ? 0 : r;
throw iioe; throw iioe;
} }
if (errno != EINTR)
throw new IOException (JvNewStringLatin1 (strerror (errno))); throw new IOException (JvNewStringLatin1 (strerror (errno)));
} }
}
while (r != 1);
position++; position++;
return b & 0xFF; return b & 0xFF;
} }
...@@ -314,7 +322,10 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count) ...@@ -314,7 +322,10 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
return 0; return 0;
jbyte *bytes = elements (buffer) + offset; jbyte *bytes = elements (buffer) + offset;
int r = ::read (fd, bytes, count); int r;
do
{
r = ::read (fd, bytes, count);
if (r == 0) if (r == 0)
return -1; return -1;
if (r == -1) if (r == -1)
...@@ -326,8 +337,11 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count) ...@@ -326,8 +337,11 @@ java::io::FileDescriptor::read (jbyteArray buffer, jint offset, jint count)
iioe->bytesTransferred = r == -1 ? 0 : r; iioe->bytesTransferred = r == -1 ? 0 : r;
throw iioe; throw iioe;
} }
if (errno != EINTR)
throw new IOException (JvNewStringLatin1 (strerror (errno))); throw new IOException (JvNewStringLatin1 (strerror (errno)));
} }
}
while (r <= 0);
position += r; position += r;
return r; return r;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment