Blob Blame History Raw
commit 52231be034160c786735c6ae2f51ac7723c2e1fd
Author: Dmitry V. Levin <ldv@altlinux.org>
Date:   Fri Sep 15 16:06:14 2017 +0000

    Update MEMBARRIER_CMD_* constants
    
    * xlat/membarrier_cmds.in: Add MEMBARRIER_CMD_PRIVATE_EXPEDITED
    introduced by kernel commit v4.14-rc1~174^2^2^4.
    * NEWS: Mention this.
    * tests/membarrier.c (main): Update expected output.

[ ES: also patch files in tests-m32 and tests-mx32 directories ]

diff -rup a/tests/membarrier.c b/tests/membarrier.c
--- a/tests/membarrier.c	2016-04-21 14:16:50.000000000 -0400
+++ b/tests/membarrier.c	2018-02-05 19:24:07.016341127 -0500
@@ -42,10 +42,23 @@ main(void)
 	printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = -1 %s (%m)\n",
 	       errno2name());
 	if (errno != ENOSYS) {
-		/* the test needs to be updated? */
-		assert(syscall(__NR_membarrier, 0, 0) == 1);
-		puts("membarrier(MEMBARRIER_CMD_QUERY, 0)"
-		     " = 0x1 (MEMBARRIER_CMD_SHARED)");
+		const char *text;
+		int rc = syscall(__NR_membarrier, 0, 0);
+
+		switch (rc) {
+		case 1:
+			text = "MEMBARRIER_CMD_SHARED";
+			break;
+		case 1|8:
+			text = "MEMBARRIER_CMD_SHARED|"
+			       "MEMBARRIER_CMD_PRIVATE_EXPEDITED";
+			break;
+		default:
+			error_msg_and_fail("membarrier returned %#x, does"
+					   " the test have to be updated?", rc);
+		}
+		printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s)\n",
+		       rc, text);
 	}
 	puts("+++ exited with 0 +++");
 	return 0;
diff -rup a/tests-m32/membarrier.c b/tests-m32/membarrier.c
--- a/tests-m32/membarrier.c	2016-04-21 14:16:50.000000000 -0400
+++ b/tests-m32/membarrier.c	2018-02-05 19:24:07.016341127 -0500
@@ -42,10 +42,23 @@ main(void)
 	printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = -1 %s (%m)\n",
 	       errno2name());
 	if (errno != ENOSYS) {
-		/* the test needs to be updated? */
-		assert(syscall(__NR_membarrier, 0, 0) == 1);
-		puts("membarrier(MEMBARRIER_CMD_QUERY, 0)"
-		     " = 0x1 (MEMBARRIER_CMD_SHARED)");
+		const char *text;
+		int rc = syscall(__NR_membarrier, 0, 0);
+
+		switch (rc) {
+		case 1:
+			text = "MEMBARRIER_CMD_SHARED";
+			break;
+		case 1|8:
+			text = "MEMBARRIER_CMD_SHARED|"
+			       "MEMBARRIER_CMD_PRIVATE_EXPEDITED";
+			break;
+		default:
+			error_msg_and_fail("membarrier returned %#x, does"
+					   " the test have to be updated?", rc);
+		}
+		printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s)\n",
+		       rc, text);
 	}
 	puts("+++ exited with 0 +++");
 	return 0;
diff -rup a/tests-mx32/membarrier.c b/tests-mx32/membarrier.c
--- a/tests-mx32/membarrier.c	2016-04-21 14:16:50.000000000 -0400
+++ b/tests-mx32/membarrier.c	2018-02-05 19:24:07.016341127 -0500
@@ -42,10 +42,23 @@ main(void)
 	printf("membarrier(0x3 /* MEMBARRIER_CMD_??? */, 255) = -1 %s (%m)\n",
 	       errno2name());
 	if (errno != ENOSYS) {
-		/* the test needs to be updated? */
-		assert(syscall(__NR_membarrier, 0, 0) == 1);
-		puts("membarrier(MEMBARRIER_CMD_QUERY, 0)"
-		     " = 0x1 (MEMBARRIER_CMD_SHARED)");
+		const char *text;
+		int rc = syscall(__NR_membarrier, 0, 0);
+
+		switch (rc) {
+		case 1:
+			text = "MEMBARRIER_CMD_SHARED";
+			break;
+		case 1|8:
+			text = "MEMBARRIER_CMD_SHARED|"
+			       "MEMBARRIER_CMD_PRIVATE_EXPEDITED";
+			break;
+		default:
+			error_msg_and_fail("membarrier returned %#x, does"
+					   " the test have to be updated?", rc);
+		}
+		printf("membarrier(MEMBARRIER_CMD_QUERY, 0) = %#x (%s)\n",
+		       rc, text);
 	}
 	puts("+++ exited with 0 +++");
 	return 0;
diff -rup a/xlat/membarrier_cmds.in b/xlat/membarrier_cmds.in
--- a/xlat/membarrier_cmds.in	2015-11-16 19:40:22.000000000 -0500
+++ b/xlat/membarrier_cmds.in	2018-02-05 19:23:39.097820501 -0500
@@ -1,2 +1,3 @@
-MEMBARRIER_CMD_QUERY	0
-MEMBARRIER_CMD_SHARED	1
+MEMBARRIER_CMD_QUERY			0
+MEMBARRIER_CMD_SHARED			1
+MEMBARRIER_CMD_PRIVATE_EXPEDITED	8