1995-06-25 17:32:43 +00:00
|
|
|
/*-
|
2012-01-15 13:23:18 +00:00
|
|
|
* Copyright (c) 1994-1995 Søren Schmidt
|
1995-06-25 17:32:43 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer
|
|
|
|
* in this position and unchanged.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
2002-06-02 20:05:59 +00:00
|
|
|
* derived from this software without specific prior written permission
|
1995-06-25 17:32:43 +00:00
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2003-06-10 21:29:12 +00:00
|
|
|
#include <sys/cdefs.h>
|
2005-02-13 19:50:57 +00:00
|
|
|
__FBSDID("$FreeBSD$");
|
2003-06-10 21:29:12 +00:00
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
2001-05-01 08:13:21 +00:00
|
|
|
#include <sys/lock.h>
|
|
|
|
#include <sys/mutex.h>
|
2006-08-19 15:13:01 +00:00
|
|
|
#include <sys/sx.h>
|
1995-06-25 17:32:43 +00:00
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/signalvar.h>
|
2002-09-01 22:30:27 +00:00
|
|
|
#include <sys/syscallsubr.h>
|
2001-05-01 08:13:21 +00:00
|
|
|
#include <sys/sysproto.h>
|
1995-06-25 17:32:43 +00:00
|
|
|
|
2008-10-19 10:02:26 +00:00
|
|
|
#include <security/audit/audit.h>
|
|
|
|
|
2006-03-19 11:10:33 +00:00
|
|
|
#include "opt_compat.h"
|
|
|
|
|
2005-01-14 04:44:56 +00:00
|
|
|
#ifdef COMPAT_LINUX32
|
2004-08-16 07:28:16 +00:00
|
|
|
#include <machine/../linux32/linux.h>
|
|
|
|
#include <machine/../linux32/linux32_proto.h>
|
2005-01-14 04:44:56 +00:00
|
|
|
#else
|
|
|
|
#include <machine/../linux/linux.h>
|
|
|
|
#include <machine/../linux/linux_proto.h>
|
2004-08-16 07:28:16 +00:00
|
|
|
#endif
|
2000-08-22 01:49:54 +00:00
|
|
|
#include <compat/linux/linux_signal.h>
|
|
|
|
#include <compat/linux/linux_util.h>
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
#include <compat/linux/linux_emul.h>
|
|
|
|
|
2000-08-22 01:49:54 +00:00
|
|
|
void
|
2001-09-08 19:07:04 +00:00
|
|
|
linux_to_bsd_sigset(l_sigset_t *lss, sigset_t *bss)
|
1999-09-29 15:12:18 +00:00
|
|
|
{
|
|
|
|
int b, l;
|
|
|
|
|
|
|
|
SIGEMPTYSET(*bss);
|
|
|
|
bss->__bits[0] = lss->__bits[0] & ~((1U << LINUX_SIGTBLSZ) - 1);
|
|
|
|
bss->__bits[1] = lss->__bits[1];
|
|
|
|
for (l = 1; l <= LINUX_SIGTBLSZ; l++) {
|
|
|
|
if (LINUX_SIGISMEMBER(*lss, l)) {
|
|
|
|
b = linux_to_bsd_signal[_SIG_IDX(l)];
|
|
|
|
if (b)
|
|
|
|
SIGADDSET(*bss, b);
|
|
|
|
}
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
}
|
|
|
|
|
2000-10-17 00:00:20 +00:00
|
|
|
void
|
2001-09-08 19:07:04 +00:00
|
|
|
bsd_to_linux_sigset(sigset_t *bss, l_sigset_t *lss)
|
1999-09-29 15:12:18 +00:00
|
|
|
{
|
|
|
|
int b, l;
|
|
|
|
|
|
|
|
LINUX_SIGEMPTYSET(*lss);
|
|
|
|
lss->__bits[0] = bss->__bits[0] & ~((1U << LINUX_SIGTBLSZ) - 1);
|
|
|
|
lss->__bits[1] = bss->__bits[1];
|
|
|
|
for (b = 1; b <= LINUX_SIGTBLSZ; b++) {
|
|
|
|
if (SIGISMEMBER(*bss, b)) {
|
|
|
|
l = bsd_to_linux_signal[_SIG_IDX(b)];
|
|
|
|
if (l)
|
|
|
|
LINUX_SIGADDSET(*lss, l);
|
|
|
|
}
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
}
|
|
|
|
|
1996-03-02 21:00:11 +00:00
|
|
|
static void
|
2001-09-08 19:07:04 +00:00
|
|
|
linux_to_bsd_sigaction(l_sigaction_t *lsa, struct sigaction *bsa)
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
|
|
|
linux_to_bsd_sigset(&lsa->lsa_mask, &bsa->sa_mask);
|
2004-08-16 07:28:16 +00:00
|
|
|
bsa->sa_handler = PTRIN(lsa->lsa_handler);
|
1999-09-29 15:12:18 +00:00
|
|
|
bsa->sa_flags = 0;
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_NOCLDSTOP)
|
|
|
|
bsa->sa_flags |= SA_NOCLDSTOP;
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_NOCLDWAIT)
|
|
|
|
bsa->sa_flags |= SA_NOCLDWAIT;
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_SIGINFO)
|
|
|
|
bsa->sa_flags |= SA_SIGINFO;
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_ONSTACK)
|
|
|
|
bsa->sa_flags |= SA_ONSTACK;
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_RESTART)
|
|
|
|
bsa->sa_flags |= SA_RESTART;
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_ONESHOT)
|
|
|
|
bsa->sa_flags |= SA_RESETHAND;
|
|
|
|
if (lsa->lsa_flags & LINUX_SA_NOMASK)
|
|
|
|
bsa->sa_flags |= SA_NODEFER;
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
}
|
|
|
|
|
1996-03-02 21:00:11 +00:00
|
|
|
static void
|
2001-09-08 19:07:04 +00:00
|
|
|
bsd_to_linux_sigaction(struct sigaction *bsa, l_sigaction_t *lsa)
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
|
|
|
|
bsd_to_linux_sigset(&bsa->sa_mask, &lsa->lsa_mask);
|
2005-01-14 04:44:56 +00:00
|
|
|
#ifdef COMPAT_LINUX32
|
2004-08-16 07:28:16 +00:00
|
|
|
lsa->lsa_handler = (uintptr_t)bsa->sa_handler;
|
|
|
|
#else
|
1999-09-29 15:12:18 +00:00
|
|
|
lsa->lsa_handler = bsa->sa_handler;
|
2004-08-16 07:28:16 +00:00
|
|
|
#endif
|
|
|
|
lsa->lsa_restorer = 0; /* unsupported */
|
1999-09-29 15:12:18 +00:00
|
|
|
lsa->lsa_flags = 0;
|
|
|
|
if (bsa->sa_flags & SA_NOCLDSTOP)
|
|
|
|
lsa->lsa_flags |= LINUX_SA_NOCLDSTOP;
|
|
|
|
if (bsa->sa_flags & SA_NOCLDWAIT)
|
|
|
|
lsa->lsa_flags |= LINUX_SA_NOCLDWAIT;
|
|
|
|
if (bsa->sa_flags & SA_SIGINFO)
|
|
|
|
lsa->lsa_flags |= LINUX_SA_SIGINFO;
|
|
|
|
if (bsa->sa_flags & SA_ONSTACK)
|
|
|
|
lsa->lsa_flags |= LINUX_SA_ONSTACK;
|
|
|
|
if (bsa->sa_flags & SA_RESTART)
|
|
|
|
lsa->lsa_flags |= LINUX_SA_RESTART;
|
|
|
|
if (bsa->sa_flags & SA_RESETHAND)
|
|
|
|
lsa->lsa_flags |= LINUX_SA_ONESHOT;
|
|
|
|
if (bsa->sa_flags & SA_NODEFER)
|
|
|
|
lsa->lsa_flags |= LINUX_SA_NOMASK;
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
|
2000-08-22 01:49:54 +00:00
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_do_sigaction(struct thread *td, int linux_sig, l_sigaction_t *linux_nsa,
|
2001-09-08 19:07:04 +00:00
|
|
|
l_sigaction_t *linux_osa)
|
1999-08-14 17:28:46 +00:00
|
|
|
{
|
2002-09-01 22:30:27 +00:00
|
|
|
struct sigaction act, oact, *nsa, *osa;
|
|
|
|
int error, sig;
|
1999-09-29 15:12:18 +00:00
|
|
|
|
2006-10-15 12:51:43 +00:00
|
|
|
if (!LINUX_SIG_VALID(linux_sig))
|
1999-09-29 15:12:18 +00:00
|
|
|
return (EINVAL);
|
|
|
|
|
2002-09-01 22:30:27 +00:00
|
|
|
osa = (linux_osa != NULL) ? &oact : NULL;
|
1999-09-29 15:12:18 +00:00
|
|
|
if (linux_nsa != NULL) {
|
2002-09-01 22:30:27 +00:00
|
|
|
nsa = &act;
|
1999-11-30 15:02:28 +00:00
|
|
|
linux_to_bsd_sigaction(linux_nsa, nsa);
|
2002-09-01 22:30:27 +00:00
|
|
|
} else
|
1999-09-29 15:12:18 +00:00
|
|
|
nsa = NULL;
|
|
|
|
|
|
|
|
if (linux_sig <= LINUX_SIGTBLSZ)
|
2002-09-01 22:30:27 +00:00
|
|
|
sig = linux_to_bsd_signal[_SIG_IDX(linux_sig)];
|
1999-09-29 15:12:18 +00:00
|
|
|
else
|
2002-09-01 22:30:27 +00:00
|
|
|
sig = linux_sig;
|
1999-09-29 15:12:18 +00:00
|
|
|
|
2002-09-01 22:30:27 +00:00
|
|
|
error = kern_sigaction(td, sig, nsa, osa, 0);
|
1999-08-14 17:28:46 +00:00
|
|
|
if (error)
|
1999-09-29 15:12:18 +00:00
|
|
|
return (error);
|
|
|
|
|
1999-11-30 15:02:28 +00:00
|
|
|
if (linux_osa != NULL)
|
|
|
|
bsd_to_linux_sigaction(osa, linux_osa);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
return (0);
|
1999-08-14 17:28:46 +00:00
|
|
|
}
|
|
|
|
|
2000-11-01 19:48:35 +00:00
|
|
|
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_signal(struct thread *td, struct linux_signal_args *args)
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
{
|
2001-09-08 19:07:04 +00:00
|
|
|
l_sigaction_t nsa, osa;
|
1999-09-29 15:12:18 +00:00
|
|
|
int error;
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-02-16 16:40:43 +00:00
|
|
|
if (ldebug(signal))
|
|
|
|
printf(ARGS(signal, "%d, %p"),
|
2004-08-16 12:15:07 +00:00
|
|
|
args->sig, (void *)(uintptr_t)args->handler);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
#endif
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
nsa.lsa_handler = args->handler;
|
|
|
|
nsa.lsa_flags = LINUX_SA_ONESHOT | LINUX_SA_NOMASK;
|
|
|
|
LINUX_SIGEMPTYSET(nsa.lsa_mask);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
error = linux_do_sigaction(td, args->sig, &nsa, &osa);
|
2004-08-16 07:28:16 +00:00
|
|
|
td->td_retval[0] = (int)(intptr_t)osa.lsa_handler;
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
return (error);
|
1999-08-14 17:28:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_rt_sigaction(struct thread *td, struct linux_rt_sigaction_args *args)
|
1999-08-14 17:28:46 +00:00
|
|
|
{
|
2001-09-08 19:07:04 +00:00
|
|
|
l_sigaction_t nsa, osa;
|
1999-09-29 15:12:18 +00:00
|
|
|
int error;
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-02-16 16:40:43 +00:00
|
|
|
if (ldebug(rt_sigaction))
|
|
|
|
printf(ARGS(rt_sigaction, "%ld, %p, %p, %ld"),
|
|
|
|
(long)args->sig, (void *)args->act,
|
|
|
|
(void *)args->oact, (long)args->sigsetsize);
|
1999-08-14 17:28:46 +00:00
|
|
|
#endif
|
|
|
|
|
2001-09-08 19:07:04 +00:00
|
|
|
if (args->sigsetsize != sizeof(l_sigset_t))
|
1999-09-29 15:12:18 +00:00
|
|
|
return (EINVAL);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
if (args->act != NULL) {
|
2001-09-08 19:07:04 +00:00
|
|
|
error = copyin(args->act, &nsa, sizeof(l_sigaction_t));
|
1999-09-29 15:12:18 +00:00
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
}
|
1999-08-14 17:28:46 +00:00
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
error = linux_do_sigaction(td, args->sig,
|
1999-09-29 15:12:18 +00:00
|
|
|
args->act ? &nsa : NULL,
|
|
|
|
args->oact ? &osa : NULL);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
if (args->oact != NULL && !error) {
|
2001-09-08 19:07:04 +00:00
|
|
|
error = copyout(&osa, args->oact, sizeof(l_sigaction_t));
|
1999-09-29 15:12:18 +00:00
|
|
|
}
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
return (error);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
}
|
|
|
|
|
1999-08-14 17:28:46 +00:00
|
|
|
static int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_do_sigprocmask(struct thread *td, int how, l_sigset_t *new,
|
2001-09-08 19:07:04 +00:00
|
|
|
l_sigset_t *old)
|
1999-08-14 17:28:46 +00:00
|
|
|
{
|
2003-04-22 18:23:49 +00:00
|
|
|
sigset_t omask, nmask;
|
|
|
|
sigset_t *nmaskp;
|
2000-12-15 19:41:27 +00:00
|
|
|
int error;
|
1999-09-29 15:12:18 +00:00
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
td->td_retval[0] = 0;
|
1999-09-29 15:12:18 +00:00
|
|
|
|
2003-04-25 19:26:18 +00:00
|
|
|
switch (how) {
|
|
|
|
case LINUX_SIG_BLOCK:
|
|
|
|
how = SIG_BLOCK;
|
|
|
|
break;
|
|
|
|
case LINUX_SIG_UNBLOCK:
|
|
|
|
how = SIG_UNBLOCK;
|
|
|
|
break;
|
|
|
|
case LINUX_SIG_SETMASK:
|
|
|
|
how = SIG_SETMASK;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
1999-09-29 15:12:18 +00:00
|
|
|
if (new != NULL) {
|
2003-04-22 18:23:49 +00:00
|
|
|
linux_to_bsd_sigset(new, &nmask);
|
|
|
|
nmaskp = &nmask;
|
|
|
|
} else
|
|
|
|
nmaskp = NULL;
|
2003-04-25 19:26:18 +00:00
|
|
|
error = kern_sigprocmask(td, how, nmaskp, &omask, 0);
|
2003-04-28 19:43:11 +00:00
|
|
|
if (error == 0 && old != NULL)
|
2003-04-22 18:23:49 +00:00
|
|
|
bsd_to_linux_sigset(&omask, old);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
return (error);
|
1999-08-14 17:28:46 +00:00
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_sigprocmask(struct thread *td, struct linux_sigprocmask_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
{
|
2001-09-08 19:07:04 +00:00
|
|
|
l_osigset_t mask;
|
|
|
|
l_sigset_t set, oset;
|
1999-09-29 15:12:18 +00:00
|
|
|
int error;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-02-16 16:40:43 +00:00
|
|
|
if (ldebug(sigprocmask))
|
|
|
|
printf(ARGS(sigprocmask, "%d, *, *"), args->how);
|
1995-06-25 17:32:43 +00:00
|
|
|
#endif
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
if (args->mask != NULL) {
|
2001-09-08 19:07:04 +00:00
|
|
|
error = copyin(args->mask, &mask, sizeof(l_osigset_t));
|
1999-09-29 15:12:18 +00:00
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
LINUX_SIGEMPTYSET(set);
|
|
|
|
set.__bits[0] = mask;
|
|
|
|
}
|
1999-08-14 17:28:46 +00:00
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
error = linux_do_sigprocmask(td, args->how,
|
1999-09-29 15:12:18 +00:00
|
|
|
args->mask ? &set : NULL,
|
|
|
|
args->omask ? &oset : NULL);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
if (args->omask != NULL && !error) {
|
|
|
|
mask = oset.__bits[0];
|
2001-09-08 19:07:04 +00:00
|
|
|
error = copyout(&mask, args->omask, sizeof(l_osigset_t));
|
1999-09-29 15:12:18 +00:00
|
|
|
}
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
return (error);
|
1999-08-14 17:28:46 +00:00
|
|
|
}
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
1999-08-14 17:28:46 +00:00
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_rt_sigprocmask(struct thread *td, struct linux_rt_sigprocmask_args *args)
|
1999-08-14 17:28:46 +00:00
|
|
|
{
|
2001-09-08 19:07:04 +00:00
|
|
|
l_sigset_t set, oset;
|
1999-09-29 15:12:18 +00:00
|
|
|
int error;
|
1999-08-14 17:28:46 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-02-16 16:40:43 +00:00
|
|
|
if (ldebug(rt_sigprocmask))
|
|
|
|
printf(ARGS(rt_sigprocmask, "%d, %p, %p, %ld"),
|
|
|
|
args->how, (void *)args->mask,
|
|
|
|
(void *)args->omask, (long)args->sigsetsize);
|
1999-08-14 17:28:46 +00:00
|
|
|
#endif
|
|
|
|
|
2001-09-08 19:07:04 +00:00
|
|
|
if (args->sigsetsize != sizeof(l_sigset_t))
|
1999-09-29 15:12:18 +00:00
|
|
|
return EINVAL;
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
if (args->mask != NULL) {
|
2001-09-08 19:07:04 +00:00
|
|
|
error = copyin(args->mask, &set, sizeof(l_sigset_t));
|
1999-09-29 15:12:18 +00:00
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
|
2001-09-12 08:38:13 +00:00
|
|
|
error = linux_do_sigprocmask(td, args->how,
|
1999-09-29 15:12:18 +00:00
|
|
|
args->mask ? &set : NULL,
|
|
|
|
args->omask ? &oset : NULL);
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
if (args->omask != NULL && !error) {
|
2001-09-08 19:07:04 +00:00
|
|
|
error = copyout(&oset, args->omask, sizeof(l_sigset_t));
|
1999-09-29 15:12:18 +00:00
|
|
|
}
|
1999-08-14 17:28:46 +00:00
|
|
|
|
1999-09-29 15:12:18 +00:00
|
|
|
return (error);
|
1995-06-25 17:32:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_sgetmask(struct thread *td, struct linux_sgetmask_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
{
|
2001-09-12 08:38:13 +00:00
|
|
|
struct proc *p = td->td_proc;
|
2001-09-08 19:07:04 +00:00
|
|
|
l_sigset_t mask;
|
1999-09-29 15:12:18 +00:00
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
#ifdef DEBUG
|
2001-09-08 19:07:04 +00:00
|
|
|
if (ldebug(sgetmask))
|
|
|
|
printf(ARGS(sgetmask, ""));
|
1995-06-25 17:32:43 +00:00
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
2000-12-15 19:41:27 +00:00
|
|
|
PROC_LOCK(p);
|
2003-03-31 22:49:17 +00:00
|
|
|
bsd_to_linux_sigset(&td->td_sigmask, &mask);
|
2000-12-15 19:41:27 +00:00
|
|
|
PROC_UNLOCK(p);
|
2001-09-12 08:38:13 +00:00
|
|
|
td->td_retval[0] = mask.__bits[0];
|
1999-09-29 15:12:18 +00:00
|
|
|
return (0);
|
1995-06-25 17:32:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_ssetmask(struct thread *td, struct linux_ssetmask_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
{
|
2001-09-12 08:38:13 +00:00
|
|
|
struct proc *p = td->td_proc;
|
2001-09-08 19:07:04 +00:00
|
|
|
l_sigset_t lset;
|
1999-09-29 15:12:18 +00:00
|
|
|
sigset_t bset;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-09-08 19:07:04 +00:00
|
|
|
if (ldebug(ssetmask))
|
|
|
|
printf(ARGS(ssetmask, "%08lx"), (unsigned long)args->mask);
|
1995-06-25 17:32:43 +00:00
|
|
|
#endif
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
2000-12-15 19:41:27 +00:00
|
|
|
PROC_LOCK(p);
|
2003-03-31 22:49:17 +00:00
|
|
|
bsd_to_linux_sigset(&td->td_sigmask, &lset);
|
2001-09-12 08:38:13 +00:00
|
|
|
td->td_retval[0] = lset.__bits[0];
|
1999-09-29 15:12:18 +00:00
|
|
|
LINUX_SIGEMPTYSET(lset);
|
|
|
|
lset.__bits[0] = args->mask;
|
|
|
|
linux_to_bsd_sigset(&lset, &bset);
|
2003-03-31 22:49:17 +00:00
|
|
|
td->td_sigmask = bset;
|
|
|
|
SIG_CANTMASK(td->td_sigmask);
|
|
|
|
signotify(td);
|
2000-12-15 19:41:27 +00:00
|
|
|
PROC_UNLOCK(p);
|
1999-09-29 15:12:18 +00:00
|
|
|
return (0);
|
1995-06-25 17:32:43 +00:00
|
|
|
}
|
|
|
|
|
2003-02-16 02:33:12 +00:00
|
|
|
/*
|
|
|
|
* MPSAFE
|
|
|
|
*/
|
1995-06-25 17:32:43 +00:00
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_sigpending(struct thread *td, struct linux_sigpending_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
{
|
2001-09-12 08:38:13 +00:00
|
|
|
struct proc *p = td->td_proc;
|
1999-09-29 15:12:18 +00:00
|
|
|
sigset_t bset;
|
2001-09-08 19:07:04 +00:00
|
|
|
l_sigset_t lset;
|
|
|
|
l_osigset_t mask;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-02-16 16:40:43 +00:00
|
|
|
if (ldebug(sigpending))
|
|
|
|
printf(ARGS(sigpending, "*"));
|
1995-06-25 17:32:43 +00:00
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
2000-12-15 19:41:27 +00:00
|
|
|
PROC_LOCK(p);
|
2002-10-01 17:15:53 +00:00
|
|
|
bset = p->p_siglist;
|
2003-03-31 22:49:17 +00:00
|
|
|
SIGSETOR(bset, td->td_siglist);
|
|
|
|
SIGSETAND(bset, td->td_sigmask);
|
2000-12-15 19:41:27 +00:00
|
|
|
PROC_UNLOCK(p);
|
2003-04-17 22:07:56 +00:00
|
|
|
bsd_to_linux_sigset(&bset, &lset);
|
1999-09-29 15:12:18 +00:00
|
|
|
mask = lset.__bits[0];
|
|
|
|
return (copyout(&mask, args->mask, sizeof(mask)));
|
1995-06-25 17:32:43 +00:00
|
|
|
}
|
2006-05-10 18:17:29 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* MPSAFE
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
linux_rt_sigpending(struct thread *td, struct linux_rt_sigpending_args *args)
|
|
|
|
{
|
|
|
|
struct proc *p = td->td_proc;
|
|
|
|
sigset_t bset;
|
|
|
|
l_sigset_t lset;
|
|
|
|
|
|
|
|
if (args->sigsetsize > sizeof(lset))
|
|
|
|
return EINVAL;
|
|
|
|
/* NOT REACHED */
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (ldebug(rt_sigpending))
|
|
|
|
printf(ARGS(rt_sigpending, "*"));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
PROC_LOCK(p);
|
|
|
|
bset = p->p_siglist;
|
|
|
|
SIGSETOR(bset, td->td_siglist);
|
|
|
|
SIGSETAND(bset, td->td_sigmask);
|
|
|
|
PROC_UNLOCK(p);
|
|
|
|
bsd_to_linux_sigset(&bset, &lset);
|
|
|
|
return (copyout(&lset, args->set, args->sigsetsize));
|
|
|
|
}
|
1995-06-25 17:32:43 +00:00
|
|
|
|
2006-12-31 13:16:00 +00:00
|
|
|
/*
|
|
|
|
* MPSAFE
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
linux_rt_sigtimedwait(struct thread *td,
|
|
|
|
struct linux_rt_sigtimedwait_args *args)
|
|
|
|
{
|
2011-02-15 21:42:48 +00:00
|
|
|
int error, sig;
|
2006-12-31 13:16:00 +00:00
|
|
|
l_timeval ltv;
|
|
|
|
struct timeval tv;
|
|
|
|
struct timespec ts, *tsa;
|
|
|
|
l_sigset_t lset;
|
|
|
|
sigset_t bset;
|
|
|
|
l_siginfo_t linfo;
|
|
|
|
ksiginfo_t info;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (ldebug(rt_sigtimedwait))
|
|
|
|
printf(ARGS(rt_sigtimedwait, "*"));
|
|
|
|
#endif
|
|
|
|
if (args->sigsetsize != sizeof(l_sigset_t))
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
if ((error = copyin(args->mask, &lset, sizeof(lset))))
|
|
|
|
return (error);
|
|
|
|
linux_to_bsd_sigset(&lset, &bset);
|
|
|
|
|
|
|
|
tsa = NULL;
|
|
|
|
if (args->timeout) {
|
|
|
|
if ((error = copyin(args->timeout, <v, sizeof(ltv))))
|
|
|
|
return (error);
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (ldebug(rt_sigtimedwait))
|
2011-02-15 21:24:50 +00:00
|
|
|
printf(LMSG("linux_rt_sigtimedwait: "
|
|
|
|
"incoming timeout (%d/%d)\n"),
|
|
|
|
ltv.tv_sec, ltv.tv_usec);
|
2006-12-31 13:16:00 +00:00
|
|
|
#endif
|
|
|
|
tv.tv_sec = (long)ltv.tv_sec;
|
|
|
|
tv.tv_usec = (suseconds_t)ltv.tv_usec;
|
|
|
|
if (itimerfix(&tv)) {
|
|
|
|
/*
|
|
|
|
* The timeout was invalid. Convert it to something
|
|
|
|
* valid that will act as it does under Linux.
|
|
|
|
*/
|
|
|
|
tv.tv_sec += tv.tv_usec / 1000000;
|
|
|
|
tv.tv_usec %= 1000000;
|
|
|
|
if (tv.tv_usec < 0) {
|
|
|
|
tv.tv_sec -= 1;
|
|
|
|
tv.tv_usec += 1000000;
|
|
|
|
}
|
|
|
|
if (tv.tv_sec < 0)
|
|
|
|
timevalclear(&tv);
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (ldebug(rt_sigtimedwait))
|
2011-02-15 21:24:50 +00:00
|
|
|
printf(LMSG("linux_rt_sigtimedwait: "
|
|
|
|
"converted timeout (%jd/%ld)\n"),
|
|
|
|
(intmax_t)tv.tv_sec, tv.tv_usec);
|
2006-12-31 13:16:00 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
TIMEVAL_TO_TIMESPEC(&tv, &ts);
|
|
|
|
tsa = &ts;
|
|
|
|
}
|
|
|
|
error = kern_sigtimedwait(td, bset, &info, tsa);
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (ldebug(rt_sigtimedwait))
|
2011-02-15 21:24:50 +00:00
|
|
|
printf(LMSG("linux_rt_sigtimedwait: "
|
|
|
|
"sigtimedwait returning (%d)\n"), error);
|
2006-12-31 13:16:00 +00:00
|
|
|
#endif
|
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
|
2011-02-15 21:42:48 +00:00
|
|
|
sig = BSD_TO_LINUX_SIGNAL(info.ksi_signo);
|
|
|
|
|
2006-12-31 13:16:00 +00:00
|
|
|
if (args->ptr) {
|
|
|
|
memset(&linfo, 0, sizeof(linfo));
|
2011-02-15 21:42:48 +00:00
|
|
|
ksiginfo_to_lsiginfo(&info, &linfo, sig);
|
2006-12-31 13:16:00 +00:00
|
|
|
error = copyout(&linfo, args->ptr, sizeof(linfo));
|
|
|
|
}
|
2011-02-15 21:42:48 +00:00
|
|
|
if (error == 0)
|
|
|
|
td->td_retval[0] = sig;
|
2006-12-31 13:16:00 +00:00
|
|
|
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
linux_kill(struct thread *td, struct linux_kill_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
{
|
1999-09-29 15:12:18 +00:00
|
|
|
struct kill_args /* {
|
|
|
|
int pid;
|
|
|
|
int signum;
|
|
|
|
} */ tmp;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
#ifdef DEBUG
|
2001-02-16 16:40:43 +00:00
|
|
|
if (ldebug(kill))
|
|
|
|
printf(ARGS(kill, "%d, %d"), args->pid, args->signum);
|
1995-06-25 17:32:43 +00:00
|
|
|
#endif
|
1999-09-29 15:12:18 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Allow signal 0 as a means to check for privileges
|
|
|
|
*/
|
2006-10-15 14:34:03 +00:00
|
|
|
if (!LINUX_SIG_VALID(args->signum) && args->signum != 0)
|
2011-01-23 09:50:39 +00:00
|
|
|
return (EINVAL);
|
1999-09-29 15:12:18 +00:00
|
|
|
|
|
|
|
if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ)
|
|
|
|
tmp.signum = linux_to_bsd_signal[_SIG_IDX(args->signum)];
|
|
|
|
else
|
|
|
|
tmp.signum = args->signum;
|
|
|
|
|
|
|
|
tmp.pid = args->pid;
|
2011-09-16 13:58:51 +00:00
|
|
|
return (sys_kill(td, &tmp));
|
1995-06-25 17:32:43 +00:00
|
|
|
}
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2008-10-19 10:02:26 +00:00
|
|
|
static int
|
|
|
|
linux_do_tkill(struct thread *td, l_int tgid, l_int pid, l_int signum)
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
{
|
2008-10-19 10:02:26 +00:00
|
|
|
struct proc *proc = td->td_proc;
|
|
|
|
struct linux_emuldata *em;
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
struct proc *p;
|
2008-10-19 10:02:26 +00:00
|
|
|
ksiginfo_t ksi;
|
|
|
|
int error;
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2009-06-27 13:58:44 +00:00
|
|
|
AUDIT_ARG_SIGNUM(signum);
|
|
|
|
AUDIT_ARG_PID(pid);
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2008-10-19 10:02:26 +00:00
|
|
|
/*
|
|
|
|
* Allow signal 0 as a means to check for privileges
|
|
|
|
*/
|
|
|
|
if (!LINUX_SIG_VALID(signum) && signum != 0)
|
|
|
|
return (EINVAL);
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2008-10-19 10:02:26 +00:00
|
|
|
if (signum > 0 && signum <= LINUX_SIGTBLSZ)
|
|
|
|
signum = linux_to_bsd_signal[_SIG_IDX(signum)];
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2008-10-19 10:02:26 +00:00
|
|
|
if ((p = pfind(pid)) == NULL) {
|
|
|
|
if ((p = zpfind(pid)) == NULL)
|
|
|
|
return (ESRCH);
|
|
|
|
}
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2009-06-27 13:58:44 +00:00
|
|
|
AUDIT_ARG_PROCESS(p);
|
2008-10-19 10:02:26 +00:00
|
|
|
error = p_cansignal(td, p, signum);
|
2009-12-18 14:27:18 +00:00
|
|
|
if (error != 0 || signum == 0)
|
2008-10-19 10:02:26 +00:00
|
|
|
goto out;
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2008-10-19 10:02:26 +00:00
|
|
|
error = ESRCH;
|
2007-01-07 19:14:06 +00:00
|
|
|
em = em_find(p, EMUL_DONTLOCK);
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
|
|
|
if (em == NULL) {
|
|
|
|
#ifdef DEBUG
|
2008-10-19 10:02:26 +00:00
|
|
|
printf("emuldata not found in do_tkill.\n");
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
#endif
|
2008-10-19 10:02:26 +00:00
|
|
|
goto out;
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
}
|
2008-10-19 10:02:26 +00:00
|
|
|
if (tgid > 0 && em->shared->group_pid != tgid)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
ksiginfo_init(&ksi);
|
|
|
|
ksi.ksi_signo = signum;
|
|
|
|
ksi.ksi_code = LINUX_SI_TKILL;
|
|
|
|
ksi.ksi_errno = 0;
|
|
|
|
ksi.ksi_pid = proc->p_pid;
|
|
|
|
ksi.ksi_uid = proc->p_ucred->cr_ruid;
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2010-06-29 20:41:52 +00:00
|
|
|
error = pksignal(p, ksi.ksi_signo, &ksi);
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2008-10-19 10:02:26 +00:00
|
|
|
out:
|
|
|
|
PROC_UNLOCK(p);
|
|
|
|
return (error);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
linux_tgkill(struct thread *td, struct linux_tgkill_args *args)
|
|
|
|
{
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (ldebug(tgkill))
|
|
|
|
printf(ARGS(tgkill, "%d, %d, %d"), args->tgid, args->pid, args->sig);
|
|
|
|
#endif
|
|
|
|
if (args->pid <= 0 || args->tgid <=0)
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
return (linux_do_tkill(td, args->tgid, args->pid, args->sig));
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
linux_tkill(struct thread *td, struct linux_tkill_args *args)
|
|
|
|
{
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (ldebug(tkill))
|
|
|
|
printf(ARGS(tkill, "%i, %i"), args->tid, args->sig);
|
|
|
|
#endif
|
2008-10-19 10:02:26 +00:00
|
|
|
if (args->tid <= 0)
|
|
|
|
return (EINVAL);
|
|
|
|
|
|
|
|
return (linux_do_tkill(td, 0, args->tid, args->sig));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
ksiginfo_to_lsiginfo(ksiginfo_t *ksi, l_siginfo_t *lsi, l_int sig)
|
|
|
|
{
|
|
|
|
|
|
|
|
lsi->lsi_signo = sig;
|
|
|
|
lsi->lsi_code = ksi->ksi_code;
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
|
2008-10-19 10:02:26 +00:00
|
|
|
switch (sig) {
|
|
|
|
case LINUX_SIGPOLL:
|
|
|
|
/* XXX si_fd? */
|
|
|
|
lsi->lsi_band = ksi->ksi_band;
|
|
|
|
break;
|
|
|
|
case LINUX_SIGCHLD:
|
|
|
|
lsi->lsi_pid = ksi->ksi_pid;
|
|
|
|
lsi->lsi_uid = ksi->ksi_uid;
|
|
|
|
lsi->lsi_status = ksi->ksi_status;
|
|
|
|
break;
|
|
|
|
case LINUX_SIGBUS:
|
|
|
|
case LINUX_SIGILL:
|
|
|
|
case LINUX_SIGFPE:
|
|
|
|
case LINUX_SIGSEGV:
|
|
|
|
lsi->lsi_addr = PTROUT(ksi->ksi_addr);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* XXX SI_TIMER etc... */
|
|
|
|
lsi->lsi_pid = ksi->ksi_pid;
|
|
|
|
lsi->lsi_uid = ksi->ksi_uid;
|
|
|
|
break;
|
|
|
|
}
|
2011-02-15 21:46:36 +00:00
|
|
|
if (sig >= LINUX_SIGRTMIN) {
|
|
|
|
lsi->lsi_int = ksi->ksi_info.si_value.sival_int;
|
|
|
|
lsi->lsi_ptr = PTROUT(ksi->ksi_info.si_value.sival_ptr);
|
|
|
|
}
|
Add the linux 2.6.x stuff (not used by default!):
- TLS - complete
- pid/tid mangling - complete
- thread area - complete
- futexes - complete with issues
- clone() extension - complete with some possible minor issues
- mq*/timer*/clock* stuff - complete but untested and the mq* stuff is
disabled when not build as part of the kernel with native FreeBSD mq*
support (module support for this will come later)
Tested with:
- linux-firefox - works, tested
- linux-opera - works, tested
- linux-realplay - doesnt work, issue with futexes
- linux-skype - doesnt work, issue with futexes
- linux-rt2-demo - works, tested
- linux-acroread - doesnt work, unknown reason (coredump) and sometimes
issue with futexes
- various unix utilities in linux-base-gentoo3 and linux-base-fc4:
everything tried worked
On amd64 not everything is supported like on i386, the catchup is planned for
later when the remaining bugs in the new functions are fixed.
To test this new stuff, you have to run
sysctl compat.linux.osrelease=2.6.16
to switch back use
sysctl compat.linux.osrelease=2.4.2
Don't switch while running a linux program, strange things may or may not
happen.
Sponsored by: Google SoC 2006
Submitted by: rdivacky
Some suggestions/help by: jhb, kib, manu@NetBSD.org, netchild
2006-08-15 12:54:30 +00:00
|
|
|
}
|