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

Re: Mint 1.10: Bug in Fselect()



Juergen Lock writes:

[...]

>  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...

The only reason I can think of for the spl7()'s beeing there is to avoid
race conditions with:

	while (curproc->wait_cond == (long)wakeselect) {
		/* XXX */
		sleep ();
	}

because without them an interrupt handler could interrupt at /*XXX*/
and clear curproc->wait_cond, thus making the process sleep forever,
because it is woken up before actually going to sleep.

So running check_sigs() not at spl7 should be OK.

Cheers, Kay.