Re: [PATCH (2) 23/34] pthread_setaffinity_np.3: Use sizeof consistently

Michael Kerrisk (man-pages)
2020-09-04T15:42:51Z

Hello Alex,

On 9/4/20 4:50 PM, Alejandro Colomar wrote:
>>From ba0d73749a85e835aa43a4134a1b6906062943f3 Mon Sep 17 00:00:00 2001
> From: Alejandro Colomar <colomar.6.4.3@gmail.com>
> Date: Thu, 3 Sep 2020 21:53:12 +0200
> Subject: [PATCH 23/34] pthread_setaffinity_np.3: 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
>

Thanks. Patch applied.

Cheers,

Michael

> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
> ---
> man3/pthread_setaffinity_np.3 | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/man3/pthread_setaffinity_np.3 b/man3/pthread_setaffinity_np.3
> index 24499f550..57aaf1251 100644
> --- a/man3/pthread_setaffinity_np.3
> +++ b/man3/pthread_setaffinity_np.3
> @@ -194,13 +194,13 @@ main(int argc, char *argv[])
> for (j = 0; j < 8; j++)
> CPU_SET(j, &cpuset);
>
> - s = pthread_setaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
> + s = pthread_setaffinity_np(thread, sizeof(cpuset), &cpuset);
> if (s != 0)
> handle_error_en(s, "pthread_setaffinity_np");
>
> /* Check the actual affinity mask assigned to the thread */
>
> - s = pthread_getaffinity_np(thread, sizeof(cpu_set_t), &cpuset);
> + s = pthread_getaffinity_np(thread, sizeof(cpuset), &cpuset);
> if (s != 0)
> handle_error_en(s, "pthread_getaffinity_np");
>

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/