diff options
author | sam <sam@FreeBSD.org> | 2005-02-25 19:34:10 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2005-02-25 19:34:10 +0000 |
commit | b3f1395f0dd0fa285d4af6993d6562c37844fb6f (patch) | |
tree | 1414f006edb67b0a5a98932d3f06cec41ac0138b /sys/compat/svr4/svr4_signal.c | |
parent | 8f01899557c43fb2b2d963963a95655a67defff1 (diff) | |
download | FreeBSD-src-b3f1395f0dd0fa285d4af6993d6562c37844fb6f.zip FreeBSD-src-b3f1395f0dd0fa285d4af6993d6562c37844fb6f.tar.gz |
fixup signal mapping:
o change the mapping arrays to have a zero offset rather than base 1;
this eliminates lots of signo adjustments and brings the code
back inline with the original netbsd code
o purge use of SVR4_SIGTBLZ; SVR4_NSIG is the only definition for
how big a mapping array is
o change the mapping loops to explicitly ignore signal 0
o purge some bogus code from bsd_to_svr4_sigset
o adjust svr4_sysentvec to deal with the mapping table change
Enticed into fixing by: Coverity Prevent analysis tool
Glanced at by: marcel, jhb
Diffstat (limited to 'sys/compat/svr4/svr4_signal.c')
-rw-r--r-- | sys/compat/svr4/svr4_signal.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/sys/compat/svr4/svr4_signal.c b/sys/compat/svr4/svr4_signal.c index 1a3f7f1..c0a3a21 100644 --- a/sys/compat/svr4/svr4_signal.c +++ b/sys/compat/svr4/svr4_signal.c @@ -59,7 +59,8 @@ void svr4_to_bsd_sigaction(const struct svr4_sigaction *, struct sigaction *); void bsd_to_svr4_sigaction(const struct sigaction *, struct svr4_sigaction *); void svr4_sigfillset(svr4_sigset_t *); -int bsd_to_svr4_sig[SVR4_SIGTBLSZ] = { +int bsd_to_svr4_sig[SVR4_NSIG] = { + 0, SVR4_SIGHUP, SVR4_SIGINT, SVR4_SIGQUIT, @@ -93,7 +94,8 @@ int bsd_to_svr4_sig[SVR4_SIGTBLSZ] = { SVR4_SIGUSR2, }; -int svr4_to_bsd_sig[SVR4_SIGTBLSZ] = { +int svr4_to_bsd_sig[SVR4_NSIG] = { + 0, SIGHUP, SIGINT, SIGQUIT, @@ -134,7 +136,7 @@ svr4_sigfillset(s) int i; svr4_sigemptyset(s); - for (i = 0; i < SVR4_NSIG; i++) + for (i = 1; i < SVR4_NSIG; i++) if (svr4_to_bsd_sig[i] != 0) svr4_sigaddset(s, i); } @@ -147,8 +149,8 @@ svr4_to_bsd_sigset(sss, bss) int i, newsig; SIGEMPTYSET(*bss); - for (i = 0; i < SVR4_NSIG; i++) - if (svr4_sigismember(sss, i + 1)) { + for (i = 1; i < SVR4_NSIG; i++) + if (svr4_sigismember(sss, i)) { newsig = svr4_to_bsd_sig[i]; if (newsig) SIGADDSET(*bss, newsig); @@ -163,13 +165,9 @@ bsd_to_svr4_sigset(bss, sss) int i, newsig; svr4_sigemptyset(sss); - sss->bits[0] = bss->__bits[0] & ~((1U << SVR4_SIGTBLSZ) - 1); - sss->bits[1] = bss->__bits[1]; - sss->bits[2] = bss->__bits[2]; - sss->bits[3] = bss->__bits[3]; - for (i = 1; i <= SVR4_SIGTBLSZ; i++) { + for (i = 1; i < SVR4_NSIG; i++) { if (SIGISMEMBER(*bss, i)) { - newsig = bsd_to_svr4_sig[_SIG_IDX(i)]; + newsig = bsd_to_svr4_sig[i]; if (newsig) svr4_sigaddset(sss, newsig); } |