This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFC: Add getcpu wrapper


* H. J. Lu:

> On Wed, Dec 5, 2018 at 7:35 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * H. J. Lu:
>>
>> > returns such info.  But syscall () is too slow.  I'd like to add a wrapper to
>> > glibc.   Any comments?
>>
>> We already have it as sched_getcpu, I think.
>>
>
> We have
>
> int
> sched_getcpu (void)
> {
> #ifdef __NR_getcpu
>   unsigned int cpu;
>   int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
>
>   ^^^^^  I need the node info.
>
>   return r == -1 ? r : cpu;
> #else
>   __set_errno (ENOSYS);
>   return -1;
> #endif
> }

Ah, so you want to pass a non-null second argument to getcpu?

I think we can expose getcpu (with two arguments), under that name.  Add
it to <sched.h> or <unistd.h>; I do not have a strong preference.

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]