Lines Matching defs:fd
40 pipe2 (int fd[2], int flags)
42 /* Mingw _pipe() corrupts fd on failure; also, if we succeed at
44 to leave fd unchanged: http://austingroupbugs.net/view.php?id=467 */
46 tmp[0] = fd[0];
47 tmp[1] = fd[1];
58 int result = pipe2 (fd, flags);
79 if (_pipe (fd, 4096, flags & ~O_NONBLOCK) < 0)
81 fd[0] = tmp[0];
82 fd[1] = tmp[1];
92 if (set_nonblocking_flag (fd[0], true) != 0
93 || set_nonblocking_flag (fd[1], true) != 0)
107 if (pipe (fd) < 0)
112 both fd[0] and fd[1]. */
120 if ((fcntl_flags = fcntl (fd[1], F_GETFL, 0)) < 0
121 || fcntl (fd[1], F_SETFL, fcntl_flags | O_NONBLOCK) == -1
122 || (fcntl_flags = fcntl (fd[0], F_GETFL, 0)) < 0
123 || fcntl (fd[0], F_SETFL, fcntl_flags | O_NONBLOCK) == -1)
131 if ((fcntl_flags = fcntl (fd[1], F_GETFD, 0)) < 0
132 || fcntl (fd[1], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1
133 || (fcntl_flags = fcntl (fd[0], F_GETFD, 0)) < 0
134 || fcntl (fd[0], F_SETFD, fcntl_flags | FD_CLOEXEC) == -1)
141 setmode (fd[1], O_BINARY);
142 setmode (fd[0], O_BINARY);
146 setmode (fd[1], O_TEXT);
147 setmode (fd[0], O_TEXT);
160 close (fd[0]);
161 close (fd[1]);
162 fd[0] = tmp[0];
163 fd[1] = tmp[1];