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

Function eventfd_poll

freebsd/kern/sys_eventfd.c:233–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

231}
232
233static int
234eventfd_poll(struct file *fp, int events, struct ucred *active_cred,
235 struct thread *td)
236{
237 struct eventfd *efd;
238 int revents;
239
240 efd = fp->f_data;
241 revents = 0;
242 mtx_lock(&efd->efd_lock);
243 if ((events & (POLLIN | POLLRDNORM)) != 0 && efd->efd_count > 0)
244 revents |= events & (POLLIN | POLLRDNORM);
245 if ((events & (POLLOUT | POLLWRNORM)) != 0 && UINT64_MAX - 1 >
246 efd->efd_count)
247 revents |= events & (POLLOUT | POLLWRNORM);
248 if (revents == 0)
249 selrecord(td, &efd->efd_sel);
250 mtx_unlock(&efd->efd_lock);
251
252 return (revents);
253}
254
255static int
256eventfd_kqfilter(struct file *fp, struct knote *kn)

Callers

nothing calls this directly

Calls 3

selrecordFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected