Subject: Re: SA_SIGINFO notes
To: Jason Thorpe <thorpej@wasabisystems.com>
From: Christos Zoulas <christos@zoulas.com>
List: tech-kern
Date: 10/07/2003 14:15:41
On Oct 7, 10:50am, thorpej@wasabisystems.com (Jason Thorpe) wrote:
-- Subject: Re: SA_SIGINFO notes

Looks good to me. To simplify the code and the amount of patching,
I would just set in kern/kern_sig.c:

trapsignal() {
    ksi->ksi_flag = KSI_TRAP;
}

since this will catch the compat case also (for systems that have
not converted to siginfo yet), and leave the md code alone doing
memsets. This way, I don't need any of the init macros.

christos

| Here is my patch that takes a stab a solving this problem.  I've 
| compile-tested it on i386, but I won't be able to run-test it until 
| later this afternoon.
| 
| It's not very invasive... it looks large because it requires the 
| correct kind of initialization for the ksiginfo_t for trap handlers.  
| Mostly this is replacing a memset() call with a macro call (and adding 
| missing initialization of ksiginfo_t to sparc and alpha).
| 
| This currently only handles the "caused by trap" case.  For "caused by 
| kernel", you can't use ksi_code < SI_USER because of all the 
| kernel-sourced signals (SIGCHLD, for example) that have > 0 codes.  For 
| "sent by another process", the absence of both flags or ksi_code == 
| SI_USER should be sufficient.  Actually, a set of predicate macros 
| might be nice:
| 
| 	KSI_TRAP_P()
| 	KSI_KERNEL_P()
| 	KSI_USER_P()
| 
| which hide how the tests are actually done.
| 
| Comments?