summaryrefslogtreecommitdiffstats
path: root/sys/i386/linux/linux_misc.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>1999-09-29 15:12:18 +0000
committermarcel <marcel@FreeBSD.org>1999-09-29 15:12:18 +0000
commitbd000d73ad75473ad7201663ffb27c36ab130f0e (patch)
treebc01945dc4b7113b39c954abf475834f0e086487 /sys/i386/linux/linux_misc.c
parenta16d76cb5680cf0afd1a3be9be9d1f7ea686a96c (diff)
downloadFreeBSD-src-bd000d73ad75473ad7201663ffb27c36ab130f0e.zip
FreeBSD-src-bd000d73ad75473ad7201663ffb27c36ab130f0e.tar.gz
sigset_t change (part 4 of 5)
----------------------------- The compatibility code and/or emulators have been updated: iBCS2 now mostly uses the older syscalls. SVR4 now properly handles all signals. This has been achieved by using the new sigset_t throughout the emulator. The Linuxulator has been severely updated. Internally the new Linux sigset_t is made the default. These are then mapped to and from the new FreeBSD sigset_t. Also, rt_sigsuspend has been implemented in the Linuxulator. Implementing this syscall basicly caused all this sigset_t changing in the first place and the syscall has been used throughout the change as a means for testing. It basicly is too much work to undo the implementation so that it can later be added again. A special note on the use of sv_sigtbl and sv_sigsize in struct sysentvec: Every signal larger than sv_sigsize is not translated and is passed on to the signal handler unmodified. Signals in the range 1 upto and including sv_sigsize are translated. The rationale is that only the system defined signals need to be translated. The emulators also have been updated so that the translation tables are only indexed for valid (system defined) signals. This change also fixes the translation bug already in the SVR4 emulator.
Diffstat (limited to 'sys/i386/linux/linux_misc.c')
-rw-r--r--sys/i386/linux/linux_misc.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c
index 919a5e7..ff5ba44 100644
--- a/sys/i386/linux/linux_misc.c
+++ b/sys/i386/linux/linux_misc.c
@@ -47,6 +47,7 @@
#include <sys/vnode.h>
#include <sys/wait.h>
#include <sys/time.h>
+#include <sys/signalvar.h>
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -67,6 +68,9 @@
#include <posix4/sched.h>
+#define BSD_TO_LINUX_SIGNAL(sig) \
+ (((sig) <= LINUX_SIGTBLSZ) ? bsd_to_linux_signal[_SIG_IDX(sig)] : sig)
+
static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] =
{ RLIMIT_CPU, RLIMIT_FSIZE, RLIMIT_DATA, RLIMIT_STACK,
RLIMIT_CORE, RLIMIT_RSS, RLIMIT_NPROC, RLIMIT_NOFILE,
@@ -622,7 +626,9 @@ linux_clone(struct proc *p, struct linux_clone_args *args)
exit_signal = args->flags & 0x000000ff;
if (exit_signal >= LINUX_NSIG)
return EINVAL;
- exit_signal = linux_to_bsd_signal[exit_signal];
+
+ if (exit_signal <= LINUX_SIGTBLSZ)
+ exit_signal = linux_to_bsd_signal[_SIG_IDX(exit_signal)];
/* RFTHREAD probably not necessary here, but it shouldn't hurt either */
ff |= RFTHREAD;
@@ -979,10 +985,10 @@ linux_waitpid(struct proc *p, struct linux_waitpid_args *args)
return error;
if (WIFSIGNALED(tmpstat))
tmpstat = (tmpstat & 0xffffff80) |
- bsd_to_linux_signal[WTERMSIG(tmpstat)];
+ BSD_TO_LINUX_SIGNAL(WTERMSIG(tmpstat));
else if (WIFSTOPPED(tmpstat))
tmpstat = (tmpstat & 0xffff00ff) |
- (bsd_to_linux_signal[WSTOPSIG(tmpstat)]<<8);
+ (BSD_TO_LINUX_SIGNAL(WSTOPSIG(tmpstat)) << 8);
return copyout(&tmpstat, args->status, sizeof(int));
} else
return 0;
@@ -1015,17 +1021,17 @@ linux_wait4(struct proc *p, struct linux_wait4_args *args)
if ((error = wait4(p, &tmp)) != 0)
return error;
- p->p_siglist &= ~sigmask(SIGCHLD);
+ SIGDELSET(p->p_siglist, SIGCHLD);
if (args->status) {
if ((error = copyin(args->status, &tmpstat, sizeof(int))) != 0)
return error;
if (WIFSIGNALED(tmpstat))
tmpstat = (tmpstat & 0xffffff80) |
- bsd_to_linux_signal[WTERMSIG(tmpstat)];
+ BSD_TO_LINUX_SIGNAL(WTERMSIG(tmpstat));
else if (WIFSTOPPED(tmpstat))
tmpstat = (tmpstat & 0xffff00ff) |
- (bsd_to_linux_signal[WSTOPSIG(tmpstat)]<<8);
+ (BSD_TO_LINUX_SIGNAL(WSTOPSIG(tmpstat)) << 8);
return copyout(&tmpstat, args->status, sizeof(int));
} else
return 0;
@@ -1312,7 +1318,7 @@ linux_sched_setscheduler(p, uap)
#ifdef DEBUG
printf("Linux-emul(%ld): sched_setscheduler(%d, %d, %p)\n",
- (long)p->p_pid, uap->pid, uap->policy, (void *)uap->param);
+ (long)p->p_pid, uap->pid, uap->policy, (const void *)uap->param);
#endif
switch (uap->policy) {
OpenPOWER on IntegriCloud