Lines Matching refs:pfd

746 	struct pollfd pfd;  in timeout_connect()  local
758 pfd.fd = s; in timeout_connect()
759 pfd.events = POLLOUT; in timeout_connect()
760 if ((ret = poll(&pfd, 1, timeout)) == 1) { in timeout_connect()
855 struct pollfd pfd[4]; in readwrite() local
871 pfd[POLL_STDIN].fd = (tun_fd != -1) ? tun_fd : stdin_fd; in readwrite()
872 pfd[POLL_STDIN].events = POLLIN; in readwrite()
875 pfd[POLL_NETOUT].fd = net_fd; in readwrite()
876 pfd[POLL_NETOUT].events = 0; in readwrite()
879 pfd[POLL_NETIN].fd = net_fd; in readwrite()
880 pfd[POLL_NETIN].events = POLLIN; in readwrite()
883 pfd[POLL_STDOUT].fd = (tun_fd != -1) ? tun_fd : stdout_fd; in readwrite()
884 pfd[POLL_STDOUT].events = 0; in readwrite()
888 if (pfd[POLL_STDIN].fd == -1 && pfd[POLL_NETIN].fd == -1 in readwrite()
896 if (pfd[POLL_NETOUT].fd == -1 && pfd[POLL_STDOUT].fd == -1) { in readwrite()
903 if (lflag && pfd[POLL_NETIN].fd == -1 in readwrite()
918 num_fds = poll(pfd, 4, timeout); in readwrite()
935 if (pfd[n].revents & (POLLERR|POLLNVAL)) { in readwrite()
936 pfd[n].fd = -1; in readwrite()
940 if (pfd[POLL_STDIN].events & POLLIN && in readwrite()
941 pfd[POLL_STDIN].revents & POLLHUP && in readwrite()
942 ! (pfd[POLL_STDIN].revents & POLLIN)) in readwrite()
943 pfd[POLL_STDIN].fd = -1; in readwrite()
945 if (pfd[POLL_NETIN].events & POLLIN && in readwrite()
946 pfd[POLL_NETIN].revents & POLLHUP && in readwrite()
947 ! (pfd[POLL_NETIN].revents & POLLIN)) in readwrite()
948 pfd[POLL_NETIN].fd = -1; in readwrite()
950 if (pfd[POLL_NETOUT].revents & POLLHUP) { in readwrite()
952 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); in readwrite()
953 pfd[POLL_NETOUT].fd = -1; in readwrite()
956 if (pfd[POLL_STDOUT].revents & POLLHUP) in readwrite()
957 pfd[POLL_STDOUT].fd = -1; in readwrite()
959 if (pfd[POLL_NETOUT].fd == -1) in readwrite()
960 pfd[POLL_STDIN].fd = -1; in readwrite()
962 if (pfd[POLL_STDOUT].fd == -1) { in readwrite()
963 if (pfd[POLL_NETIN].fd != -1) in readwrite()
964 shutdown(pfd[POLL_NETIN].fd, SHUT_RD); in readwrite()
965 pfd[POLL_NETIN].fd = -1; in readwrite()
969 if (pfd[POLL_STDIN].revents & POLLIN && stdinbufpos < BUFSIZE) { in readwrite()
970 ret = fillbuf(pfd[POLL_STDIN].fd, stdinbuf, in readwrite()
974 pfd[POLL_STDIN].fd = -1; in readwrite()
977 pfd[POLL_NETOUT].events = POLLOUT; in readwrite()
980 pfd[POLL_STDIN].events = 0; in readwrite()
983 if (pfd[POLL_NETOUT].revents & POLLOUT && stdinbufpos > 0) { in readwrite()
984 ret = drainbuf(pfd[POLL_NETOUT].fd, stdinbuf, in readwrite()
987 pfd[POLL_NETOUT].fd = -1; in readwrite()
990 pfd[POLL_NETOUT].events = 0; in readwrite()
993 pfd[POLL_STDIN].events = POLLIN; in readwrite()
996 if (pfd[POLL_NETIN].revents & POLLIN && netinbufpos < BUFSIZE) { in readwrite()
997 ret = fillbuf(pfd[POLL_NETIN].fd, netinbuf, in readwrite()
1000 pfd[POLL_NETIN].fd = -1; in readwrite()
1003 shutdown(pfd[POLL_NETIN].fd, SHUT_RD); in readwrite()
1004 pfd[POLL_NETIN].fd = -1; in readwrite()
1008 pfd[POLL_STDOUT].events = POLLOUT; in readwrite()
1011 pfd[POLL_NETIN].events = 0; in readwrite()
1014 atelnet(pfd[POLL_NETIN].fd, netinbuf, in readwrite()
1018 if (pfd[POLL_STDOUT].revents & POLLOUT && netinbufpos > 0) { in readwrite()
1019 ret = drainbuf(pfd[POLL_STDOUT].fd, netinbuf, in readwrite()
1022 pfd[POLL_STDOUT].fd = -1; in readwrite()
1025 pfd[POLL_STDOUT].events = 0; in readwrite()
1028 pfd[POLL_NETIN].events = POLLIN; in readwrite()
1032 if (pfd[POLL_STDIN].fd == -1 && stdinbufpos == 0) { in readwrite()
1033 if (pfd[POLL_NETOUT].fd != -1 && Nflag) { in readwrite()
1038 shutdown(pfd[POLL_NETOUT].fd, SHUT_WR); in readwrite()
1040 pfd[POLL_NETOUT].fd = -1; in readwrite()
1043 if (pfd[POLL_NETIN].fd == -1 && netinbufpos == 0) { in readwrite()
1044 pfd[POLL_STDOUT].fd = -1; in readwrite()
1126 struct pollfd pfd; in fdpass() local
1149 bzero(&pfd, sizeof(pfd)); in fdpass()
1150 pfd.fd = STDOUT_FILENO; in fdpass()
1151 pfd.events = POLLOUT; in fdpass()
1156 if (poll(&pfd, 1, -1) == -1) in fdpass()