Commit graph

9 commits

Author SHA1 Message Date
cinap_lenrek 5d9deb77e9 kernel: make sure procalarm() remaining time doesnt become negative 2016-09-08 01:28:34 +02:00
cinap_lenrek 6929f0a986 kernel: simplify procalarm() 2014-01-03 02:16:18 +01:00
cinap_lenrek 8ebe3f680e alarm: skip timed out alarms when inserting in procalarm() (thanks erik)
from erik quanstros 9fans post:

i think the list insertion code needs a single-read
test that f->alarm != 0. to prevent the 0 from
acting like a fencepost.  e.g. trying to insert -10 into
list -40 -30 0 -20.

	if(alarms.head) {
		l = &alarms.head;
		for(f = *l; f; f = f->palarm) {
>>			fw = f->alarm;
>>			if(fw != 0 && (long)(fw - when) >= 0) {
				up->palarm = f;
				*l = up;
				goto done;
			}
			l = &f->palarm;
		}
		*l = up;
	}
2014-01-03 01:40:17 +01:00
cinap_lenrek f481ac716d kernel: fix alarm postnote race
when alarmkproc is commited to send the alarm note to the process,
the process might have exited already, or worse, being reused for
another process. pexit() zeros p->alarm at the beginning, but the
kalarmproc() might read p->alarm before pexit() zeroed it, decide
to send the note, then get preempted and pexit() releases the proc.
once kalarmproc() is resumed, the proc might be already something
different and we send the note to the wrong thing.

we now check p->alarm under the debug qlock. that way, pexit()
cannot make progress while we test the condition.

remove the error label arround postnote(). postnote does not raise
error.
2014-01-01 05:14:38 +01:00
cinap_lenrek df6b68092c kernel: kproc error and exit
catch the error() that can be thrown by sleep() and tsleep()
in kprocs.

add missing pexit() calls.

always set the freemem argument to pexit() from kproc otherwise
the process gets added to the broken list.
2013-11-22 22:28:20 +01:00
cinap_lenrek 58f8d7874b alarm: run checkalarms() only on cpu0 (from eriks alarm-once patch) 2013-06-22 09:53:14 +02:00
cinap_lenrek 92b550d665 kernel: prevent alarm(2) from returning instantly when the tick timer wraps. (from erik quanstros alarmwrap patch) 2013-05-21 19:31:41 +02:00
Taru Karttunen a9060cc06b Import sources from 2011-03-30 iso image - lib 2011-03-30 19:35:09 +03:00
Taru Karttunen e5888a1ffd Import sources from 2011-03-30 iso image 2011-03-30 15:46:40 +03:00