qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Vivier <laurent@vivier.eu>
To: Filip Bozuta <Filip.Bozuta@syrmia.com>, qemu-devel@nongnu.org
Cc: Riku Voipio <riku.voipio@iki.fi>
Subject: Re: [PATCH v2 2/2] linux-user: Add support for 'rt_sigtimedwait_time64()' and 'sched_rr_get_interval_time64()'
Date: Mon, 24 Aug 2020 18:43:25 +0200	[thread overview]
Message-ID: <98a62001-b6df-fe1c-0e8d-7407086f6005@vivier.eu> (raw)
In-Reply-To: <20200727112307.343608-3-Filip.Bozuta@syrmia.com>

Le 27/07/2020 à 13:23, Filip Bozuta a écrit :
> This patch implements functionality for following time64 syscalls:
> 
> *rt_sigtimedwait_time64()
> 
>     This is a year 2038 safe variant of syscall:
> 
>     int rt_sigtimedwait(const sigset_t *set, siginfo_t *info,
>                         const struct timespec *timeout, size_t sigsetsize)
>     --synchronously wait for queued signals--
>     man page: https://man7.org/linux/man-pages/man2/rt_sigtimedwait.2.html
> 
> *sched_rr_get_interval_time64()
> 
>     This is a year 2038 safe variant of syscall:
> 
>     int sched_rr_get_interval(pid_t pid, struct timespec *tp)
>     --get  the  SCHED_RR  interval  for the named process--
>     man page: https://man7.org/linux/man-pages/man2/sched_rr_get_interval.2.html
> 
> Implementation notes:
> 
>     These syscalls were implemented in similar ways like
>     'rt_sigtimedwait()' and 'sched_rr_get_interval()' except
>     that functions 'target_to_host_timespec64()' and
>     'host_to_target_timespec64()' were used to convert values
>     of 'struct timespec' between host and target.
> 
> Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
> ---
>  linux-user/syscall.c | 53 ++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 53 insertions(+)
> 
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index c1b36ea698..35f6dded81 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -8831,6 +8831,48 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
>              }
>          }
>          return ret;
> +#endif
> +#ifdef TARGET_NR_rt_sigtimedwait_time64
> +    case TARGET_NR_rt_sigtimedwait_time64:
> +        {
> +            sigset_t set;
> +            struct timespec uts, *puts;
> +            siginfo_t uinfo;
> +
> +            if (arg4 != sizeof(target_sigset_t)) {
> +                return -TARGET_EINVAL;
> +            }
> +
> +            p = lock_user(VERIFY_READ, arg1, sizeof(target_sigset_t), 1);
> +            if (!p) {
> +                return -TARGET_EFAULT;
> +            }
> +            target_to_host_sigset(&set, p);
> +            unlock_user(p, arg1, 0);
> +            if (arg3) {
> +                puts = &uts;
> +                if (target_to_host_timespec64(puts, arg3)) {
> +                    return -TARGET_EFAULT;
> +                }
> +            } else {
> +                puts = NULL;
> +            }
> +            ret = get_errno(safe_rt_sigtimedwait(&set, &uinfo, puts,
> +                                                 SIGSET_T_SIZE));
> +            if (!is_error(ret)) {
> +                if (arg2) {
> +                    p = lock_user(VERIFY_WRITE, arg2,
> +                                  sizeof(target_siginfo_t), 0);
> +                    if (!p) {
> +                        return -TARGET_EFAULT;
> +                    }
> +                    host_to_target_siginfo(p, &uinfo);
> +                    unlock_user(p, arg2, sizeof(target_siginfo_t));
> +                }
> +                ret = host_to_target_signal(ret);
> +            }
> +        }
> +        return ret;
>  #endif
>      case TARGET_NR_rt_sigqueueinfo:
>          {
> @@ -10353,6 +10395,17 @@ static abi_long do_syscall1(void *cpu_env, int num, abi_long arg1,
>          }
>          return ret;
>  #endif
> +#ifdef TARGET_NR_sched_rr_get_interval_time64
> +    case TARGET_NR_sched_rr_get_interval_time64:
> +        {
> +            struct timespec ts;
> +            ret = get_errno(sched_rr_get_interval(arg1, &ts));
> +            if (!is_error(ret)) {
> +                ret = host_to_target_timespec64(arg2, &ts);
> +            }
> +        }
> +        return ret;
> +#endif
>  #if defined(TARGET_NR_nanosleep)
>      case TARGET_NR_nanosleep:
>          {
> 

Reviewed-by: Laurent Vivier <laurent@vivier.eu>


      reply	other threads:[~2020-08-24 16:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-27 11:23 [PATCH v2 0/2] Introducing functionality for a group of 4 time64 syscalls Filip Bozuta
2020-07-27 11:23 ` [PATCH v2 1/2] linux-user: Add support for two 'clock_nanosleep_time64()' and 'clock_adjtime64()' Filip Bozuta
2020-08-24 16:40   ` Laurent Vivier
2020-07-27 11:23 ` [PATCH v2 2/2] linux-user: Add support for 'rt_sigtimedwait_time64()' and 'sched_rr_get_interval_time64()' Filip Bozuta
2020-08-24 16:43   ` Laurent Vivier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=98a62001-b6df-fe1c-0e8d-7407086f6005@vivier.eu \
    --to=laurent@vivier.eu \
    --cc=Filip.Bozuta@syrmia.com \
    --cc=qemu-devel@nongnu.org \
    --cc=riku.voipio@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).