Hi, A close and select call (possibly used by available) can be interrupted. In that case we have to retry the system call.
2005-07-26 Mark Wielaard <[EMAIL PROTECTED]> * native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c (Java_gnu_java_nio_channels_FileChannelImpl_init): Mark clazz as unused. Remove unused variables constructor and obj. (Java_gnu_java_nio_channels_FileChannelImpl_implCloseChannel): Retry when interrupted. (Java_gnu_java_nio_channels_FileChannelImpl_available): Likewise. Also cleans up some warnings caused by the move of parts of init from the native to java side. Committed, Mark
Index: native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c =================================================================== RCS file: /cvsroot/classpath/classpath/native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c,v retrieving revision 1.21 diff -u -r1.21 gnu_java_nio_channels_FileChannelImpl.c --- native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c 26 Jul 2005 09:40:21 -0000 1.21 +++ native/jni/java-nio/gnu_java_nio_channels_FileChannelImpl.c 26 Jul 2005 12:30:50 -0000 @@ -113,12 +113,12 @@ * static initialization. */ JNIEXPORT void JNICALL -Java_gnu_java_nio_channels_FileChannelImpl_init (JNIEnv * env, jclass clazz) +Java_gnu_java_nio_channels_FileChannelImpl_init (JNIEnv * env, + jclass clazz + __attribute__ ((__unused__))) { jclass clazz_fc; jfieldID field; - jmethodID constructor; - jobject obj; /* Initialize native_fd_fieldID so we only compute it once! */ clazz_fc = (*env)->FindClass (env, "gnu/java/nio/channels/FileChannelImpl"); @@ -236,12 +236,19 @@ native_fd = get_native_fd (env, obj); - TARGET_NATIVE_FILE_CLOSE (native_fd, result); - if (result != TARGET_NATIVE_OK) + do { - JCL_ThrowException (env, IO_EXCEPTION, - TARGET_NATIVE_LAST_ERROR_STRING ()); + TARGET_NATIVE_FILE_CLOSE (native_fd, result); + if (result != TARGET_NATIVE_OK + && (TARGET_NATIVE_LAST_ERROR () + != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL)) + { + JCL_ThrowException (env, IO_EXCEPTION, + TARGET_NATIVE_LAST_ERROR_STRING ()); + return; + } } + while (result != TARGET_NATIVE_OK); } /* @@ -258,13 +265,19 @@ native_fd = get_native_fd (env, obj); - TARGET_NATIVE_FILE_AVAILABLE (native_fd, bytes_available, result); - if (result != TARGET_NATIVE_OK) + do { - JCL_ThrowException (env, IO_EXCEPTION, - TARGET_NATIVE_LAST_ERROR_STRING ()); - return 0; + TARGET_NATIVE_FILE_AVAILABLE (native_fd, bytes_available, result); + if (result != TARGET_NATIVE_OK + && (TARGET_NATIVE_LAST_ERROR () + != TARGET_NATIVE_ERROR_INTERRUPT_FUNCTION_CALL)) + { + JCL_ThrowException (env, IO_EXCEPTION, + TARGET_NATIVE_LAST_ERROR_STRING ()); + return 0; + } } + while (result != TARGET_NATIVE_OK); /* FIXME NYI ??? why only jint and not jlong? */ return TARGET_NATIVE_MATH_INT_INT64_TO_INT32 (bytes_available);
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches