* @brief System call interface for futex operations * * @param[in] uaddr Pointer to the futex word in user space * @param[in] op Futex operation code * @param[in] val Operation-specific value * @param[in] timeout Pointer to timeout specification (can be NULL) * @param[in] uaddr2 Second futex word pointer for certain operations * @param[in] val3 Third operation-specific value * * @return S
| 903 | * performing necessary access checks before delegating to the LWP futex handler. |
| 904 | */ |
| 905 | sysret_t sys_futex(int *uaddr, int op, int val, const struct timespec *timeout, |
| 906 | int *uaddr2, int val3) |
| 907 | { |
| 908 | struct rt_lwp *lwp = RT_NULL; |
| 909 | sysret_t ret = 0; |
| 910 | |
| 911 | if (!lwp_user_accessable(uaddr, sizeof(int))) |
| 912 | { |
| 913 | ret = -EFAULT; |
| 914 | } |
| 915 | else if (timeout && !_timeout_ignored(op) && |
| 916 | !lwp_user_accessable((void *)timeout, sizeof(struct timespec))) |
| 917 | { |
| 918 | ret = -EINVAL; |
| 919 | } |
| 920 | else |
| 921 | { |
| 922 | lwp = lwp_self(); |
| 923 | ret = lwp_futex(lwp, uaddr, op, val, timeout, uaddr2, val3); |
| 924 | } |
| 925 | |
| 926 | return ret; |
| 927 | } |
| 928 | |
| 929 | #define FUTEX_FLAGS (FUTEX_PRIVATE | FUTEX_CLOCK_REALTIME) |
| 930 | /** |
no test coverage detected