MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / sys_futex

Function sys_futex

components/lwp/lwp_futex.c:905–927  ·  view source on GitHub ↗

* @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

Source from the content-addressed store, hash-verified

903 * performing necessary access checks before delegating to the LWP futex handler.
904 */
905sysret_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/**

Callers 1

_clear_child_tidFunction · 0.85

Calls 4

lwp_user_accessableFunction · 0.85
_timeout_ignoredFunction · 0.85
lwp_selfFunction · 0.85
lwp_futexFunction · 0.85

Tested by

no test coverage detected