Lines Matching refs:fd
39 set_cloexec_or_close(int fd) in set_cloexec_or_close() argument
43 if (fd == -1) in set_cloexec_or_close()
46 flags = fcntl(fd, F_GETFD); in set_cloexec_or_close()
50 if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) in set_cloexec_or_close()
53 return fd; in set_cloexec_or_close()
56 close(fd); in set_cloexec_or_close()
63 int fd; in wl_os_socket_cloexec() local
65 fd = socket(domain, type | SOCK_CLOEXEC, protocol); in wl_os_socket_cloexec()
66 if (fd >= 0) in wl_os_socket_cloexec()
67 return fd; in wl_os_socket_cloexec()
71 fd = socket(domain, type, protocol); in wl_os_socket_cloexec()
72 return set_cloexec_or_close(fd); in wl_os_socket_cloexec()
76 wl_os_dupfd_cloexec(int fd, long minfd) in wl_os_dupfd_cloexec() argument
80 newfd = fcntl(fd, F_DUPFD_CLOEXEC, minfd); in wl_os_dupfd_cloexec()
86 newfd = fcntl(fd, F_DUPFD, minfd); in wl_os_dupfd_cloexec()
96 int *fd; in recvmsg_cloexec_fallback() local
114 for (fd = (int *)data; fd < end; ++fd) in recvmsg_cloexec_fallback()
115 *fd = set_cloexec_or_close(*fd); in recvmsg_cloexec_fallback()
138 int fd; in wl_os_epoll_create_cloexec() local
141 fd = epoll_create1(EPOLL_CLOEXEC); in wl_os_epoll_create_cloexec()
142 if (fd >= 0) in wl_os_epoll_create_cloexec()
143 return fd; in wl_os_epoll_create_cloexec()
148 fd = epoll_create(1); in wl_os_epoll_create_cloexec()
149 return set_cloexec_or_close(fd); in wl_os_epoll_create_cloexec()
155 int fd; in wl_os_accept_cloexec() local
158 fd = accept4(sockfd, addr, addrlen, SOCK_CLOEXEC); in wl_os_accept_cloexec()
159 if (fd >= 0) in wl_os_accept_cloexec()
160 return fd; in wl_os_accept_cloexec()
165 fd = accept(sockfd, addr, addrlen); in wl_os_accept_cloexec()
166 return set_cloexec_or_close(fd); in wl_os_accept_cloexec()