| 645 | } |
| 646 | |
| 647 | static int |
| 648 | ttydev_poll(struct cdev *dev, int events, struct thread *td) |
| 649 | { |
| 650 | struct tty *tp = dev->si_drv1; |
| 651 | int error, revents = 0; |
| 652 | |
| 653 | error = ttydev_enter(tp); |
| 654 | if (error) |
| 655 | return ((events & (POLLIN|POLLRDNORM)) | POLLHUP); |
| 656 | |
| 657 | if (events & (POLLIN|POLLRDNORM)) { |
| 658 | /* See if we can read something. */ |
| 659 | if (ttydisc_read_poll(tp) > 0) |
| 660 | revents |= events & (POLLIN|POLLRDNORM); |
| 661 | } |
| 662 | |
| 663 | if (tp->t_flags & TF_ZOMBIE) { |
| 664 | /* Hangup flag on zombie state. */ |
| 665 | revents |= POLLHUP; |
| 666 | } else if (events & (POLLOUT|POLLWRNORM)) { |
| 667 | /* See if we can write something. */ |
| 668 | if (ttydisc_write_poll(tp) > 0) |
| 669 | revents |= events & (POLLOUT|POLLWRNORM); |
| 670 | } |
| 671 | |
| 672 | if (revents == 0) { |
| 673 | if (events & (POLLIN|POLLRDNORM)) |
| 674 | selrecord(td, &tp->t_inpoll); |
| 675 | if (events & (POLLOUT|POLLWRNORM)) |
| 676 | selrecord(td, &tp->t_outpoll); |
| 677 | } |
| 678 | |
| 679 | tty_unlock(tp); |
| 680 | |
| 681 | return (revents); |
| 682 | } |
| 683 | |
| 684 | static int |
| 685 | ttydev_mmap(struct cdev *dev, vm_ooffset_t offset, vm_paddr_t *paddr, |
nothing calls this directly
no test coverage detected