-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2019 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>
+#ifdef HAVE_GETCPU_VSYSCALL
+# define HAVE_VSYSCALL
+#endif
+#include <sysdep-vdso.h>
int
sched_getcpu (void)
{
#ifdef __NR_getcpu
unsigned int cpu;
- INTERNAL_SYSCALL_DECL (err);
- int r = INTERNAL_SYSCALL (getcpu, err, &cpu, NULL, NULL);
+ int r = INLINE_VSYSCALL (getcpu, 3, &cpu, NULL, NULL);
- return (INTERNAL_SYSCALL_ERROR (r, err)
- ? INTERNAL_SYSCALL_ERRNO (r, err) : cpu);
+ return r == -1 ? r : cpu;
#else
__set_errno (ENOSYS);
return -1;