Lines Matching refs:pfd
671 struct pollfd pfd; in timeout_connect() local
683 pfd.fd = s; in timeout_connect()
684 pfd.events = POLLOUT; in timeout_connect()
685 if ((ret = poll(&pfd, 1, timeout)) == 1) { in timeout_connect()
778 struct pollfd pfd[4]; in readwrite() local
793 pfd[POLL_STDIN].fd = stdin_fd; in readwrite()
794 pfd[POLL_STDIN].events = POLLIN; in readwrite()
797 pfd[POLL_NETOUT].fd = net_fd; in readwrite()
798 pfd[POLL_NETOUT].events = 0; in readwrite()
801 pfd[POLL_NETIN].fd = net_fd; in readwrite()
802 pfd[POLL_NETIN].events = POLLIN; in readwrite()
805 pfd[POLL_STDOUT].fd = stdout_fd; in readwrite()
806 pfd[POLL_STDOUT].events = 0; in readwrite()
810 if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1 in readwrite()
816 if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1) { in readwrite()
821 if (lflag && pfd[POLL_NETIN].fd == -1 in readwrite()
834 num_fds = poll(pfd, 4, timeout); in readwrite()
848 if (pfd[n].revents & (POLLERR|POLLNVAL)) { in readwrite()
849 pfd[n].fd = -1; in readwrite()
853 if (pfd[POLL_STDIN].events & POLLIN && in readwrite()
854 pfd[POLL_STDIN].revents & POLLHUP && in readwrite()
855 ! (pfd[POLL_STDIN].revents & POLLIN)) in readwrite()
856 pfd[POLL_STDIN].fd = -1; in readwrite()
858 if (pfd[POLL_NETIN].events & POLLIN && in readwrite()
859 pfd[POLL_NETIN].revents & POLLHUP && in readwrite()
860 ! (pfd[POLL_NETIN].revents & POLLIN)) in readwrite()
861 pfd[POLL_NETIN].fd = -1; in readwrite()
863 if (pfd[POLL_NETOUT].revents & POLLHUP) { in readwrite()
865 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); in readwrite()
866 pfd[POLL_NETOUT].fd = -1; in readwrite()
869 if (pfd[POLL_STDOUT].revents & POLLHUP) in readwrite()
870 pfd[POLL_STDOUT].fd = -1; in readwrite()
872 if (pfd[POLL_NETOUT].fd == -1) in readwrite()
873 pfd[POLL_STDIN].fd = -1; in readwrite()
875 if (pfd[POLL_STDOUT].fd == -1) { in readwrite()
876 if (pfd[POLL_NETIN].fd != -1) in readwrite()
877 shutdown(pfd[POLL_NETIN].fd, SHUT_RD); in readwrite()
878 pfd[POLL_NETIN].fd = -1; in readwrite()
882 if (pfd[POLL_STDIN].revents & POLLIN && stdinbufpos < BUFSIZE) { in readwrite()
883 ret = fillbuf(pfd[POLL_STDIN].fd, stdinbuf, in readwrite()
887 pfd[POLL_STDIN].fd = -1; in readwrite()
890 pfd[POLL_NETOUT].events = POLLOUT; in readwrite()
893 pfd[POLL_STDIN].events = 0; in readwrite()
896 if (pfd[POLL_NETOUT].revents & POLLOUT && stdinbufpos > 0) { in readwrite()
897 ret = drainbuf(pfd[POLL_NETOUT].fd, stdinbuf, in readwrite()
900 pfd[POLL_NETOUT].fd = -1; in readwrite()
903 pfd[POLL_NETOUT].events = 0; in readwrite()
906 pfd[POLL_STDIN].events = POLLIN; in readwrite()
909 if (pfd[POLL_NETIN].revents & POLLIN && netinbufpos < BUFSIZE) { in readwrite()
910 ret = fillbuf(pfd[POLL_NETIN].fd, netinbuf, in readwrite()
913 pfd[POLL_NETIN].fd = -1; in readwrite()
916 shutdown(pfd[POLL_NETIN].fd, SHUT_RD); in readwrite()
917 pfd[POLL_NETIN].fd = -1; in readwrite()
921 pfd[POLL_STDOUT].events = POLLOUT; in readwrite()
924 pfd[POLL_NETIN].events = 0; in readwrite()
927 atelnet(pfd[POLL_NETIN].fd, netinbuf, in readwrite()
931 if (pfd[POLL_STDOUT].revents & POLLOUT && netinbufpos > 0) { in readwrite()
932 ret = drainbuf(pfd[POLL_STDOUT].fd, netinbuf, in readwrite()
935 pfd[POLL_STDOUT].fd = -1; in readwrite()
938 pfd[POLL_STDOUT].events = 0; in readwrite()
941 pfd[POLL_NETIN].events = POLLIN; in readwrite()
945 if (pfd[POLL_STDIN].fd == -1 && stdinbufpos == 0) { in readwrite()
946 if (pfd[POLL_NETOUT].fd != -1 && Nflag) in readwrite()
947 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); in readwrite()
948 pfd[POLL_NETOUT].fd = -1; in readwrite()
951 if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) { in readwrite()
952 pfd[POLL_STDOUT].fd = -1; in readwrite()
1012 struct pollfd pfd; in fdpass() local
1035 bzero(&pfd, sizeof(pfd)); in fdpass()
1036 pfd.fd = STDOUT_FILENO; in fdpass()
1041 pfd.events = POLLOUT; in fdpass()
1042 if (poll(&pfd, 1, -1) == -1) in fdpass()