linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Pranith Kumar <bobby.prani@gmail.com>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: open list <linux-kernel@vger.kernel.org>,
	Fabian Frederick <fabf@skynet.be>,
	Geert Uytterhoeven <geert@linux-m68k.org>,
	Anton Blanchard <anton@samba.org>,
	Paul Mackerras <paulus@samba.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"open list:LINUX FOR POWERPC..." <linuxppc-dev@lists.ozlabs.org>
Subject: Re: [RFC PATCH] powerpc: Wire up three syscalls
Date: Sun, 31 Aug 2014 13:51:12 -0400	[thread overview]
Message-ID: <54036090.1050104@gmail.com> (raw)
In-Reply-To: <CANq1E4SCnDjN5yetrgtaRNdvDr7xqGOm1BXz7dbGvX3mnsm-MA@mail.gmail.com>


On 08/31/2014 10:34 AM, David Herrmann wrote:
> The only arch-dependent code for memfd_test.c is the syscall invocation:
>     memfd_create(const char *name, unsigned int flags);
> via glibc as:
>     syscall(__NR_memfd_create, name, flags);
>
> Can you debug your test-run (maybe via simple printk() in mm/shmem.c
> memfd_create()) and see what's going wrong there?
>
Hi David,

I figured out the problem. I am on a 32-bit system and using u64 for flags in fcntl() is the cause of the problem. Will you accept a patch making the test work on 32-bit systems as below?

Thanks!
--
Pranith

From: Pranith Kumar <bobby.prani@gmail.com>
Date: Sun, 31 Aug 2014 13:38:07 -0400
Subject: [PATCH] memfd_test: Make it work on 32-bit systems

This test currently fails on 32-bit systems since we use u64 type to pass the
flags to fcntl.

This commit changes this to use u32 type for flags to fcntl making it work on
32-bit systems.

Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
---
 tools/testing/selftests/memfd/memfd_test.c | 32 +++++++++++++++---------------
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/tools/testing/selftests/memfd/memfd_test.c b/tools/testing/selftests/memfd/memfd_test.c
index 3634c90..77e56ff 100644
--- a/tools/testing/selftests/memfd/memfd_test.c
+++ b/tools/testing/selftests/memfd/memfd_test.c
@@ -59,9 +59,9 @@ static void mfd_fail_new(const char *name, unsigned int flags)
     }
 }
 
-static __u64 mfd_assert_get_seals(int fd)
+static __u32 mfd_assert_get_seals(int fd)
 {
-    long r;
+    int r;
 
     r = fcntl(fd, F_GET_SEALS);
     if (r < 0) {
@@ -72,36 +72,36 @@ static __u64 mfd_assert_get_seals(int fd)
     return r;
 }
 
-static void mfd_assert_has_seals(int fd, __u64 seals)
+static void mfd_assert_has_seals(int fd, __u32 seals)
 {
-    __u64 s;
+    __u32 s;
 
     s = mfd_assert_get_seals(fd);
     if (s != seals) {
-        printf("%llu != %llu = GET_SEALS(%d)\n",
-               (unsigned long long)seals, (unsigned long long)s, fd);
+        printf("%lu != %lu = GET_SEALS(%d)\n",
+               (unsigned long)seals, (unsigned long)s, fd);
         abort();
     }
 }
 
-static void mfd_assert_add_seals(int fd, __u64 seals)
+static void mfd_assert_add_seals(int fd, __u32 seals)
 {
-    long r;
-    __u64 s;
+    int r;
+    __u32 s;
 
     s = mfd_assert_get_seals(fd);
     r = fcntl(fd, F_ADD_SEALS, seals);
     if (r < 0) {
-        printf("ADD_SEALS(%d, %llu -> %llu) failed: %m\n",
-               fd, (unsigned long long)s, (unsigned long long)seals);
+        printf("ADD_SEALS(%d, %lu -> %lu) failed: %m\n",
+               fd, (unsigned long)s, (unsigned long)seals);
         abort();
     }
 }
 
-static void mfd_fail_add_seals(int fd, __u64 seals)
+static void mfd_fail_add_seals(int fd, __u32 seals)
 {
-    long r;
-    __u64 s;
+    int r;
+    __u32 s;
 
     r = fcntl(fd, F_GET_SEALS);
     if (r < 0)
@@ -111,8 +111,8 @@ static void mfd_fail_add_seals(int fd, __u64 seals)
 
     r = fcntl(fd, F_ADD_SEALS, seals);
     if (r >= 0) {
-        printf("ADD_SEALS(%d, %llu -> %llu) didn't fail as expected\n",
-               fd, (unsigned long long)s, (unsigned long long)seals);
+        printf("ADD_SEALS(%d, %lu -> %lu) didn't fail as expected\n",
+               fd, (unsigned long)s, (unsigned long)seals);
         abort();
     }
 }
-- 
2.1.0

  reply	other threads:[~2014-08-31 17:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-30  3:36 [RFC PATCH] powerpc: Wire up three syscalls Pranith Kumar
2014-08-31  8:53 ` Geert Uytterhoeven
2014-08-31 12:52   ` Pranith Kumar
2014-08-31 14:14     ` Geert Uytterhoeven
2014-08-31 14:34     ` David Herrmann
2014-08-31 17:51       ` Pranith Kumar [this message]
2014-09-01 11:33         ` David Herrmann
2014-09-01 15:21           ` Pranith Kumar
2014-09-01 15:31             ` David Herrmann
2014-09-01 17:16               ` Pranith Kumar
2014-09-01 17:28                 ` David Herrmann

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=54036090.1050104@gmail.com \
    --to=bobby.prani@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=anton@samba.org \
    --cc=dh.herrmann@gmail.com \
    --cc=fabf@skynet.be \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.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).