Просмотр исходного кода

[lwp/lwp_futex] modified verification
for timeout in sys_futex()

wangxiaoyao 3 лет назад
Родитель
Сommit
054eebda6b
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      components/lwp/lwp_futex.c

+ 7 - 1
components/lwp/lwp_futex.c

@@ -187,7 +187,13 @@ int sys_futex(int *uaddr, int op, int val, const struct timespec *timeout,
         rt_set_errno(EINVAL);
         return -RT_EINVAL;
     }
-    if (timeout)
+
+    /** 
+     * if (op & (FUTEX_WAKE|FUTEX_FD|FUTEX_WAKE_BITSET|FUTEX_TRYLOCK_PI|FUTEX_UNLOCK_PI)) was TRUE
+     * `timeout` should be ignored by implementation, according to POSIX futex(2) manual.
+     * since only FUTEX_WAKE is implemented in rt-smart, only FUTEX_WAKE was omitted currently
+     */
+    if (timeout && !(op & (FUTEX_WAKE)))
     {
         if (!lwp_user_accessable((void *)timeout, sizeof(struct timespec)))
         {