bug-mes
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 10/16] lib: General Linux RV64 syscall support.


From: Jan Nieuwenhuizen
Subject: Re: [PATCH 10/16] lib: General Linux RV64 syscall support.
Date: Sun, 02 May 2021 17:48:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)

W. J. van der Laan writes:

> diff --git a/lib/linux/_open3.c b/lib/linux/_open3.c
> index 
> 8f103e7bcd874daccd10e9fd7ef4337574b4e783..524e23e69b8745f7fb2e16d3178f332190b9043e
>  100644
> --- a/lib/linux/_open3.c
> +++ b/lib/linux/_open3.c
> @@ -26,7 +26,13 @@
>  int
>  _open3 (char const *file_name, int flags, int mask)
>  {
> +#if defined(SYS_open)
>    int r = _sys_call3 (SYS_open, (long) file_name, (int) flags, (int) mask);
> +#elif defined(SYS_openat)
> +  int r = _sys_call4 (SYS_openat, AT_FDCWD, (long) file_name, (int) flags, 
> (int) mask);
> +#else
> +#error No usable open syscall
> +#endif

Why use openAT here instead of open?  If we really want openat on
RISC-V, I would like to support this without all these repeated macros
and move these at variants to their own file

   lib/linux/_openat3.c, or
   lib/linux/at/_open3.c
   lib/linux/<api?>/_open3.c

and update build-aux/configure-lib.sh accordingly.

[..]

> diff --git a/lib/linux/waitpid.c b/lib/linux/waitpid.c
> index 
> 693e3dfa0392efc999deaea2d7ddca6ac6530229..cd2882e4f9bb5c141ae0b979cf5a941d3266fe4e
>  100644
> --- a/lib/linux/waitpid.c
> +++ b/lib/linux/waitpid.c
> @@ -27,7 +27,7 @@ waitpid (pid_t pid, int *status_ptr, int options)
>  {
>  #if __i386__
>    return _sys_call3 (SYS_waitpid, (long) pid, (long) status_ptr, (int) 
> options);
> -#elif __x86_64__ || __arm__
> +#elif __x86_64__ || __arm__ || __riscv
>    return _sys_call4 (SYS_wait4, (long) pid, (long) status_ptr, (int) 
> options, 0);
>  #else
>  #error arch not supported

Similarly, let's use something like

   lib/linux/waitpid4.c
   lib/linux/<api??>/waitpid4.c

Note that the wip-m2 branch, which adds M2-Planet support, removes most
preprocessor magic.

What do you think?  (ideas, Danny?)

I have marked this commit DRAFT for now; applied to wip-riscv.

Greetings,
Janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | AvatarĀ® http://AvatarAcademy.com



reply via email to

[Prev in Thread] Current Thread [Next in Thread]