All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Lena Djokic <Lena.Djokic@rt-rk.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>,
	Riku Voipio <riku.voipio@iki.fi>
Subject: Re: [Qemu-devel] [PATCH v2 4/7] linux-user: Fix fcnt
Date: Fri, 16 Dec 2016 14:45:02 +0000	[thread overview]
Message-ID: <CAFEAcA_D6efAX_Hcy4LeTsVvhA1dMAks14v5zptyw-5wvmFarA@mail.gmail.com> (raw)
In-Reply-To: <1480003738-8754-5-git-send-email-Lena.Djokic@rt-rk.com>

On 24 November 2016 at 16:08, Lena Djokic <Lena.Djokic@rt-rk.com> wrote:

Making the subject line "linux-user: fix F_GETSIG and F_SETSIG fcntls"
would be a bit more precise about what we're fixing here and I think
that will be helpful for people looking back in the git log later.

> F_GETSIG and F_SETSIG were implemented with default behaviour which
> simply passes given arguments to fcntl syscall, but since those
> arguments are signals used for communication between taget and

typo: "target"

> host we need conversion which is done by using host_to_target signal
> and taget_to_host_signal functions.

"target"

>
> Signed-off-by: Lena Djokic <Lena.Djokic@rt-rk.com>
> ---
>  linux-user/syscall.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/linux-user/syscall.c b/linux-user/syscall.c
> index 41873ca..1b59a71 100644
> --- a/linux-user/syscall.c
> +++ b/linux-user/syscall.c
> @@ -6544,14 +6544,18 @@ static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
>
>      case TARGET_F_SETOWN:
>      case TARGET_F_GETOWN:
> -    case TARGET_F_SETSIG:
> -    case TARGET_F_GETSIG:
>      case TARGET_F_SETLEASE:
>      case TARGET_F_GETLEASE:
>      case TARGET_F_SETPIPE_SZ:
>      case TARGET_F_GETPIPE_SZ:
>          ret = get_errno(safe_fcntl(fd, host_cmd, arg));
>          break;
> +    case TARGET_F_GETSIG:
> +        ret = host_to_target_signal(get_errno(fcntl(fd, host_cmd, arg)));
> +        break;
> +    case TARGET_F_SETSIG:
> +        ret = get_errno(fcntl(fd, host_cmd, target_to_host_signal(arg)));
> +        break;

This is basically right, but I suggest some minor changes:
 * put these special cases above the long list of 'just call fcntl'
   cases, not below it
 * these should both call safe_fcntl(), not fcntl()
 * don't call host_to_target_signal() unless we know the call
   succeeded (compare the code used for TARGET_F_GETLK, TARGET_F_GETFL, etc)

>
>      default:
>          ret = get_errno(safe_fcntl(fd, cmd, arg));

thanks
-- PMM

  reply	other threads:[~2016-12-16 14:45 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-24 16:08 [Qemu-devel] [PATCH v2 0/7] Improvements of qemu linux-user Lena Djokic
2016-11-24 16:08 ` [Qemu-devel] [PATCH v2 1/7] linux-user: Add fanotify implementation Lena Djokic
2016-12-16 16:43   ` Peter Maydell
2016-11-24 16:08 ` [Qemu-devel] [PATCH v2 2/7] linux-user: Fix inotify_init1 support Lena Djokic
2016-12-16 14:53   ` Peter Maydell
2017-01-05 12:13   ` Riku Voipio
2016-11-24 16:08 ` [Qemu-devel] [PATCH v2 3/7] linux-user: Fix flock definition for mips64 Lena Djokic
2016-12-16 14:51   ` Peter Maydell
2016-11-24 16:08 ` [Qemu-devel] [PATCH v2 4/7] linux-user: Fix fcnt Lena Djokic
2016-12-16 14:45   ` Peter Maydell [this message]
2016-11-24 16:08 ` [Qemu-devel] [PATCH v2 5/7] linux-user: Fix readahead Lena Djokic
2016-12-16 14:27   ` Peter Maydell
2017-01-05 12:14   ` Riku Voipio
2016-11-24 16:08 ` [Qemu-devel] [PATCH v2 6/7] linux-user: Fix syslog Lena Djokic
2016-12-16 14:38   ` Peter Maydell
2016-11-24 16:08 ` [Qemu-devel] [PATCH v2 7/7] linux-user: Fix mq_open Lena Djokic
2016-12-16 14:39   ` Peter Maydell
2017-01-05 12:14   ` Riku Voipio

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=CAFEAcA_D6efAX_Hcy4LeTsVvhA1dMAks14v5zptyw-5wvmFarA@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=Lena.Djokic@rt-rk.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.