Patchwork [8/9] alpha-linux-user: Properly handle the non-rt sigprocmask syscall.

login
register
mail settings
Submitter Richard Henderson
Date June 7, 2012, 10:24 p.m.
Message ID <1339107871-4487-9-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/163685/
State New
Headers show

Comments

Richard Henderson - June 7, 2012, 10:24 p.m.
Name the syscall properly for QEMU, kernel source notwithstanding.
Fix syntax errors in the code thus enabled within do_syscall.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 linux-user/alpha/syscall_nr.h |    2 +-
 linux-user/syscall.c          |    9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
Peter Maydell - June 22, 2012, 2:27 p.m.
On 7 June 2012 23:24, Richard Henderson <rth@twiddle.net> wrote:
> @@ -5880,12 +5880,13 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
>             mask = arg2;
>             target_to_host_old_sigset(&set, &mask);
>
> -            ret = get_errno(sigprocmask(how, &set, &oldset));
> -
> -            if (!is_error(ret)) {
> +            ret = sigprocmask(how, &set, &oldset);
> +            if (is_error(ret)) {
> +                ret = get_errno(ret);
> +            } else {

This looks kinda bogus. get_errno() is supposed to be used on
something which is a (value-or-negative-for-target-errno) value,
eg what you get out of get_errno(). If you're just testing the
straight return value from the host sigprocmask() then
"if (ret == -1)" or similar would be better.

-- PMM

Patch

diff --git a/linux-user/alpha/syscall_nr.h b/linux-user/alpha/syscall_nr.h
index f6284db..49648a1 100644
--- a/linux-user/alpha/syscall_nr.h
+++ b/linux-user/alpha/syscall_nr.h
@@ -46,7 +46,7 @@ 
 #define TARGET_NR_open		 45
 #define TARGET_NR_osf_old_sigaction	 46	/* not implemented */
 #define TARGET_NR_getxgid		 47
-#define TARGET_NR_osf_sigprocmask	 48
+#define TARGET_NR_sigprocmask	 48
 #define TARGET_NR_osf_getlogin	 49	/* not implemented */
 #define TARGET_NR_osf_setlogin	 50	/* not implemented */
 #define TARGET_NR_acct		 51
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1a12f14..bc77b79 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5880,12 +5880,13 @@  abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
             mask = arg2;
             target_to_host_old_sigset(&set, &mask);
 
-            ret = get_errno(sigprocmask(how, &set, &oldset));
-
-            if (!is_error(ret)) {
+            ret = sigprocmask(how, &set, &oldset);
+            if (is_error(ret)) {
+                ret = get_errno(ret);
+            } else {
                 host_to_target_old_sigset(&mask, &oldset);
                 ret = mask;
-                ((CPUAlphaState *)cpu_env)->[IR_V0] = 0; /* force no error */
+                ((CPUAlphaState *)cpu_env)->ir[IR_V0] = 0; /* force no error */
             }
 #else
             sigset_t set, oldset, *set_ptr;