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