nanosleep.c 673 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (C) 2017 Waldemar Brodkorb <wbx@uclibc-ng.org>
  3. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  4. */
  5. #include <time.h>
  6. #include <cancel.h>
  7. /* Pause execution for a number of nanoseconds. */
  8. int
  9. _NC(nanosleep) (const struct timespec *requested_time,
  10. struct timespec *remaining)
  11. {
  12. int __ret = clock_nanosleep(CLOCK_REALTIME, 0, requested_time, remaining);
  13. if (__ret != 0) {
  14. __set_errno(__ret);
  15. return -1;
  16. }
  17. return __ret;
  18. }
  19. CANCELLABLE_SYSCALL(int, nanosleep, (const struct timespec *requested_time,
  20. struct timespec *remaining), (requested_time, remaining))
  21. lt_libc_hidden(nanosleep)