Lines Matching refs:fd

86 	int fd;
97 if ((fd = open(fifo, O_RDWR | flags)) == -1) {
107 dopoll(-1, fd, POLLIN|POLLOUT, "POLLIN|POLLOUT", timeout);
108 dopoll(-1, fd, POLLIN, "POLLIN", timeout);
109 dopoll(-1, fd, POLLOUT, "POLLOUT", timeout);
110 dopoll(-1, fd, 0, "(none)", timeout);
111 doselect(-1, fd, fd, timeout);
112 doselect(-1, fd, -1, timeout);
113 doselect(-1, -1, fd, timeout);
116 if (write(fd, "test", 4) != 4) {
122 dopoll(-1, fd, POLLIN|POLLOUT, "POLLIN|POLLOUT", timeout);
123 dopoll(-1, fd, POLLIN, "POLLIN", timeout);
124 dopoll(-1, fd, POLLOUT, "POLLOUT", timeout);
125 dopoll(-1, fd, 0, "(none)", timeout);
126 doselect(-1, fd, fd, timeout);
127 doselect(-1, fd, -1, timeout);
128 doselect(-1, -1, fd, timeout);
131 if ((nread = read(fd, buf, sizeof(buf))) <= 0) {
142 int fd;
171 fd = open(fifo, O_WRONLY | flags);
173 if (fd == -1) {
180 * before we close the fd. This is racey...
183 close(fd);
191 int fd = -1, pass, status;
204 if (fd != -1)
205 close(fd);
214 if ((fd = open(fifo, O_RDONLY | flags, 0644)) == -1) {
237 dopoll(writer, fd, POLLIN|POLLOUT, "POLLIN|POLLOUT", timeout);
241 dopoll(writer, fd, POLLIN, "POLLIN", timeout);
245 dopoll(writer, fd, POLLOUT, "POLLOUT", timeout);
249 dopoll(writer, fd, 0, "(none)", timeout);
253 doselect(writer, fd, fd, timeout);
257 doselect(writer, fd, -1, timeout);
261 doselect(writer, -1, fd, timeout);
269 if ((nread = read(fd, buf, sizeof(buf))) < 0) {
277 close(fd);
282 dopoll(pid_t writer, int fd, int events, char *str, int timeout)
287 pfd.fd = fd;
301 printf("\t\t%d fd(s) ready%s", nready, nready ? ", revents ==" : "");
358 printf("\t\t%d fd(s) ready", nready);