You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/11/30 09:30:28 UTC

[GitHub] [nuttx] midokura-xavi92 opened a new issue, #7734: `pthread_mutex_lock(3)` must not return `EINTR`

midokura-xavi92 opened a new issue, #7734:
URL: https://github.com/apache/nuttx/issues/7734

   According to the POSIX.1-2017 [`man` page for `pthread_mutex_lock(3)`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html):
   
   > These functions shall not return an error code of [EINTR].
   
   While it seems this was taken into account for the [implementation for `pthread_mutex_lock(3)`](https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/libs/libc/pthread/pthread_mutex_lock.c#L71-L72), it seems there is a possible code path that might return `EINTR`:
   
   - `pthread_mutex_lock(3)` [calls](https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/libs/libc/pthread/pthread_mutex_lock.c#L89) `pthread_mutex_timedlock(3)`.
       - `ret` [is assigned](https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/sched/pthread/pthread_mutextimedlock.c#L190) to the return value from `pthread_mutex_take(3)`.
           - `ret` [is assigned](https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/sched/pthread/pthread_mutex.c#L169) to the return value from `pthread_sem_take(3)`.
               - `ret` [is assigned](https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/sched/pthread/pthread_initialize.c#L72) to the return value from `nxsem_wait`. Please take into account `abs_timeout` [was assigned to `NULL`](https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/libs/libc/pthread/pthread_mutex_lock.c#L89) by `pthread_mutex_lock(3)`.
                   - `ret` [is assigned](https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/sched/semaphore/sem_wait.c#L201) to `rtcb->errcode`, which, according to [the documentation](https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/sched/semaphore/sem_wait.c#L191-L194), could be `EINTR`.
   
   Could you please confirm this potentially invalid behaviour from `pthread_mutex_lock(3)`?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 commented on issue #7734: `pthread_mutex_lock(3)` must not return `EINTR`

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on issue #7734:
URL: https://github.com/apache/nuttx/issues/7734#issuecomment-1340366192

   @casaroli could you create a patch for this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] casaroli commented on issue #7734: `pthread_mutex_lock(3)` must not return `EINTR`

Posted by GitBox <gi...@apache.org>.
casaroli commented on issue #7734:
URL: https://github.com/apache/nuttx/issues/7734#issuecomment-1340553578

   https://github.com/apache/nuttx/pull/7810


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] xiaoxiang781216 closed issue #7734: `pthread_mutex_lock(3)` must not return `EINTR`

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 closed issue #7734: `pthread_mutex_lock(3)` must not return `EINTR`
URL: https://github.com/apache/nuttx/issues/7734


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] midokura-xavi92 commented on issue #7734: `pthread_mutex_lock(3)` must not return `EINTR`

Posted by GitBox <gi...@apache.org>.
midokura-xavi92 commented on issue #7734:
URL: https://github.com/apache/nuttx/issues/7734#issuecomment-1332290699

   I do not have one, but this issue was reported internally by @TachibanaRyota, so maybe they can provide further details.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] acassis commented on issue #7734: `pthread_mutex_lock(3)` must not return `EINTR`

Posted by GitBox <gi...@apache.org>.
acassis commented on issue #7734:
URL: https://github.com/apache/nuttx/issues/7734#issuecomment-1332100663

   @midokura-xavi92 do you have simple example of code to trigger the return of this invalid value?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [nuttx] casaroli commented on issue #7734: `pthread_mutex_lock(3)` must not return `EINTR`

Posted by GitBox <gi...@apache.org>.
casaroli commented on issue #7734:
URL: https://github.com/apache/nuttx/issues/7734#issuecomment-1333701980

   Maybe the change needed is in this line:
   
   https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/sched/pthread/pthread_mutextimedlock.c#L190
   
   So that we ignore EINTR and comply with POSIX in `pthread_mutex_timedlock
   ` 
   https://github.com/apache/nuttx/blob/4281acdb837d4d60d384a3d6a612edc7df309c90/sched/pthread/pthread_initialize.c#L55


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org