sched_getcpu.c 453 B

123456789101112131415161718192021222324
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * sched_getcpu() for uClibc
  4. *
  5. * Copyright (C) 2011 Bernhard Reutner-Fischer <uclibc@uclibc.org>
  6. *
  7. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  8. */
  9. #include <stdlib.h>
  10. #include <errno.h>
  11. #include <sched.h>
  12. #include <sysdep.h>
  13. #if defined __NR_getcpu
  14. int
  15. sched_getcpu (void)
  16. {
  17. unsigned int cpu;
  18. int r = INLINE_SYSCALL (getcpu, 3, &cpu, NULL, NULL);
  19. return r == -1 ? r : cpu;
  20. }
  21. #endif