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

Re: Mint 1.11 beta: ikill()



In article <9408202225.AA03329@hera.rbi.informatik.uni-frankfurt.de> you write:

>Second, due to the limited time the system should spend in interrupt
>handlers/timeout function calls checksigs() should not be called from
>ikill().
>
>The following patch removes these problems.
>...

sounds good, make raising sigs independent of handling them...  here is
the second part :)

1. check sigs before returning from syscalls

Index: syscall.spp
@@ -305,7 +305,15 @@
 	bne.s	nosleep			; if locked, can't switch
 sleep:
 	jsr	_preempt		; does a sleep(READY_Q)
+	bra.s	nosig
+
 nosleep:
+	move.l	P_SIGMASK(a0),d0	; any unmasked signals left pendig?
+	not.l	d0
+	and.l	P_SIGPENDING(a0),d0
+	beq.s	nosig
+	jsr	_check_sigs
+nosig:
 	ori.w	#$0700,sr		; spl7()
 	jsr	_leave_kernel		; restore vectors
 	move.l	_curproc,a0
Index: genmagic.c
@@ -47,6 +47,8 @@
 	{ "P_EXCADDR", offsetof(PROC, exception_addr)},
 	{ "P_EXCTBL", offsetof(PROC, exception_tbl)},
 	{ "P_EXCMMUSR", offsetof(PROC, exception_mmusr)},
+	{ "P_SIGMASK", offsetof(PROC, sigmask)},
+	{ "P_SIGPENDING", offsetof(PROC, sigpending)},
 	{ (char *)0, 0 }
 };
 
2. and before going to sleep.  this also makes sure a signal sent to
curprocs pgroup gets handled first by curproc i.e. ^c a make job should
leave behind no more SIGTTOU'd processes...  (although i'm still not
sure if thats not also a shell bug)

Index: proc.c
@@ -523,6 +523,13 @@
 			kintr = 0;
 		}
 		sr = spl7();
+		if ((curproc->sigpending & ~(curproc->sigmask)) &&
+		    curproc->pid && que != ZOMBIE_Q && que != TSR_Q) {
+			spl(sr);
+			check_sigs();
+			sr = spl7();
+			sleepcond = 0;	/* possibly handled a signal, return */
+		}
 	}
 
 /*

now where are hsmod**'s callbacks? ;)  then we'd fixed cooked mode
very quickly...

 have fun
	Juergen