lowlevellock-futex.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /* Low-level locking access to futex facilities. Stub version.
  2. Copyright (C) 2014-2019 Free Software Foundation, Inc.
  3. This file is part of the GNU C Library.
  4. The GNU C Library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Lesser General Public
  6. License as published by the Free Software Foundation; either
  7. version 2.1 of the License, or (at your option) any later version.
  8. The GNU C Library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public
  13. License along with the GNU C Library. If not, see
  14. <http://www.gnu.org/licenses/>. */
  15. #ifndef _LOWLEVELLOCK_FUTEX_H
  16. #define _LOWLEVELLOCK_FUTEX_H 1
  17. #include <errno.h>
  18. /* Values for 'private' parameter of locking macros. Note pthreadP.h
  19. optimizes for these exact values, though they are not required. */
  20. #define LLL_PRIVATE 0
  21. #define LLL_SHARED 128
  22. /* For most of these macros, the return value is never really used.
  23. Nevertheless, the protocol is that each one returns a negated errno
  24. code for failure or zero for success. (Note that the corresponding
  25. Linux system calls can sometimes return positive values for success
  26. cases too. We never use those values.) */
  27. /* Wait while *FUTEXP == VAL for an lll_futex_wake call on FUTEXP. */
  28. #define lll_futex_wait(futexp, val, private) \
  29. lll_futex_timed_wait (futexp, val, NULL, private)
  30. /* Wait until a lll_futex_wake call on FUTEXP, or TIMEOUT elapses. */
  31. #define lll_futex_timed_wait(futexp, val, timeout, private) \
  32. -ENOSYS
  33. /* This macro should be defined only if FUTEX_CLOCK_REALTIME is also defined.
  34. If CLOCKBIT is zero, this is identical to lll_futex_timed_wait.
  35. If CLOCKBIT has FUTEX_CLOCK_REALTIME set, then it's the same but
  36. TIMEOUT is counted by CLOCK_REALTIME rather than CLOCK_MONOTONIC. */
  37. #define lll_futex_timed_wait_bitset(futexp, val, timeout, clockbit, private) \
  38. -ENOSYS
  39. /* Wake up up to NR waiters on FUTEXP. */
  40. #define lll_futex_wake(futexp, nr, private) \
  41. -ENOSYS
  42. /* Wake up up to NR_WAKE waiters on FUTEXP. Move up to NR_MOVE of the
  43. rest from waiting on FUTEXP to waiting on MUTEX (a different futex). */
  44. #define lll_futex_requeue(futexp, nr_wake, nr_move, mutex, val, private) \
  45. -ENOSYS
  46. /* Wake up up to NR_WAKE waiters on FUTEXP and NR_WAKE2 on FUTEXP2. */
  47. #define lll_futex_wake_unlock(futexp, nr_wake, nr_wake2, futexp2, private) \
  48. -ENOSYS
  49. /* Like lll_futex_wait (FUTEXP, VAL, PRIVATE) but with the expectation
  50. that lll_futex_cmp_requeue_pi (FUTEXP, _, _, MUTEX, _, PRIVATE) will
  51. be used to do the wakeup. Confers priority-inheritance behavior on
  52. the waiter. */
  53. #define lll_futex_wait_requeue_pi(futexp, val, mutex, private) \
  54. lll_futex_timed_wait_requeue_pi (futexp, val, NULL, 0, mutex, private)
  55. /* Like lll_futex_wait_requeue_pi, but with a timeout. */
  56. #define lll_futex_timed_wait_requeue_pi(futexp, val, timeout, clockbit, \
  57. mutex, private) \
  58. -ENOSYS
  59. /* Like lll_futex_requeue, but pairs with lll_futex_wait_requeue_pi
  60. and inherits priority from the waiter. */
  61. #define lll_futex_cmp_requeue_pi(futexp, nr_wake, nr_move, mutex, \
  62. val, private) \
  63. -ENOSYS
  64. #endif /* lowlevellock-futex.h */