mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-13 10:02:38 +00:00
This is the first of 3 commits that will get IBM's JDK 1.3 working
with FreeBSD (not including the MINSIGSTKSZ issue, which belongs to Marcel). Due to time constraints, I'm going to space them out over a few days. This fixes two problems with linux_sigaltstack() o ss == 0 is perfectly valid use, so do not fail in this case. o Fix flag handling: - Our SS_DISABLE is 4, linux's is 2, so we need conversion routines. These conversion routines will be needed by linux_rt_sendsig() and linux_rt_sigreturn (forthcoming), so they are not static. - Linux's flag 0 historically meant SS_ONSTACK according to a comment in their linux/kernel/signal.c file. Among other things, this fixes a warning from Sun's JDK 1.3: "Java HotSpot(TM) Client VM warning: cannot uninstall alt signal stack" Reviewed by: marcel Tested by: sto@stat.duke.edu, many others on freebsd-java@
This commit is contained in:
parent
13387c45eb
commit
931a725809
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=67051
@ -159,6 +159,14 @@ struct linux_new_utsname {
|
||||
|
||||
/* sigaltstack */
|
||||
#define LINUX_MINSIGSTKSZ 2048
|
||||
#define LINUX_SS_ONSTACK_BC 0 /* backwards compat SS_ONSTACK */
|
||||
#define LINUX_SS_ONSTACK 1
|
||||
#define LINUX_SS_DISABLE 2
|
||||
|
||||
|
||||
int linux_to_bsd_sigaltstack(int lsa);
|
||||
int bsd_to_linux_sigaltstack(int bsa);
|
||||
|
||||
|
||||
typedef void (*linux_handler_t)(int);
|
||||
typedef u_long linux_osigset_t;
|
||||
|
@ -66,6 +66,32 @@ struct linux_select_argv {
|
||||
struct timeval *timeout;
|
||||
};
|
||||
|
||||
int
|
||||
linux_to_bsd_sigaltstack(int lsa)
|
||||
{
|
||||
int bsa = 0;
|
||||
|
||||
if (lsa & LINUX_SS_DISABLE)
|
||||
bsa |= SS_DISABLE;
|
||||
if (lsa & LINUX_SS_ONSTACK)
|
||||
bsa |= SS_ONSTACK;
|
||||
if (lsa == LINUX_SS_ONSTACK_BC)
|
||||
bsa = SS_ONSTACK;
|
||||
return (bsa);
|
||||
}
|
||||
|
||||
int
|
||||
bsd_to_linux_sigaltstack(int bsa)
|
||||
{
|
||||
int lsa = 0;
|
||||
|
||||
if (bsa & SS_DISABLE)
|
||||
lsa |= LINUX_SS_DISABLE;
|
||||
if (bsa & SS_ONSTACK)
|
||||
lsa |= LINUX_SS_ONSTACK;
|
||||
return (lsa);
|
||||
}
|
||||
|
||||
int
|
||||
linux_execve(struct proc *p, struct linux_execve_args *args)
|
||||
{
|
||||
@ -606,16 +632,19 @@ linux_sigaltstack(p, uap)
|
||||
(long)p->p_pid, uap->uss, uap->uoss);
|
||||
#endif
|
||||
|
||||
error = copyin(uap->uss, &lss, sizeof(linux_stack_t));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
ss = stackgap_alloc(&sg, sizeof(stack_t));
|
||||
ss->ss_sp = lss.ss_sp;
|
||||
ss->ss_size = (lss.ss_size >= LINUX_MINSIGSTKSZ &&
|
||||
lss.ss_size < MINSIGSTKSZ) ? MINSIGSTKSZ : lss.ss_size;
|
||||
ss->ss_flags = lss.ss_flags;
|
||||
if (uap->uss == NULL) {
|
||||
ss = NULL;
|
||||
} else {
|
||||
error = copyin(uap->uss, &lss, sizeof(linux_stack_t));
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
ss = stackgap_alloc(&sg, sizeof(stack_t));
|
||||
ss->ss_sp = lss.ss_sp;
|
||||
ss->ss_size = (lss.ss_size >= LINUX_MINSIGSTKSZ &&
|
||||
lss.ss_size < MINSIGSTKSZ) ? MINSIGSTKSZ : lss.ss_size;
|
||||
ss->ss_flags = linux_to_bsd_sigaltstack(lss.ss_flags);
|
||||
}
|
||||
oss = (uap->uoss != NULL)
|
||||
? stackgap_alloc(&sg, sizeof(stack_t))
|
||||
: NULL;
|
||||
@ -627,7 +656,7 @@ linux_sigaltstack(p, uap)
|
||||
if (!error && oss != NULL) {
|
||||
lss.ss_sp = oss->ss_sp;
|
||||
lss.ss_size = oss->ss_size;
|
||||
lss.ss_flags = oss->ss_flags;
|
||||
lss.ss_flags = bsd_to_linux_sigaltstack(oss->ss_flags);
|
||||
error = copyout(&lss, uap->uoss, sizeof(linux_stack_t));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user