Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_sig.c
Show First 20 Lines • Show All 1,259 Lines • ▼ Show 20 Lines | kern_sigtimedwait(struct thread *td, sigset_t waitset, ksiginfo_t *ksi, | ||||
error = 0; | error = 0; | ||||
ets.tv_sec = 0; | ets.tv_sec = 0; | ||||
ets.tv_nsec = 0; | ets.tv_nsec = 0; | ||||
if (timeout != NULL) { | if (timeout != NULL) { | ||||
if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { | if (timeout->tv_nsec >= 0 && timeout->tv_nsec < 1000000000) { | ||||
timevalid = 1; | timevalid = 1; | ||||
getnanouptime(&rts); | getnanouptime(&rts); | ||||
ets = rts; | timespecadd(&rts, timeout, &ets); | ||||
timespecadd(&ets, timeout); | |||||
} | } | ||||
} | } | ||||
ksiginfo_init(ksi); | ksiginfo_init(ksi); | ||||
/* Some signals can not be waited for. */ | /* Some signals can not be waited for. */ | ||||
SIG_CANTMASK(waitset); | SIG_CANTMASK(waitset); | ||||
ps = p->p_sigacts; | ps = p->p_sigacts; | ||||
PROC_LOCK(p); | PROC_LOCK(p); | ||||
saved_mask = td->td_sigmask; | saved_mask = td->td_sigmask; | ||||
Show All 23 Lines | if (timeout != NULL) { | ||||
error = EINVAL; | error = EINVAL; | ||||
break; | break; | ||||
} | } | ||||
getnanouptime(&rts); | getnanouptime(&rts); | ||||
if (timespeccmp(&rts, &ets, >=)) { | if (timespeccmp(&rts, &ets, >=)) { | ||||
error = EAGAIN; | error = EAGAIN; | ||||
break; | break; | ||||
} | } | ||||
ts = ets; | timespecsub(&ets, &rts, &ts); | ||||
timespecsub(&ts, &rts); | |||||
TIMESPEC_TO_TIMEVAL(&tv, &ts); | TIMESPEC_TO_TIMEVAL(&tv, &ts); | ||||
timo = tvtohz(&tv); | timo = tvtohz(&tv); | ||||
} else { | } else { | ||||
timo = 0; | timo = 0; | ||||
} | } | ||||
error = msleep(ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", timo); | error = msleep(ps, &p->p_mtx, PPAUSE|PCATCH, "sigwait", timo); | ||||
▲ Show 20 Lines • Show All 2,435 Lines • Show Last 20 Lines |