Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_event.c
Show First 20 Lines • Show All 1,297 Lines • ▼ Show 20 Lines | |||||
static int | static int | ||||
kqueue_kevent(struct kqueue *kq, struct thread *td, int nchanges, int nevents, | kqueue_kevent(struct kqueue *kq, struct thread *td, int nchanges, int nevents, | ||||
struct kevent_copyops *k_ops, const struct timespec *timeout) | struct kevent_copyops *k_ops, const struct timespec *timeout) | ||||
{ | { | ||||
struct kevent keva[KQ_NEVENTS]; | struct kevent keva[KQ_NEVENTS]; | ||||
struct kevent *kevp, *changes; | struct kevent *kevp, *changes; | ||||
int i, n, nerrors, error; | int i, n, nerrors, error; | ||||
if (nchanges < 0) | |||||
return (EINVAL); | |||||
nerrors = 0; | nerrors = 0; | ||||
while (nchanges > 0) { | while (nchanges > 0) { | ||||
n = nchanges > KQ_NEVENTS ? KQ_NEVENTS : nchanges; | n = nchanges > KQ_NEVENTS ? KQ_NEVENTS : nchanges; | ||||
error = k_ops->k_copyin(k_ops->arg, keva, n); | error = k_ops->k_copyin(k_ops->arg, keva, n); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
changes = keva; | changes = keva; | ||||
for (i = 0; i < n; i++) { | for (i = 0; i < n; i++) { | ||||
▲ Show 20 Lines • Show All 568 Lines • ▼ Show 20 Lines | kqueue_scan(struct kqueue *kq, int maxevents, struct kevent_copyops *k_ops, | ||||
count = maxevents; | count = maxevents; | ||||
nkev = 0; | nkev = 0; | ||||
error = 0; | error = 0; | ||||
haskqglobal = 0; | haskqglobal = 0; | ||||
if (maxevents == 0) | if (maxevents == 0) | ||||
goto done_nl; | goto done_nl; | ||||
if (maxevents < 0) { | |||||
error = EINVAL; | |||||
goto done_nl; | |||||
} | |||||
rsbt = 0; | rsbt = 0; | ||||
if (tsp != NULL) { | if (tsp != NULL) { | ||||
if (tsp->tv_sec < 0 || tsp->tv_nsec < 0 || | if (tsp->tv_sec < 0 || tsp->tv_nsec < 0 || | ||||
tsp->tv_nsec >= 1000000000) { | tsp->tv_nsec >= 1000000000) { | ||||
error = EINVAL; | error = EINVAL; | ||||
goto done_nl; | goto done_nl; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 918 Lines • Show Last 20 Lines |