Lines Matching full:pfd
677 struct pollfd pfd; in timeout_connect() local
689 pfd.fd = s; in timeout_connect()
690 pfd.events = POLLOUT; in timeout_connect()
691 if ((ret = poll(&pfd, 1, timeout)) == 1) { in timeout_connect()
784 struct pollfd pfd[4]; in readwrite() local
799 pfd[POLL_STDIN].fd = stdin_fd; in readwrite()
800 pfd[POLL_STDIN].events = POLLIN; in readwrite()
803 pfd[POLL_NETOUT].fd = net_fd; in readwrite()
804 pfd[POLL_NETOUT].events = 0; in readwrite()
807 pfd[POLL_NETIN].fd = net_fd; in readwrite()
808 pfd[POLL_NETIN].events = POLLIN; in readwrite()
811 pfd[POLL_STDOUT].fd = stdout_fd; in readwrite()
812 pfd[POLL_STDOUT].events = 0; in readwrite()
816 if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1 in readwrite()
822 if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1) { in readwrite()
827 if (lflag && pfd[POLL_NETIN].fd == -1 in readwrite()
840 num_fds = poll(pfd, 4, timeout); in readwrite()
854 if (pfd[n].revents & (POLLERR|POLLNVAL)) { in readwrite()
855 pfd[n].fd = -1; in readwrite()
859 if (pfd[POLL_STDIN].events & POLLIN && in readwrite()
860 pfd[POLL_STDIN].revents & POLLHUP && in readwrite()
861 ! (pfd[POLL_STDIN].revents & POLLIN)) in readwrite()
862 pfd[POLL_STDIN].fd = -1; in readwrite()
864 if (pfd[POLL_NETIN].events & POLLIN && in readwrite()
865 pfd[POLL_NETIN].revents & POLLHUP && in readwrite()
866 ! (pfd[POLL_NETIN].revents & POLLIN)) in readwrite()
867 pfd[POLL_NETIN].fd = -1; in readwrite()
869 if (pfd[POLL_NETOUT].revents & POLLHUP) { in readwrite()
871 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); in readwrite()
872 pfd[POLL_NETOUT].fd = -1; in readwrite()
875 if (pfd[POLL_STDOUT].revents & POLLHUP) in readwrite()
876 pfd[POLL_STDOUT].fd = -1; in readwrite()
878 if (pfd[POLL_NETOUT].fd == -1) in readwrite()
879 pfd[POLL_STDIN].fd = -1; in readwrite()
881 if (pfd[POLL_STDOUT].fd == -1) { in readwrite()
882 if (pfd[POLL_NETIN].fd != -1) in readwrite()
883 shutdown(pfd[POLL_NETIN].fd, SHUT_RD); in readwrite()
884 pfd[POLL_NETIN].fd = -1; in readwrite()
888 if (pfd[POLL_STDIN].revents & POLLIN && stdinbufpos < BUFSIZE) { in readwrite()
889 ret = fillbuf(pfd[POLL_STDIN].fd, stdinbuf, in readwrite()
891 /* error or eof on stdin - remove from pfd */ in readwrite()
893 pfd[POLL_STDIN].fd = -1; in readwrite()
896 pfd[POLL_NETOUT].events = POLLOUT; in readwrite()
899 pfd[POLL_STDIN].events = 0; in readwrite()
902 if (pfd[POLL_NETOUT].revents & POLLOUT && stdinbufpos > 0) { in readwrite()
903 ret = drainbuf(pfd[POLL_NETOUT].fd, stdinbuf, in readwrite()
906 pfd[POLL_NETOUT].fd = -1; in readwrite()
909 pfd[POLL_NETOUT].events = 0; in readwrite()
912 pfd[POLL_STDIN].events = POLLIN; in readwrite()
915 if (pfd[POLL_NETIN].revents & POLLIN && netinbufpos < BUFSIZE) { in readwrite()
916 ret = fillbuf(pfd[POLL_NETIN].fd, netinbuf, in readwrite()
919 pfd[POLL_NETIN].fd = -1; in readwrite()
920 /* eof on net in - remove from pfd */ in readwrite()
922 shutdown(pfd[POLL_NETIN].fd, SHUT_RD); in readwrite()
923 pfd[POLL_NETIN].fd = -1; in readwrite()
927 pfd[POLL_STDOUT].events = POLLOUT; in readwrite()
930 pfd[POLL_NETIN].events = 0; in readwrite()
933 atelnet(pfd[POLL_NETIN].fd, netinbuf, in readwrite()
937 if (pfd[POLL_STDOUT].revents & POLLOUT && netinbufpos > 0) { in readwrite()
938 ret = drainbuf(pfd[POLL_STDOUT].fd, netinbuf, in readwrite()
941 pfd[POLL_STDOUT].fd = -1; in readwrite()
944 pfd[POLL_STDOUT].events = 0; in readwrite()
947 pfd[POLL_NETIN].events = POLLIN; in readwrite()
951 if (pfd[POLL_STDIN].fd == -1 && stdinbufpos == 0) { in readwrite()
952 if (pfd[POLL_NETOUT].fd != -1 && Nflag) in readwrite()
953 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); in readwrite()
954 pfd[POLL_NETOUT].fd = -1; in readwrite()
957 if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) { in readwrite()
958 pfd[POLL_STDOUT].fd = -1; in readwrite()
1018 struct pollfd pfd; in fdpass() local
1041 bzero(&pfd, sizeof(pfd)); in fdpass()
1042 pfd.fd = STDOUT_FILENO; in fdpass()
1043 pfd.events = POLLOUT; in fdpass()
1048 if (poll(&pfd, 1, -1) == -1) in fdpass()