Lines Matching refs:fd
38 int fd; member
44 ret->fd = eventfd(value, EFD_SEMAPHORE); in semaphore_new()
45 if (ret->fd == INVALID_FD) { in semaphore_new()
58 if (semaphore->fd != INVALID_FD) in semaphore_free()
59 close(semaphore->fd); in semaphore_free()
65 assert(semaphore->fd != INVALID_FD); in semaphore_wait()
68 if (eventfd_read(semaphore->fd, &value) == -1) in semaphore_wait()
74 assert(semaphore->fd != INVALID_FD); in semaphore_try_wait()
76 int flags = TEMP_FAILURE_RETRY(fcntl(semaphore->fd, F_GETFL)); in semaphore_try_wait()
81 if (TEMP_FAILURE_RETRY(fcntl(semaphore->fd, F_SETFL, flags | O_NONBLOCK)) == -1) { in semaphore_try_wait()
87 if (eventfd_read(semaphore->fd, &value) == -1) in semaphore_try_wait()
90 if (TEMP_FAILURE_RETRY(fcntl(semaphore->fd, F_SETFL, flags)) == -1) in semaphore_try_wait()
97 assert(semaphore->fd != INVALID_FD); in semaphore_post()
99 if (eventfd_write(semaphore->fd, 1ULL) == -1) in semaphore_post()
105 assert(semaphore->fd != INVALID_FD); in semaphore_get_fd()
106 return semaphore->fd; in semaphore_get_fd()