Lines Matching refs:fd
40 int fd;
45 ret->fd = eventfd(value, EFD_SEMAPHORE);
46 if (ret->fd == INVALID_FD) {
58 if (semaphore->fd != INVALID_FD) close(semaphore->fd);
64 CHECK(semaphore->fd != INVALID_FD);
67 if (eventfd_read(semaphore->fd, &value) == -1)
74 CHECK(semaphore->fd != INVALID_FD);
76 int flags = fcntl(semaphore->fd, F_GETFL);
78 LOG_ERROR(LOG_TAG, "%s unable to get flags for semaphore fd: %s", __func__,
82 if (fcntl(semaphore->fd, F_SETFL, flags | O_NONBLOCK) == -1) {
83 LOG_ERROR(LOG_TAG, "%s unable to set O_NONBLOCK for semaphore fd: %s",
90 if (eventfd_read(semaphore->fd, &value) == -1) rc = false;
92 if (fcntl(semaphore->fd, F_SETFL, flags) == -1)
93 LOG_ERROR(LOG_TAG, "%s unable to restore flags for semaphore fd: %s",
100 CHECK(semaphore->fd != INVALID_FD);
102 if (eventfd_write(semaphore->fd, 1ULL) == -1)
109 CHECK(semaphore->fd != INVALID_FD);
110 return semaphore->fd;