-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2021 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <https://www.gnu.org/licenses/>. */
#include <errno.h>
#include <sched.h>
#include <sysdep.h>
-
+#include <sysdep-vdso.h>
int
sched_getcpu (void)
{
-#ifdef __NR_getcpu
unsigned int cpu;
- int r = INLINE_SYSCALL (getcpu, 3, &cpu, NULL, NULL);
-
- return r == -1 ? r : cpu;
+ int r = -1;
+#ifdef HAVE_GETCPU_VSYSCALL
+ r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
#else
- __set_errno (ENOSYS);
- return -1;
+ r = INLINE_SYSCALL_CALL (getcpu, &cpu, NULL, NULL);
#endif
+ return r == -1 ? r : cpu;
}