Lines Matching refs:fds
1175 static FILE* __popen_fail(int fds[2]) { in __popen_fail()
1177 close(fds[0]); in __popen_fail()
1178 close(fds[1]); in __popen_fail()
1184 int fds[2]; in popen() local
1187 if (socketpair(AF_LOCAL, SOCK_CLOEXEC | SOCK_STREAM, 0, fds) == -1) return nullptr; in popen()
1191 if (pipe2(fds, O_CLOEXEC) == -1) return nullptr; in popen()
1208 if (fds[child] == desired_child_fd) { in popen()
1209 int new_fd = fcntl(fds[child], F_DUPFD_CLOEXEC, 0); in popen()
1210 if (new_fd == -1) return __popen_fail(fds); in popen()
1211 close(fds[child]); in popen()
1212 fds[child] = new_fd; in popen()
1216 if (pid == -1) return __popen_fail(fds); in popen()
1219 close(fds[parent]); in popen()
1221 if (dup2(fds[child], desired_child_fd) == -1) _exit(127); in popen()
1222 close(fds[child]); in popen()
1228 FILE* fp = fdopen(fds[parent], mode); in popen()
1229 if (fp == nullptr) return __popen_fail(fds); in popen()
1231 close(fds[child]); in popen()