nanosleep.c 590 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * nanosleep() for uClibc
  3. *
  4. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  5. *
  6. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  7. */
  8. #include <sys/syscall.h>
  9. #include <time.h>
  10. #include <cancel.h>
  11. int _NC(nanosleep)(const struct timespec *req, struct timespec *rem)
  12. {
  13. int __ret = clock_nanosleep(CLOCK_REALTIME, 0, req, rem);
  14. if (__ret != 0) {
  15. __set_errno(__ret);
  16. return -1;
  17. }
  18. return __ret;
  19. };
  20. CANCELLABLE_SYSCALL(int, nanosleep,
  21. (const struct timespec *req, struct timespec *rem),
  22. (req, rem))
  23. lt_libc_hidden(nanosleep)