sem_open() should return SEM_FAILED on any failures. This is change change in the POSIX specification since the original sem_open() was written so many years ago.
This commit is contained in:
parent
696e44e6b9
commit
e7ce9c4a79
4 changed files with 8 additions and 4 deletions
|
@ -3697,7 +3697,7 @@ semaphores must be less than or equal to <code>SEM_VALUE_MAX</code> (defined in
|
|||
<p>
|
||||
<b>Returned Value:</b>
|
||||
<ul>
|
||||
<li>A pointer to sem_t or -1 (<code>ERROR</code>) if unsuccessful.
|
||||
<li>A pointer to sem_t or <code>SEM_FAILED</code> if unsuccessful.
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
|
|
@ -192,7 +192,7 @@ static void *unsoliced_thread_func(void *parameter)
|
|||
DEBUGASSERT(SEM_NAMELEN == QUEUE_NAMELEN);
|
||||
snprintf(buff, SEM_NAMELEN, SEM_FORMAT, minor);
|
||||
spiconf.done = sem_open(buff, O_RDONLY);
|
||||
DEBUGASSERT(spiconf.done != (sem_t *)-1);
|
||||
DEBUGASSERT(spiconf.done != SEM_FAILED);
|
||||
|
||||
sem_post(&spiconf.unsoliced_thread_wakesem);
|
||||
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
* SEM_VALUE_MAX.
|
||||
*
|
||||
* Return Value:
|
||||
* A pointer to sem_t or -1 (ERROR) if unsuccessful.
|
||||
* A pointer to sem_t or SEM_FAILED if unsuccessful.
|
||||
*
|
||||
* Assumptions:
|
||||
*
|
||||
|
@ -257,7 +257,7 @@ errout_with_lock:
|
|||
RELEASE_SEARCH(&desc);
|
||||
set_errno(errcode);
|
||||
sched_unlock();
|
||||
return (FAR sem_t *)ERROR;
|
||||
return SEM_FAILED;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_FS_NAMED_SEMAPHORES */
|
||||
|
|
|
@ -49,6 +49,10 @@
|
|||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Value returned by sem_open() in the event of a failure. */
|
||||
|
||||
#define SEM_FAILED ((FAR sem_t *)NULL)
|
||||
|
||||
/* Bit definitions for the struct sem_s flags field */
|
||||
|
||||
#define PRIOINHERIT_FLAGS_DISABLE (1 << 0) /* Bit 0: Priority inheritance
|
||||
|
|
Loading…
Reference in a new issue