mirror of
https://github.com/apache/nuttx.git
synced 2026-05-29 04:19:37 +08:00
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:
@@ -3697,7 +3697,7 @@ semaphores must be less than or equal to <code>SEM_VALUE_MAX</code> (defined in
|
|||||||
<p>
|
<p>
|
||||||
<b>Returned Value:</b>
|
<b>Returned Value:</b>
|
||||||
<ul>
|
<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>
|
</ul>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ static void *unsoliced_thread_func(void *parameter)
|
|||||||
DEBUGASSERT(SEM_NAMELEN == QUEUE_NAMELEN);
|
DEBUGASSERT(SEM_NAMELEN == QUEUE_NAMELEN);
|
||||||
snprintf(buff, SEM_NAMELEN, SEM_FORMAT, minor);
|
snprintf(buff, SEM_NAMELEN, SEM_FORMAT, minor);
|
||||||
spiconf.done = sem_open(buff, O_RDONLY);
|
spiconf.done = sem_open(buff, O_RDONLY);
|
||||||
DEBUGASSERT(spiconf.done != (sem_t *)-1);
|
DEBUGASSERT(spiconf.done != SEM_FAILED);
|
||||||
|
|
||||||
sem_post(&spiconf.unsoliced_thread_wakesem);
|
sem_post(&spiconf.unsoliced_thread_wakesem);
|
||||||
|
|
||||||
|
|||||||
@@ -94,7 +94,7 @@
|
|||||||
* SEM_VALUE_MAX.
|
* SEM_VALUE_MAX.
|
||||||
*
|
*
|
||||||
* Return Value:
|
* Return Value:
|
||||||
* A pointer to sem_t or -1 (ERROR) if unsuccessful.
|
* A pointer to sem_t or SEM_FAILED if unsuccessful.
|
||||||
*
|
*
|
||||||
* Assumptions:
|
* Assumptions:
|
||||||
*
|
*
|
||||||
@@ -257,7 +257,7 @@ errout_with_lock:
|
|||||||
RELEASE_SEARCH(&desc);
|
RELEASE_SEARCH(&desc);
|
||||||
set_errno(errcode);
|
set_errno(errcode);
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
return (FAR sem_t *)ERROR;
|
return SEM_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_FS_NAMED_SEMAPHORES */
|
#endif /* CONFIG_FS_NAMED_SEMAPHORES */
|
||||||
|
|||||||
@@ -49,6 +49,10 @@
|
|||||||
* Pre-processor Definitions
|
* 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 */
|
/* Bit definitions for the struct sem_s flags field */
|
||||||
|
|
||||||
#define PRIOINHERIT_FLAGS_DISABLE (1 << 0) /* Bit 0: Priority inheritance
|
#define PRIOINHERIT_FLAGS_DISABLE (1 << 0) /* Bit 0: Priority inheritance
|
||||||
|
|||||||
Reference in New Issue
Block a user