Patchwork linux-user,alpha: correct select()

login
register
mail settings
Submitter Laurent Vivier
Date Jan. 7, 2013, 10:38 p.m.
Message ID <1357598314-21156-1-git-send-email-laurent@vivier.eu>
Download mbox | patch
Permalink /patch/210258/
State New
Headers show

Comments

Laurent Vivier - Jan. 7, 2013, 10:38 p.m.
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
---
 linux-user/syscall.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
Richard Henderson - Jan. 7, 2013, 11:14 p.m.
On 01/07/2013 02:38 PM, Laurent Vivier wrote:
> -#if defined(TARGET_NR_select) && !defined(TARGET_S390X) && !defined(TARGET_S390)
> +#if defined(TARGET_NR_select) && !defined(TARGET_S390X) && \
> +                                 !defined(TARGET_S390) && \
> +                                 !defined(TARGET_ALPHA)
>      case TARGET_NR_select:
>          {
>              struct target_sel_arg_struct *sel;
> @@ -7189,8 +7191,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
>          }
>          break;
>  #endif /* TARGET_NR_getdents64 */
> -#if defined(TARGET_NR__newselect) || defined(TARGET_S390X)
> -#ifdef TARGET_S390X
> +#if defined(TARGET_NR__newselect) || defined(TARGET_S390X) \
> +                                  || defined(TARGET_ALPHA)
> +#if defined(TARGET_S390X) || defined(TARGET_ALPHA)
>      case TARGET_NR_select:
>  #else
>      case TARGET_NR__newselect:

I would much prefer to see these blocks moved around so that it's of the form

#if defined(TARGET_NR_select)
  case TARGET_NR_select:
# if defined(TARGET_ALPHA) || defined(TARGET_S390X)
    ret = do_select(arg1, arg2, arg3, arg4, arg5);
# else
    {
      other stuff
    }
# endif
    break;
#endif
#if defined(TARGET_NR__newselect)
  case TARGET_NR__newselect:
    ret = do_select(arg1, arg2, arg3, arg4, arg5);
    break;
#endif

I sincerely dislike sequences of defined and !defined that must be in sync.
Also note that there is no TARGET_S390, only TARGET_S390X.  We only emulate
the 64-bit guest.


r~
Laurent Vivier - Jan. 8, 2013, 9:28 a.m.
Le 8 janvier 2013 à 00:14, Richard Henderson <rth@twiddle.net> a écrit :
> On 01/07/2013 02:38 PM, Laurent Vivier wrote:
> > -#if defined(TARGET_NR_select) && !defined(TARGET_S390X) &&
> > !defined(TARGET_S390)
> > +#if defined(TARGET_NR_select) && !defined(TARGET_S390X) && \
> > + !defined(TARGET_S390) && \
> > + !defined(TARGET_ALPHA)
> > case TARGET_NR_select:
> > {
> > struct target_sel_arg_struct *sel;
> > @@ -7189,8 +7191,9 @@ abi_long do_syscall(void *cpu_env, int num, abi_long
> > arg1,
> > }
> > break;
> > #endif /* TARGET_NR_getdents64 */
> > -#if defined(TARGET_NR__newselect) || defined(TARGET_S390X)
> > -#ifdef TARGET_S390X
> > +#if defined(TARGET_NR__newselect) || defined(TARGET_S390X) \
> > + || defined(TARGET_ALPHA)
> > +#if defined(TARGET_S390X) || defined(TARGET_ALPHA)
> > case TARGET_NR_select:
> > #else
> > case TARGET_NR__newselect:
>
> I would much prefer to see these blocks moved around so that it's of the form
>
> #if defined(TARGET_NR_select)
> case TARGET_NR_select:
> # if defined(TARGET_ALPHA) || defined(TARGET_S390X)
> ret = do_select(arg1, arg2, arg3, arg4, arg5);
> # else
> {
> other stuff
> }
> # endif
> break;
> #endif
> #if defined(TARGET_NR__newselect)
> case TARGET_NR__newselect:
> ret = do_select(arg1, arg2, arg3, arg4, arg5);
> break;
> #endif
>
> I sincerely dislike sequences of defined and !defined that must be in sync.
> Also note that there is no TARGET_S390, only TARGET_S390X. We only emulate
> the 64-bit guest.
>

I agree with you, but I like to keep my patches as minimal as possible : I just
add the TARGET_ALPHA on the line.
If I'm able to test the TARGET_S390X, I will try to rewrite this patch as you
explain.

Regards,
Laurent

Patch

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2232bb8..76bafff 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6249,7 +6249,9 @@  abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
             ret = get_errno(settimeofday(&tv, NULL));
         }
         break;
-#if defined(TARGET_NR_select) && !defined(TARGET_S390X) && !defined(TARGET_S390)
+#if defined(TARGET_NR_select) && !defined(TARGET_S390X) && \
+                                 !defined(TARGET_S390) && \
+                                 !defined(TARGET_ALPHA)
     case TARGET_NR_select:
         {
             struct target_sel_arg_struct *sel;
@@ -7189,8 +7191,9 @@  abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
         }
         break;
 #endif /* TARGET_NR_getdents64 */
-#if defined(TARGET_NR__newselect) || defined(TARGET_S390X)
-#ifdef TARGET_S390X
+#if defined(TARGET_NR__newselect) || defined(TARGET_S390X) \
+                                  || defined(TARGET_ALPHA)
+#if defined(TARGET_S390X) || defined(TARGET_ALPHA)
     case TARGET_NR_select:
 #else
     case TARGET_NR__newselect: