Lines Matching full:pfd
747 struct pollfd pfd; in timeout_connect() local
759 pfd.fd = s; in timeout_connect()
760 pfd.events = POLLOUT; in timeout_connect()
761 if ((ret = poll(&pfd, 1, timeout)) == 1) { in timeout_connect()
856 struct pollfd pfd[4]; in readwrite() local
872 pfd[POLL_STDIN].fd = (tun_fd != -1) ? tun_fd : stdin_fd; in readwrite()
873 pfd[POLL_STDIN].events = POLLIN; in readwrite()
876 pfd[POLL_NETOUT].fd = net_fd; in readwrite()
877 pfd[POLL_NETOUT].events = 0; in readwrite()
880 pfd[POLL_NETIN].fd = net_fd; in readwrite()
881 pfd[POLL_NETIN].events = POLLIN; in readwrite()
884 pfd[POLL_STDOUT].fd = (tun_fd != -1) ? tun_fd : stdout_fd; in readwrite()
885 pfd[POLL_STDOUT].events = 0; in readwrite()
889 if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1 in readwrite()
897 if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1) { in readwrite()
904 if (lflag && pfd[POLL_NETIN].fd == -1 in readwrite()
919 num_fds = poll(pfd, 4, timeout); in readwrite()
936 if (pfd[n].revents & (POLLERR|POLLNVAL)) { in readwrite()
937 pfd[n].fd = -1; in readwrite()
941 if (pfd[POLL_STDIN].events & POLLIN && in readwrite()
942 pfd[POLL_STDIN].revents & POLLHUP && in readwrite()
943 ! (pfd[POLL_STDIN].revents & POLLIN)) in readwrite()
944 pfd[POLL_STDIN].fd = -1; in readwrite()
946 if (pfd[POLL_NETIN].events & POLLIN && in readwrite()
947 pfd[POLL_NETIN].revents & POLLHUP && in readwrite()
948 ! (pfd[POLL_NETIN].revents & POLLIN)) in readwrite()
949 pfd[POLL_NETIN].fd = -1; in readwrite()
951 if (pfd[POLL_NETOUT].revents & POLLHUP) { in readwrite()
953 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); in readwrite()
954 pfd[POLL_NETOUT].fd = -1; in readwrite()
957 if (pfd[POLL_STDOUT].revents & POLLHUP) in readwrite()
958 pfd[POLL_STDOUT].fd = -1; in readwrite()
960 if (pfd[POLL_NETOUT].fd == -1) in readwrite()
961 pfd[POLL_STDIN].fd = -1; in readwrite()
963 if (pfd[POLL_STDOUT].fd == -1) { in readwrite()
964 if (pfd[POLL_NETIN].fd != -1) in readwrite()
965 shutdown(pfd[POLL_NETIN].fd, SHUT_RD); in readwrite()
966 pfd[POLL_NETIN].fd = -1; in readwrite()
970 if (pfd[POLL_STDIN].revents & POLLIN && stdinbufpos < BUFSIZE) { in readwrite()
971 ret = fillbuf(pfd[POLL_STDIN].fd, stdinbuf, in readwrite()
973 /* error or eof on stdin - remove from pfd */ in readwrite()
975 pfd[POLL_STDIN].fd = -1; in readwrite()
978 pfd[POLL_NETOUT].events = POLLOUT; in readwrite()
981 pfd[POLL_STDIN].events = 0; in readwrite()
984 if (pfd[POLL_NETOUT].revents & POLLOUT && stdinbufpos > 0) { in readwrite()
985 ret = drainbuf(pfd[POLL_NETOUT].fd, stdinbuf, in readwrite()
988 pfd[POLL_NETOUT].fd = -1; in readwrite()
991 pfd[POLL_NETOUT].events = 0; in readwrite()
994 pfd[POLL_STDIN].events = POLLIN; in readwrite()
997 if (pfd[POLL_NETIN].revents & POLLIN && netinbufpos < BUFSIZE) { in readwrite()
998 ret = fillbuf(pfd[POLL_NETIN].fd, netinbuf, in readwrite()
1001 pfd[POLL_NETIN].fd = -1; in readwrite()
1002 /* eof on net in - remove from pfd */ in readwrite()
1004 shutdown(pfd[POLL_NETIN].fd, SHUT_RD); in readwrite()
1005 pfd[POLL_NETIN].fd = -1; in readwrite()
1009 pfd[POLL_STDOUT].events = POLLOUT; in readwrite()
1012 pfd[POLL_NETIN].events = 0; in readwrite()
1015 atelnet(pfd[POLL_NETIN].fd, netinbuf, in readwrite()
1019 if (pfd[POLL_STDOUT].revents & POLLOUT && netinbufpos > 0) { in readwrite()
1020 ret = drainbuf(pfd[POLL_STDOUT].fd, netinbuf, in readwrite()
1023 pfd[POLL_STDOUT].fd = -1; in readwrite()
1026 pfd[POLL_STDOUT].events = 0; in readwrite()
1029 pfd[POLL_NETIN].events = POLLIN; in readwrite()
1033 if (pfd[POLL_STDIN].fd == -1 && stdinbufpos == 0) { in readwrite()
1034 if (pfd[POLL_NETOUT].fd != -1 && Nflag) { in readwrite()
1039 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); in readwrite()
1041 pfd[POLL_NETOUT].fd = -1; in readwrite()
1044 if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) { in readwrite()
1045 pfd[POLL_STDOUT].fd = -1; in readwrite()
1127 struct pollfd pfd; in fdpass() local
1150 bzero(&pfd, sizeof(pfd)); in fdpass()
1151 pfd.fd = STDOUT_FILENO; in fdpass()
1152 pfd.events = POLLOUT; in fdpass()
1157 if (poll(&pfd, 1, -1) == -1) in fdpass()