kernel: POSIX: Fixing return value of POSIX APIs on error.
As per IEEE 1003.1 POSIX APIs should return ERROR_CODE on error. But currently these are returning -ERROR_CODE instead of ERROR_CODE. So fixing the return value. Signed-off-by: Youvedeep Singh <youvedeep.singh@intel.com>
This commit is contained in:
parent
f31245d365
commit
325abfbcf4
|
@ -193,7 +193,7 @@ static inline int pthread_mutex_timedlock(pthread_mutex_t *m,
|
|||
{
|
||||
int ret = k_sem_take(m->sem, _ts_to_ms(to));
|
||||
|
||||
return ret == -EAGAIN ? -ETIMEDOUT : ret;
|
||||
return ret == 0 ? ret : ETIMEDOUT;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,7 @@ static int cond_wait(pthread_cond_t *cv, pthread_mutex_t *mut, int timeout)
|
|||
*/
|
||||
pthread_mutex_lock(mut);
|
||||
|
||||
return ret == -EAGAIN ? -ETIMEDOUT : ret;
|
||||
return ret == -EAGAIN ? ETIMEDOUT : ret;
|
||||
}
|
||||
|
||||
/* This implements a "fair" scheduling policy: at the end of a POSIX
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
int pthread_mutex_trylock(pthread_mutex_t *m)
|
||||
{
|
||||
int key = irq_lock(), ret = -EBUSY;
|
||||
int key = irq_lock(), ret = EBUSY;
|
||||
|
||||
if (m->sem->count) {
|
||||
m->sem->count = 0;
|
||||
|
|
Loading…
Reference in a new issue