[kaffe] CVS kaffe (guilhem): More fixlets for jthreadedSelect and VMSelector.

Kaffe CVS cvs-commits at kaffe.org
Sun Apr 3 07:59:47 PDT 2005


PatchSet 5651 
Date: 2005/04/03 14:55:04
Author: guilhem
Branch: HEAD
Tag: (none) 
Log:
More fixlets for jthreadedSelect and VMSelector.

        * kaffe/kaffevm/systems/unix-jthreads/jthread.c
        (jthreadedSelect): Prepare dummy sets in case one of the parameter
        is NULL.

        * libraries/clib/nio/gnu_java_nio_VMSelector.c
        (helper_select): Return the error code.
        (select0): Decode the result code.

Members: 
	ChangeLog:1.3821->1.3822 
	kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.132->1.133 
	libraries/clib/nio/gnu_java_nio_VMSelector.c:1.6->1.7 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3821 kaffe/ChangeLog:1.3822
--- kaffe/ChangeLog:1.3821	Sun Apr  3 11:24:04 2005
+++ kaffe/ChangeLog	Sun Apr  3 14:55:04 2005
@@ -1,3 +1,13 @@
+2005-04-03  Guilhem Lavaux  <guilhem at kaffe.org>
+
+	* kaffe/kaffevm/systems/unix-jthreads/jthread.c
+	(jthreadedSelect): Prepare dummy sets in case one of the parameter
+	is NULL.
+
+	* libraries/clib/nio/gnu_java_nio_VMSelector.c
+	(helper_select): Return the error code.
+	(select0): Decode the result code.
+	
 2005-04-03  Rei Odaira <ray at is.s.u-tokyo.ac.jp>
 
 	* kaffe/kaffevm/systems/unix-jthreads/jthread.c
Index: kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c
diff -u kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.132 kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.133
--- kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c:1.132	Sun Apr  3 11:24:08 2005
+++ kaffe/kaffe/kaffevm/systems/unix-jthreads/jthread.c	Sun Apr  3 14:55:08 2005
@@ -3319,6 +3319,7 @@
 	int i;
 	long time_milli;
 	int second_time = 0;
+	fd_set dummy_sets[3];
 	
 	assert(a < FD_SETSIZE);
 	
@@ -3329,6 +3330,21 @@
 		time_milli = e->tv_usec / 1000 + e->tv_sec * 1000;
 	else
 		time_milli = NOTIMEOUT;
+
+
+	if (b == NULL) {
+		FD_ZERO(&dummy_sets[0]);
+		b = &dummy_sets[0];
+	}
+
+	if (c == NULL) {
+		FD_ZERO(&dummy_sets[1]);
+		c = &dummy_sets[1];
+	}
+	if (d == NULL) {
+		FD_ZERO(&dummy_sets[2]);
+		d = &dummy_sets[2];
+	}
 
 	intsDisable();
 
Index: kaffe/libraries/clib/nio/gnu_java_nio_VMSelector.c
diff -u kaffe/libraries/clib/nio/gnu_java_nio_VMSelector.c:1.6 kaffe/libraries/clib/nio/gnu_java_nio_VMSelector.c:1.7
--- kaffe/libraries/clib/nio/gnu_java_nio_VMSelector.c:1.6	Sun Apr  3 11:24:08 2005
+++ kaffe/libraries/clib/nio/gnu_java_nio_VMSelector.c	Sun Apr  3 14:55:08 2005
@@ -159,14 +159,16 @@
 
 		r = KSELECT (n, readfds, writefds, exceptfds,
 		      timeout ? &delay : NULL, &retcode);
-		      
-		if (r != EINTR)
+
+		if (r == 0)
 			return retcode;
+		if (r != EINTR)
+			return -r;
 
 		/* Here we know we got EINTR. */
 		if ( (*env)->CallStaticBooleanMethod(env, thread_class, thread_interrupted) )
 		{
-			return -2;
+			return -EINTR;
 		}
 
 		if (timeout)
@@ -249,7 +251,7 @@
 	result = helper_select (env, thread_class, thread_interrupted, max_fd + 1, &read_fds, &write_fds,
 								&except_fds, time_data);
 
-	if( result == -2 ) {
+	if( result == -EINTR ) {
 		/* The behavior of JRE 1.4.1 is that no exception is thrown
 		 * when the thread is interrupted, but the thread's interrupt
 		 * status is set. Clear all of our select sets and return 0,
@@ -269,8 +271,9 @@
     {
 #if defined(HAVE_STRERROR_R)
 	char message_buf[BUF_SIZE+1];
+	int errcode = -result;
 
-    	if( strerror_r(errno, message_buf, BUF_SIZE) )
+    	if( strerror_r(errcode, message_buf, BUF_SIZE) )
     	{
     		/* This would mean that message_buf was to small
     		 * to hold the error message.
@@ -281,7 +284,7 @@
     	}
 	message = message_buf;
 #else
-	message = strerror(errno);
+	message = strerror(errcode);
 #endif
 
 	JCL_ThrowException (env, "java/io/IOException", message);




More information about the kaffe mailing list