sched_getcpu.c 428 B

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