MCPcopy Create free account
hub / github.com/F-Stack/f-stack / kqueue_kevent

Function kqueue_kevent

freebsd/kern/kern_event.c:1213–1252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1211}
1212
1213static int
1214kqueue_kevent(struct kqueue *kq, struct thread *td, int nchanges, int nevents,
1215 struct kevent_copyops *k_ops, const struct timespec *timeout)
1216{
1217 struct kevent keva[KQ_NEVENTS];
1218 struct kevent *kevp, *changes;
1219 int i, n, nerrors, error;
1220
1221 nerrors = 0;
1222 while (nchanges > 0) {
1223 n = nchanges > KQ_NEVENTS ? KQ_NEVENTS : nchanges;
1224 error = k_ops->k_copyin(k_ops->arg, keva, n);
1225 if (error)
1226 return (error);
1227 changes = keva;
1228 for (i = 0; i < n; i++) {
1229 kevp = &changes[i];
1230 if (!kevp->filter)
1231 continue;
1232 kevp->flags &= ~EV_SYSFLAGS;
1233 error = kqueue_register(kq, kevp, td, M_WAITOK);
1234 if (error || (kevp->flags & EV_RECEIPT)) {
1235 if (nevents == 0)
1236 return (error);
1237 kevp->flags = EV_ERROR;
1238 kevp->data = error;
1239 (void)k_ops->k_copyout(k_ops->arg, kevp, 1);
1240 nevents--;
1241 nerrors++;
1242 }
1243 }
1244 nchanges -= n;
1245 }
1246 if (nerrors) {
1247 td->td_retval[0] = nerrors;
1248 return (0);
1249 }
1250
1251 return (kqueue_scan(kq, nevents, k_ops, timeout, keva, td));
1252}
1253
1254int
1255kern_kevent_fp(struct thread *td, struct file *fp, int nchanges, int nevents,

Callers 2

kern_kevent_fpFunction · 0.85
kern_kevent_anonymousFunction · 0.85

Calls 2

kqueue_registerFunction · 0.85
kqueue_scanFunction · 0.85

Tested by

no test coverage detected