Lines Matching refs:fd
40 int fd; member
45 ret->fd = eventfd(value, EFD_SEMAPHORE); in semaphore_new()
46 if (ret->fd == INVALID_FD) { in semaphore_new()
57 if (semaphore->fd != INVALID_FD) close(semaphore->fd); in semaphore_free()
63 CHECK(semaphore->fd != INVALID_FD); in semaphore_wait()
66 if (eventfd_read(semaphore->fd, &value) == -1) in semaphore_wait()
72 CHECK(semaphore->fd != INVALID_FD); in semaphore_try_wait()
74 int flags = fcntl(semaphore->fd, F_GETFL); in semaphore_try_wait()
80 if (fcntl(semaphore->fd, F_SETFL, flags | O_NONBLOCK) == -1) { in semaphore_try_wait()
88 if (eventfd_read(semaphore->fd, &value) == -1) rc = false; in semaphore_try_wait()
90 if (fcntl(semaphore->fd, F_SETFL, flags) == -1) in semaphore_try_wait()
98 CHECK(semaphore->fd != INVALID_FD); in semaphore_post()
100 if (eventfd_write(semaphore->fd, 1ULL) == -1) in semaphore_post()
106 CHECK(semaphore->fd != INVALID_FD); in semaphore_get_fd()
107 return semaphore->fd; in semaphore_get_fd()