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
This commit is contained in:
parent
8f01899557
commit
b3f1395f0d
@ -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);
|
||||
}
|
||||
|
@ -69,7 +69,6 @@
|
||||
#define SVR4_SIGXCPU 30
|
||||
#define SVR4_SIGXFSZ 31
|
||||
#define SVR4_NSIG 32
|
||||
#define SVR4_SIGTBLSZ 31
|
||||
|
||||
#define SVR4_SIGNO_MASK 0x00FF
|
||||
#define SVR4_SIGNAL_MASK 0x0000
|
||||
@ -92,13 +91,13 @@ typedef void (*svr4_sig_t)(int, svr4_siginfo_t *, void *);
|
||||
#define SVR4_SIG_UNBLOCK 2
|
||||
#define SVR4_SIG_SETMASK 3
|
||||
|
||||
extern int bsd_to_svr4_sig[];
|
||||
extern int svr4_to_bsd_sig[];
|
||||
extern int bsd_to_svr4_sig[SVR4_NSIG];
|
||||
extern int svr4_to_bsd_sig[SVR4_NSIG];
|
||||
|
||||
#define SVR4_BSD2SVR4_SIG(sig) \
|
||||
(((sig) <= SVR4_SIGTBLSZ) ? bsd_to_svr4_sig[_SIG_IDX(sig)] : sig)
|
||||
(((sig) < SVR4_NSIG) ? bsd_to_svr4_sig[sig] : sig)
|
||||
#define SVR4_SVR42BSD_SIG(sig) \
|
||||
(((sig) <= SVR4_SIGTBLSZ) ? svr4_to_bsd_sig[_SIG_IDX(sig)] : sig)
|
||||
(((sig) < SVR4_NSIG) ? svr4_to_bsd_sig[sig] : sig)
|
||||
|
||||
typedef struct {
|
||||
u_long bits[4];
|
||||
|
@ -169,8 +169,8 @@ struct sysentvec svr4_sysvec = {
|
||||
SVR4_SYS_MAXSYSCALL,
|
||||
svr4_sysent,
|
||||
0xff,
|
||||
SVR4_SIGTBLSZ,
|
||||
bsd_to_svr4_sig,
|
||||
SVR4_NSIG-1, /* NB: signal trans table indexed with signno-1 */
|
||||
bsd_to_svr4_sig+1,
|
||||
ELAST, /* ELAST */
|
||||
bsd_to_svr4_errno,
|
||||
NULL,
|
||||
|
Loading…
Reference in New Issue
Block a user