| 2498 | } |
| 2499 | |
| 2500 | static int |
| 2501 | mqf_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 | |
| 2528 | static int |
| 2529 | mqf_close(struct file *fp, struct thread *td) |
nothing calls this directly
no test coverage detected