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

Function mqf_poll

freebsd/kern/uipc_mqueue.c:2500–2526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2498}
2499
2500static int
2501mqf_poll(struct file *fp, int events, struct ucred *active_cred,
2502 struct thread *td)
2503{
2504 struct mqueue *mq = FPTOMQ(fp);
2505 int revents = 0;
2506
2507 mtx_lock(&mq->mq_mutex);
2508 if (events & (POLLIN | POLLRDNORM)) {
2509 if (mq->mq_curmsgs) {
2510 revents |= events & (POLLIN | POLLRDNORM);
2511 } else {
2512 mq->mq_flags |= MQ_RSEL;
2513 selrecord(td, &mq->mq_rsel);
2514 }
2515 }
2516 if (events & POLLOUT) {
2517 if (mq->mq_curmsgs < mq->mq_maxmsg)
2518 revents |= POLLOUT;
2519 else {
2520 mq->mq_flags |= MQ_WSEL;
2521 selrecord(td, &mq->mq_wsel);
2522 }
2523 }
2524 mtx_unlock(&mq->mq_mutex);
2525 return (revents);
2526}
2527
2528static int
2529mqf_close(struct file *fp, struct thread *td)

Callers

nothing calls this directly

Calls 3

selrecordFunction · 0.85
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70

Tested by

no test coverage detected