qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <k.shutemov@gmail.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Support fcntl F_GETLK64, F_SETLK64, F_SETLKW64
Date: Thu, 4 Jan 2007 17:44:34 +0200	[thread overview]
Message-ID: <20070104154434.GA31770@localhost.localdomain> (raw)
In-Reply-To: <20070104151244.GA30484@localhost.localdomain>


[-- Attachment #1.1: Type: text/plain, Size: 163 bytes --]

On [Thu, 04.01.2007 17:12], Kirill A. Shutemov wrote:
> In the attachment patch to support three new fcntl. Tested on host x86_64,
> target arm.

Attached, sorry.

[-- Attachment #1.2: qemu-0.8.2-alt-flock64.patch --]
[-- Type: text/plain, Size: 1462 bytes --]

--- qemu-0.8.2.orig/linux-user/syscall.c	2006-12-15 16:47:53 +0200
+++ qemu-0.8.2/linux-user/syscall.c	2006-12-15 19:18:10 +0200
@@ -1687,6 +1687,8 @@
 {
     struct flock fl;
     struct target_flock *target_fl;
+    struct flock64 fl64;
+    struct target_flock64 *target_fl64;
     long ret;
 
     switch(cmd) {
@@ -1716,10 +1718,27 @@
         break;
         
     case TARGET_F_GETLK64:
+        ret = fcntl(fd, cmd >> 1, &fl64);
+        if (ret == 0) {
+            lock_user_struct(target_fl64, arg, 0);
+            target_fl64->l_type = tswap16(fl64.l_type) >> 1;
+            target_fl64->l_whence = tswap16(fl64.l_whence);
+            target_fl64->l_start = tswapl(fl64.l_start);
+            target_fl64->l_len = tswapl(fl64.l_len);
+            target_fl64->l_pid = tswapl(fl64.l_pid);
+            unlock_user_struct(target_fl64, arg, 1);
+        }
+		break;
     case TARGET_F_SETLK64:
     case TARGET_F_SETLKW64:
-        ret = -1;
-        errno = EINVAL;
+        lock_user_struct(target_fl64, arg, 1);
+        fl64.l_type = tswap16(target_fl64->l_type) >> 1;
+        fl64.l_whence = tswap16(target_fl64->l_whence);
+        fl64.l_start = tswapl(target_fl64->l_start);
+        fl64.l_len = tswapl(target_fl64->l_len);
+        fl64.l_pid = tswap16(target_fl64->l_pid);
+        unlock_user_struct(target_fl64, arg, 0);
+		ret = fcntl(fd, cmd >> 1, &fl64);
         break;
 
     case F_GETFL:

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2007-01-04 15:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-04 15:12 [Qemu-devel] [PATCH] Support fcntl F_GETLK64, F_SETLK64, F_SETLKW64 Kirill A. Shutemov
2007-01-04 15:44 ` Kirill A. Shutemov [this message]
2007-01-04 20:36   ` Kirill A. Shutemov

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=20070104154434.GA31770@localhost.localdomain \
    --to=k.shutemov@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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).