Lines Matching defs:fd
42 int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_open, path, oflags, mode);
44 int fd = LIBC_NAMESPACE::syscall_impl<int>(SYS_openat, AT_FDCWD, path, oflags,
47 if (fd > 0)
48 return fd;
55 void close(int fd) { LIBC_NAMESPACE::syscall_impl<long>(SYS_close, fd); }
58 bool dup2(int fd, int newfd) {
60 int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup2, fd, newfd);
62 int ret = LIBC_NAMESPACE::syscall_impl<int>(SYS_dup3, fd, newfd, 0);
94 auto fd = open(open_act->path, open_act->oflag, open_act->mode);
95 if (!fd)
97 int actual_fd = *fd;
98 if (actual_fd != open_act->fd) {
99 bool dup2_result = dup2(actual_fd, open_act->fd);
100 close(actual_fd); // The old fd is not needed anymore.
108 close(close_act->fd);
113 if (!dup2(dup2_act->fd, dup2_act->newfd))