Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_umtx.c
Show First 20 Lines • Show All 4,008 Lines • ▼ Show 20 Lines | if (reg != NULL) { | ||||
return (0); | return (0); | ||||
} | } | ||||
cred = td->td_ucred; | cred = td->td_ucred; | ||||
if (!chgumtxcnt(cred->cr_ruidinfo, 1, lim_cur(td, RLIMIT_UMTXP))) | if (!chgumtxcnt(cred->cr_ruidinfo, 1, lim_cur(td, RLIMIT_UMTXP))) | ||||
return (ENOMEM); | return (ENOMEM); | ||||
reg = uma_zalloc(umtx_shm_reg_zone, M_WAITOK | M_ZERO); | reg = uma_zalloc(umtx_shm_reg_zone, M_WAITOK | M_ZERO); | ||||
reg->ushm_refcnt = 1; | reg->ushm_refcnt = 1; | ||||
bcopy(key, ®->ushm_key, sizeof(*key)); | bcopy(key, ®->ushm_key, sizeof(*key)); | ||||
reg->ushm_obj = shm_alloc(td->td_ucred, O_RDWR, false); | reg->ushm_obj = shm_alloc(td, O_RDWR, false); | ||||
reg->ushm_cred = crhold(cred); | reg->ushm_cred = crhold(cred); | ||||
error = shm_dotruncate(reg->ushm_obj, PAGE_SIZE); | error = shm_dotruncate(td, reg->ushm_obj, PAGE_SIZE); | ||||
if (error != 0) { | if (error != 0) { | ||||
umtx_shm_free_reg(reg); | umtx_shm_free_reg(reg); | ||||
return (error); | return (error); | ||||
} | } | ||||
mtx_lock(&umtx_shm_lock); | mtx_lock(&umtx_shm_lock); | ||||
reg1 = umtx_shm_find_reg_locked(key); | reg1 = umtx_shm_find_reg_locked(key); | ||||
if (reg1 != NULL) { | if (reg1 != NULL) { | ||||
mtx_unlock(&umtx_shm_lock); | mtx_unlock(&umtx_shm_lock); | ||||
▲ Show 20 Lines • Show All 668 Lines • Show Last 20 Lines |