>From 5399e0a620c417c1003c17fb04a45ce1a7854acd Mon Sep 17 00:00:00 2001 From: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx> Date: Thu, 3 Sep 2020 21:25:59 +0200 Subject: [PATCH 03/34] eventfd.2: Use sizeof consistently Use ``sizeof`` consistently through all the examples in the following way: - Use the name of the variable instead of its type as argument for ``sizeof``. Rationale: https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory Signed-off-by: Alejandro Colomar <colomar.6.4.3@xxxxxxxxx> --- man2/eventfd.2 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/man2/eventfd.2 b/man2/eventfd.2 index 804cf796b..35e83c957 100644 --- a/man2/eventfd.2 +++ b/man2/eventfd.2 @@ -415,8 +415,8 @@ main(int argc, char *argv[]) printf("Child writing %s to efd\en", argv[j]); u = strtoull(argv[j], NULL, 0); /* strtoull() allows various bases */ - s = write(efd, &u, sizeof(uint64_t)); - if (s != sizeof(uint64_t)) + s = write(efd, &u, sizeof(u)); + if (s != sizeof(u)) handle_error("write"); } printf("Child completed write loop\en"); @@ -427,8 +427,8 @@ main(int argc, char *argv[]) sleep(2); printf("Parent about to read\en"); - s = read(efd, &u, sizeof(uint64_t)); - if (s != sizeof(uint64_t)) + s = read(efd, &u, sizeof(u)); + if (s != sizeof(u)) handle_error("read"); printf("Parent read %llu (0x%llx) from efd\en", (unsigned long long) u, (unsigned long long) u); -- 2.28.0