Lines Matching refs:fds
1178 static FILE* __popen_fail(int fds[2]) { in __popen_fail()
1180 close(fds[0]); in __popen_fail()
1181 close(fds[1]); in __popen_fail()
1187 int fds[2]; in popen() local
1190 if (socketpair(AF_LOCAL, SOCK_CLOEXEC | SOCK_STREAM, 0, fds) == -1) return nullptr; in popen()
1194 if (pipe2(fds, O_CLOEXEC) == -1) return nullptr; in popen()
1211 if (fds[child] == desired_child_fd) { in popen()
1212 int new_fd = fcntl(fds[child], F_DUPFD_CLOEXEC, 0); in popen()
1213 if (new_fd == -1) return __popen_fail(fds); in popen()
1214 close(fds[child]); in popen()
1215 fds[child] = new_fd; in popen()
1219 if (pid == -1) return __popen_fail(fds); in popen()
1222 close(fds[parent]); in popen()
1224 if (dup2(fds[child], desired_child_fd) == -1) _exit(127); in popen()
1225 close(fds[child]); in popen()
1231 FILE* fp = fdopen(fds[parent], mode); in popen()
1232 if (fp == nullptr) return __popen_fail(fds); in popen()
1234 close(fds[child]); in popen()