diff options
author | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-07-27 06:10:39 +0000 |
---|---|---|
committer | Constantine Sapuntzakis <csapuntz@cvs.openbsd.org> | 2001-07-27 06:10:39 +0000 |
commit | d6269a4563bb5e6929a930402c384c02112f5b66 (patch) | |
tree | be92a3fee254977a718adb00e88c909cce2b5e4f /sys/compat/linux | |
parent | 5800a67018214e91d6afb1ba94b170772760c709 (diff) |
Convert array lookups to function calls that are bounds checked
Diffstat (limited to 'sys/compat/linux')
-rw-r--r-- | sys/compat/linux/linux_signal.c | 22 | ||||
-rw-r--r-- | sys/compat/linux/linux_signal.h | 5 |
2 files changed, 25 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index 6c52c88eb4a..1a0b12f8476 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_signal.c,v 1.9 2001/04/09 06:52:26 tholo Exp $ */ +/* $OpenBSD: linux_signal.c,v 1.10 2001/07/27 06:10:38 csapuntz Exp $ */ /* $NetBSD: linux_signal.c,v 1.10 1996/04/04 23:51:36 christos Exp $ */ /* @@ -351,6 +351,26 @@ bsd_to_linux_sigaction(bsa, lsa) lsa->sa__handler = bsa->sa_handler; } +int +linux_to_bsd_signal(int linuxsig, int *bsdsig) +{ + if (linuxsig < 0 || linuxsig > LINUX__NSIG) + return (EINVAL); + + *bsdsig = linux_to_bsd_sig[linuxsig]; + return (0); +} + +int +bsd_to_linux_signal(int bsdsig, int *linuxsig) +{ + if (bsdsig < 0 || bsdsig > NSIG) + return (EINVAL); + + *linuxsig = bsd_to_linux_sig[bsdsig]; + return (0); +} + /* * The Linux sigaction() system call. Do the usual conversions, * and just call sigaction(). Some flags and values are silently diff --git a/sys/compat/linux/linux_signal.h b/sys/compat/linux/linux_signal.h index bfa67cd2ee6..c968de65efc 100644 --- a/sys/compat/linux/linux_signal.h +++ b/sys/compat/linux/linux_signal.h @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_signal.h,v 1.5 2000/06/07 14:11:38 niklas Exp $ */ +/* $OpenBSD: linux_signal.h,v 1.6 2001/07/27 06:10:38 csapuntz Exp $ */ /* $NetBSD: linux_signal.h,v 1.4 1995/08/27 20:51:51 fvdl Exp $ */ /* @@ -138,4 +138,7 @@ void linux_to_bsd_sigaction __P((struct linux_sigaction *, void bsd_to_linux_sigaction __P((struct sigaction *, struct linux_sigaction *)); +int linux_to_bsd_signal (int, int *); +int bsd_to_linux_signal (int, int *); + #endif /* !_LINUX_SIGNAL_H */ |