All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eugene Syromiatnikov <esyr@redhat.com>
To: linux-kernel@vger.kernel.org,
	Christian Brauner <christian@brauner.io>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org
Cc: Adrian Reber <areber@redhat.com>
Subject: [PATCH v2 3/6] selftests/clone3: use uint64_t for flags parameter
Date: Tue, 10 Sep 2019 19:01:53 +0100	[thread overview]
Message-ID: <36110c44e08d12246468a98880deee24e6c6579a.1568138393.git.esyr@redhat.com> (raw)
In-Reply-To: <cover.1568138393.git.esyr@redhat.com>

Flags parameter in both userspace and kernel clone args is 64-bit wide,
there's little reason to have it signed and 32-bit in tests.

* tools/testing/selftests/clone3/clone3.c: Include <inttypes.h> and
<stdint.h>.
(call_clone3): Change flags parameter type from int to uint64_t.
(test_clone3): Change flags parameter type from int to uint64_t; change
the format string that prints it accordingly.

Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
---
 tools/testing/selftests/clone3/clone3.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/clone3/clone3.c b/tools/testing/selftests/clone3/clone3.c
index 318189f9..613544b 100644
--- a/tools/testing/selftests/clone3/clone3.c
+++ b/tools/testing/selftests/clone3/clone3.c
@@ -4,8 +4,10 @@
 
 #define _GNU_SOURCE
 #include <errno.h>
+#include <inttypes.h>
 #include <linux/types.h>
 #include <linux/sched.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <sys/syscall.h>
@@ -39,7 +41,7 @@ static pid_t raw_clone(struct clone_args *args, size_t size)
 	return syscall(__NR_clone3, args, size);
 }
 
-static int call_clone3(int flags, size_t size, enum test_mode test_mode)
+static int call_clone3(uint64_t flags, size_t size, enum test_mode test_mode)
 {
 	struct clone_args args = {0};
 	pid_t ppid = -1;
@@ -117,12 +119,13 @@ static int call_clone3(int flags, size_t size, enum test_mode test_mode)
 	return 0;
 }
 
-static int test_clone3(int flags, size_t size, int expected,
+static int test_clone3(uint64_t flags, size_t size, int expected,
 		       enum test_mode test_mode)
 {
 	int ret;
 
-	ksft_print_msg("[%d] Trying clone3() with flags 0x%x (size %d)\n",
+	ksft_print_msg("[%d] Trying clone3() with flags %#" PRIx64 " (size %d)"
+			"\n",
 			getpid(), flags, size);
 	ret = call_clone3(flags, size, test_mode);
 	ksft_print_msg("[%d] clone3() with flags says :%d expected %d\n",
-- 
2.1.4


  parent reply	other threads:[~2019-09-10 18:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-10 18:01 [PATCH v2 0/6] Update clone3 self-tests Eugene Syromiatnikov
2019-09-10 18:01 ` [PATCH v2 1/6] selftests/clone3: convert test modes into an enum Eugene Syromiatnikov
2019-09-10 18:01 ` [PATCH v2 2/6] selftests/clone3: add a check for invalid exit_signal Eugene Syromiatnikov
2019-09-10 18:01 ` Eugene Syromiatnikov [this message]
2019-09-10 18:02 ` [PATCH v2 4/6] selftests/clone3: fix up format strings Eugene Syromiatnikov
2019-09-10 18:02 ` [PATCH v2 5/6] selftests/clone3: enable clone3 self-tests on all architectures Eugene Syromiatnikov
2019-09-10 18:02 ` [PATCH v2 6/6] selftests: add clone3 to TARGETS Eugene Syromiatnikov
2019-09-16  7:49 ` [PATCH v2 0/6] Update clone3 self-tests Christian Brauner
2019-09-16  8:12   ` Adrian Reber
2019-09-16  8:14     ` Christian Brauner

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=36110c44e08d12246468a98880deee24e6c6579a.1568138393.git.esyr@redhat.com \
    --to=esyr@redhat.com \
    --cc=areber@redhat.com \
    --cc=christian@brauner.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.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 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.