Steven Seeger wrote:
> Just to let everyone know, select() still locks up on me with 2.6.22.2
> and revision 3169.
> 
>  
> 
> All I’m doing is opening up a pipe in linux and select() on it for
> reading, and then opening up that pipe on the realtime side. Then, I hit
> control-C. I load the program again and it locks up when I hit control-C
> again. This won’t happen the 2^nd time if I unload and reload the nucleus.
> 

The way we were handling the poll handler was broken. Fixed in both
v2.3.x and trunk branches. The attached patch is on top of commit #3166.

-- 
Philippe.
Index: include/nucleus/pipe.h
===================================================================
--- include/nucleus/pipe.h	(revision 3166)
+++ include/nucleus/pipe.h	(working copy)
@@ -101,7 +101,6 @@
     struct fasync_struct *asyncq;
     wait_queue_head_t readq;		/* open/read/poll waiters */
     wait_queue_head_t syncq;		/* sync waiters */
-    unsigned int nwait;
     size_t ionrd;
 
 } xnpipe_state_t;
Index: ksrc/nucleus/pipe.c
===================================================================
--- ksrc/nucleus/pipe.c	(revision 3166)
+++ ksrc/nucleus/pipe.c	(working copy)
@@ -97,8 +97,6 @@
 		__setbits(state->status, mask);
 	}
 
-	state->nwait++;
-
 	xnlock_put_irqrestore(&nklock, s);
 }
 
@@ -135,7 +133,7 @@
 
 	xnlock_get_irqsave(&nklock, s);
 
-	if (--state->nwait == 0) {
+	if (testbits(state->status, mask)) {
 		__clrbits(state->status, mask);
 		removeq(&xnpipe_sleepq, &state->slink);
 	}
@@ -635,7 +633,6 @@
 	file->private_data = state;
 	init_waitqueue_head(&state->readq);
 	init_waitqueue_head(&state->syncq);
-	state->nwait = 0;
 
 	__clrbits(state->status,
 		  XNPIPE_USER_ALL_WAIT | XNPIPE_USER_ALL_READY | XNPIPE_USER_SIGIO);
@@ -699,12 +696,9 @@
 
 	xnlock_get_irqsave(&nklock, s);
 
-	if (testbits(state->status, XNPIPE_USER_WREAD))
-		xnpipe_dequeue_wait(state, XNPIPE_USER_WREAD);
+	if (testbits(state->status, XNPIPE_USER_WREAD|XNPIPE_USER_WSYNC))
+		xnpipe_dequeue_wait(state, XNPIPE_USER_WREAD|XNPIPE_USER_WSYNC);
 
-	if (testbits(state->status, XNPIPE_USER_WSYNC))
-		xnpipe_dequeue_wait(state, XNPIPE_USER_WSYNC);
-
 	if (testbits(state->status, XNPIPE_KERN_CONN)) {
 		int minor = xnminor_from_state(state);
 
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to