Lines Matching refs:fd
51 auto fd = unique_fd{open(path, O_RDONLY | O_CLOEXEC)}; in EnterNamespace()
52 if (fd == -1) { in EnterNamespace()
55 if (setns(fd.get(), nstype) == -1) { in EnterNamespace()
129 auto fd = unique_fd{open("/dev/null", O_RDWR | O_CLOEXEC)}; in SetupStdio()
130 dup2(fd.get(), STDIN_FILENO); in SetupStdio()
132 fd.reset(open("/dev/kmsg_debug", O_WRONLY | O_CLOEXEC)); in SetupStdio()
133 if (fd == -1) fd.reset(open("/dev/null", O_WRONLY | O_CLOEXEC)); in SetupStdio()
135 dup2(fd.get(), STDOUT_FILENO); in SetupStdio()
136 dup2(fd.get(), STDERR_FILENO); in SetupStdio()
140 auto fd = unique_fd{open(console.c_str(), O_RDWR | O_CLOEXEC)}; in OpenConsole()
141 if (fd == -1) fd.reset(open("/dev/null", O_RDWR | O_CLOEXEC)); in OpenConsole()
142 ioctl(fd.get(), TIOCSCTTY, 0); in OpenConsole()
143 dup2(fd.get(), 0); in OpenConsole()
144 dup2(fd.get(), 1); in OpenConsole()
145 dup2(fd.get(), 2); in OpenConsole()
157 int fd = fd_.get(); in Publish() local
159 auto fd_flags = fcntl(fd, F_GETFD); in Publish()
161 if (fcntl(fd, F_SETFD, fd_flags) != 0) { in Publish()
165 std::string val = std::to_string(fd); in Publish()
186 unique_fd fd(TEMP_FAILURE_RETRY(open(name.c_str(), flags | O_NONBLOCK | O_CLOEXEC))); in Create() local
188 if (fd < 0) { in Create()
193 fcntl(fd.get(), F_SETFL, flags); in Create()
195 return Descriptor(ANDROID_FILE_ENV_PREFIX + name, std::move(fd)); in Create()