This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH 02/25] pthread_setaffinity (Linux variant): Rewrite to use VLA instead of alloca
- From: Andreas Schwab <schwab at suse dot de>
- To: Florian Weimer <fweimer at redhat dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 16 Mar 2015 15:49:04 +0100
- Subject: Re: [PATCH 02/25] pthread_setaffinity (Linux variant): Rewrite to use VLA instead of alloca
- Authentication-results: sourceware.org; auth=none
- References: <cover dot 1425285061 dot git dot fweimer at redhat dot com> <080236bd5f23d9be4c47794ad23e96d52d380f5d dot 1425285061 dot git dot fweimer at redhat dot com> <20150302195844 dot GA24238 at vapier> <5506E8E6 dot 1000906 at redhat dot com>
Florian Weimer <fweimer@redhat.com> writes:
> @@ -27,26 +26,29 @@
> size_t __kernel_cpumask_size attribute_hidden;
>
>
> -/* Determine the current affinity. As a side affect we learn
> - about the size of the cpumask_t in the kernel. */
> +/* Determine the size of cpumask_t in the kernel. */
> int
> __determine_cpumask_size (pid_t tid)
> {
> - INTERNAL_SYSCALL_DECL (err);
> - int res;
> -
> size_t psize = 128;
> - void *p = alloca (psize);
> -
> - while (res = INTERNAL_SYSCALL (sched_getaffinity, err, 3, tid, psize, p),
> - INTERNAL_SYSCALL_ERROR_P (res, err)
> - && INTERNAL_SYSCALL_ERRNO (res, err) == EINVAL)
> - p = extend_alloca (p, psize, 2 * psize);
> + int res;
>
> - if (res == 0 || INTERNAL_SYSCALL_ERROR_P (res, err))
> - return INTERNAL_SYSCALL_ERRNO (res, err);
> + for (psize = 128; ; psize *= 2)
The assignment is redundant.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."