Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_sem.c
Show First 20 Lines • Show All 719 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
cap_rights_t rights; | cap_rights_t rights; | ||||
struct file *fp; | struct file *fp; | ||||
struct ksem *ks; | struct ksem *ks; | ||||
int error; | int error; | ||||
AUDIT_ARG_FD(uap->id); | AUDIT_ARG_FD(uap->id); | ||||
error = ksem_get(td, uap->id, | error = ksem_get(td, uap->id, | ||||
cap_rights_init(&rights, CAP_SEM_POST), &fp); | cap_rights_init_one(&rights, CAP_SEM_POST), &fp); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
ks = fp->f_data; | ks = fp->f_data; | ||||
mtx_lock(&sem_lock); | mtx_lock(&sem_lock); | ||||
#ifdef MAC | #ifdef MAC | ||||
error = mac_posixsem_check_post(td->td_ucred, fp->f_cred, ks); | error = mac_posixsem_check_post(td->td_ucred, fp->f_cred, ks); | ||||
if (error) | if (error) | ||||
▲ Show 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | kern_sem_wait(struct thread *td, semid_t id, int tryflag, | ||||
struct timeval tv; | struct timeval tv; | ||||
cap_rights_t rights; | cap_rights_t rights; | ||||
struct file *fp; | struct file *fp; | ||||
struct ksem *ks; | struct ksem *ks; | ||||
int error; | int error; | ||||
DP((">>> kern_sem_wait entered! pid=%d\n", (int)td->td_proc->p_pid)); | DP((">>> kern_sem_wait entered! pid=%d\n", (int)td->td_proc->p_pid)); | ||||
AUDIT_ARG_FD(id); | AUDIT_ARG_FD(id); | ||||
error = ksem_get(td, id, cap_rights_init(&rights, CAP_SEM_WAIT), &fp); | error = ksem_get(td, id, cap_rights_init_one(&rights, CAP_SEM_WAIT), | ||||
&fp); | |||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
ks = fp->f_data; | ks = fp->f_data; | ||||
mtx_lock(&sem_lock); | mtx_lock(&sem_lock); | ||||
DP((">>> kern_sem_wait critical section entered! pid=%d\n", | DP((">>> kern_sem_wait critical section entered! pid=%d\n", | ||||
(int)td->td_proc->p_pid)); | (int)td->td_proc->p_pid)); | ||||
#ifdef MAC | #ifdef MAC | ||||
error = mac_posixsem_check_wait(td->td_ucred, fp->f_cred, ks); | error = mac_posixsem_check_wait(td->td_ucred, fp->f_cred, ks); | ||||
▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
{ | { | ||||
cap_rights_t rights; | cap_rights_t rights; | ||||
struct file *fp; | struct file *fp; | ||||
struct ksem *ks; | struct ksem *ks; | ||||
int error, val; | int error, val; | ||||
AUDIT_ARG_FD(uap->id); | AUDIT_ARG_FD(uap->id); | ||||
error = ksem_get(td, uap->id, | error = ksem_get(td, uap->id, | ||||
cap_rights_init(&rights, CAP_SEM_GETVALUE), &fp); | cap_rights_init_one(&rights, CAP_SEM_GETVALUE), &fp); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
ks = fp->f_data; | ks = fp->f_data; | ||||
mtx_lock(&sem_lock); | mtx_lock(&sem_lock); | ||||
#ifdef MAC | #ifdef MAC | ||||
error = mac_posixsem_check_getvalue(td->td_ucred, fp->f_cred, ks); | error = mac_posixsem_check_getvalue(td->td_ucred, fp->f_cred, ks); | ||||
if (error) { | if (error) { | ||||
▲ Show 20 Lines • Show All 213 Lines • Show Last 20 Lines |