[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mint 1.10: Bug in Fselect()



Kay Roemer writes:
> This makes Fselect interruptible by signals. This feature was present
> in MiNT 1.09, but was lost in 1.10.
> 
> Without this patch inetd and some other programs do not work correctly.
> 
> Kay.
> 
> --8<-------------- cut here ----------------------------
> *** dosfile.c.orig	Mon Mar  7 20:09:06 1994
> --- dosfile.c	Mon Mar  7 20:34:44 1994
> ***************
> *** 1040,1046 ****
>   	/* curproc->wait_cond changes when data arrives or the timeout happens */
>   		while (curproc->wait_cond == (long)wakeselect) {
>   			TRACE(("sleeping in Fselect"));
> ! 			sleep(SELECT_Q, (long)wakeselect);
>   		}
>   		spl(sr);
>   
> --- 1040,1049 ----
>   	/* curproc->wait_cond changes when data arrives or the timeout happens */
>   		while (curproc->wait_cond == (long)wakeselect) {
>   			TRACE(("sleeping in Fselect"));
> ! 			if (sleep(SELECT_Q, (long)wakeselect)) {
> ! 				/* interrupted by signals */
> ! 				break;
> ! 			}
>   		}
>   		spl(sr);
>   
> --8<-------------- cut here ----------------------------

 ahaa so my last patch should better be changed like this?

Index: dosfile.c
@@ -1045,6 +1045,7 @@
 	}
 
 	if (count == 0) {
+		ulong onsigs;
 		/* OK, now let's set a timeout */
 
 		if (timeout) {
@@ -1057,6 +1058,7 @@
 		sr = spl7();
 
 	/* curproc->wait_cond changes when data arrives or the timeout happens */
+		onsigs = curproc->nsigs;
 		while (curproc->wait_cond == (long)wakeselect) {
 #if 0
 /* better not call BIOS with interrupts off, especially not Bconin... :) */
@@ -1068,6 +1070,8 @@
 				check_sigs();
 				sr = spl7();
 			}
+			if (onsigs != curproc->nsigs)
+				break;
 		}
 		spl(sr);
 
 or _must_ check_sigs run at level 7 here?  then stopping the modem1
receiver overruns could get a bit harder...

 cheers
	Juergen
-- 
J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
								...ohne Gewehr
PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA