lib/mutex: return zero on get_ceiling() in non-PP case
This is a simple way to figure out the protocol of a mutex without crippling the API with trivial accessors people might need twice a century.
This commit is contained in:
parent
bed2532942
commit
672bc22c7c
|
@ -385,17 +385,18 @@ int evl_set_mutex_ceiling(struct evl_mutex *mutex,
|
||||||
int evl_get_mutex_ceiling(struct evl_mutex *mutex)
|
int evl_get_mutex_ceiling(struct evl_mutex *mutex)
|
||||||
{
|
{
|
||||||
if (mutex->magic == __MUTEX_UNINIT_MAGIC) {
|
if (mutex->magic == __MUTEX_UNINIT_MAGIC) {
|
||||||
if (mutex->uninit.monitor != EVL_MONITOR_GATE ||
|
if (mutex->uninit.monitor != EVL_MONITOR_GATE)
|
||||||
mutex->uninit.ceiling == 0)
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
return mutex->uninit.ceiling;
|
return mutex->uninit.ceiling;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mutex->magic != __MUTEX_ACTIVE_MAGIC ||
|
if (mutex->magic != __MUTEX_ACTIVE_MAGIC ||
|
||||||
mutex->active.monitor != EVL_MONITOR_GATE ||
|
mutex->active.monitor != EVL_MONITOR_GATE)
|
||||||
mutex->active.protocol != EVL_GATE_PP)
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (mutex->active.protocol != EVL_GATE_PP)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return mutex->active.state->u.gate.ceiling;
|
return mutex->active.state->u.gate.ceiling;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue