[PATCH 2/1] membarrier.2: Update EXAMPLES for new membarrier() API

Alejandro Colomar
2020-11-03T21:14:58Z

Fix the EXAMPLES tu use the new interface for the syscall membarrier().
See the previous commit, by Peter Oskolkov.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
---

Hi Peter,

I wrote this patch for the EXAMPLES Section to complete yours.

Cheers,

Alex

man2/membarrier.2 | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/man2/membarrier.2 b/man2/membarrier.2
index c95e97cb6..0251f1477 100644
--- a/man2/membarrier.2
+++ b/man2/membarrier.2
@@ -387,9 +387,9 @@ becomes:
static volatile int a, b;

static int
-membarrier(int cmd, int flags)
+membarrier(int cmd, unsigned int flags, int cpu_id)
{
- return syscall(__NR_membarrier, cmd, flags);
+ return syscall(__NR_membarrier, cmd, flags, cpu_id);
}

static int
@@ -399,7 +399,7 @@ init_membarrier(void)

/* Check that membarrier() is supported. */

- ret = membarrier(MEMBARRIER_CMD_QUERY, 0);
+ ret = membarrier(MEMBARRIER_CMD_QUERY, 0, 0);
if (ret < 0) {
perror("membarrier");
return \-1;
@@ -426,7 +426,7 @@ static void
slow_path(int *read_a)
{
b = 1;
- membarrier(MEMBARRIER_CMD_GLOBAL, 0);
+ membarrier(MEMBARRIER_CMD_GLOBAL, 0, 0);
*read_a = a;
}

--
2.28.0