diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-20 20:23:07 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-10-20 20:23:07 +0000 |
commit | 0da46a6e2e5fc10b757612e9ac1707dc1fb6dc5a (patch) | |
tree | 2e69bf8afad4b317654d07061bb2447af0711278 /linux-user/signal.c | |
parent | 1931e26054fdf2b1b84091f0b9662979eb6931ec (diff) |
Syscall target errno fixes, by Thayne Harbaugh.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3418 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'linux-user/signal.c')
-rw-r--r-- | linux-user/signal.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/linux-user/signal.c b/linux-user/signal.c index cacbc69920..0c5944abab 100644 --- a/linux-user/signal.c +++ b/linux-user/signal.c @@ -438,6 +438,7 @@ static void host_signal_handler(int host_signum, siginfo_t *info, } } +/* do_sigaltstack() returns target values and errnos. */ int do_sigaltstack(const struct target_sigaltstack *uss, struct target_sigaltstack *uoss, abi_ulong sp) @@ -457,18 +458,18 @@ int do_sigaltstack(const struct target_sigaltstack *uss, { struct target_sigaltstack ss; - ret = -EFAULT; + ret = -TARGET_EFAULT; if (!access_ok(VERIFY_READ, uss, sizeof(*uss)) || __get_user(ss.ss_sp, &uss->ss_sp) || __get_user(ss.ss_size, &uss->ss_size) || __get_user(ss.ss_flags, &uss->ss_flags)) goto out; - ret = -EPERM; + ret = -TARGET_EPERM; if (on_sig_stack(sp)) goto out; - ret = -EINVAL; + ret = -TARGET_EINVAL; if (ss.ss_flags != TARGET_SS_DISABLE && ss.ss_flags != TARGET_SS_ONSTACK && ss.ss_flags != 0) @@ -478,7 +479,7 @@ int do_sigaltstack(const struct target_sigaltstack *uss, ss.ss_size = 0; ss.ss_sp = 0; } else { - ret = -ENOMEM; + ret = -TARGET_ENOMEM; if (ss.ss_size < MINSIGSTKSZ) goto out; } @@ -488,7 +489,7 @@ int do_sigaltstack(const struct target_sigaltstack *uss, } if (uoss) { - ret = -EFAULT; + ret = -TARGET_EFAULT; if (!access_ok(VERIFY_WRITE, uoss, sizeof(oss))) goto out; memcpy(uoss, &oss, sizeof(oss)); @@ -499,12 +500,14 @@ out: return ret; } +/* do_sigaction() return host values and errnos */ int do_sigaction(int sig, const struct target_sigaction *act, struct target_sigaction *oact) { struct emulated_sigaction *k; struct sigaction act1; int host_sig; + int ret = 0; if (sig < 1 || sig > TARGET_NSIG || sig == SIGKILL || sig == SIGSTOP) return -EINVAL; @@ -546,10 +549,10 @@ int do_sigaction(int sig, const struct target_sigaction *act, } else { act1.sa_sigaction = host_signal_handler; } - sigaction(host_sig, &act1, NULL); + ret = sigaction(host_sig, &act1, NULL); } } - return 0; + return ret; } #ifndef offsetof |