Lines Matching refs:fde
55 fdevent* fde = this->Create(std::move(interrupt_fd), fdevent_interrupt, nullptr); in fdevent_context_epoll() local
56 CHECK(fde != nullptr); in fdevent_context_epoll()
57 this->Add(fde, FDE_READ); in fdevent_context_epoll()
65 static epoll_event calculate_epoll_event(fdevent* fde) { in calculate_epoll_event() argument
68 if (fde->state & FDE_READ) { in calculate_epoll_event()
71 if (fde->state & FDE_WRITE) { in calculate_epoll_event()
74 if (fde->state & FDE_ERROR) { in calculate_epoll_event()
78 result.data.ptr = fde; in calculate_epoll_event()
82 void fdevent_context_epoll::Register(fdevent* fde) { in Register() argument
83 epoll_event ev = calculate_epoll_event(fde); in Register()
84 if (epoll_ctl(epoll_fd_.get(), EPOLL_CTL_ADD, fde->fd.get(), &ev) != 0) { in Register()
85 PLOG(FATAL) << "failed to register fd " << fde->fd.get() << " with epoll"; in Register()
89 void fdevent_context_epoll::Unregister(fdevent* fde) { in Unregister() argument
90 if (epoll_ctl(epoll_fd_.get(), EPOLL_CTL_DEL, fde->fd.get(), nullptr) != 0) { in Unregister()
91 PLOG(FATAL) << "failed to unregister fd " << fde->fd.get() << " with epoll"; in Unregister()
95 void fdevent_context_epoll::Set(fdevent* fde, unsigned events) { in Set() argument
96 unsigned previous_state = fde->state; in Set()
97 fde->state = events; in Set()
104 epoll_event ev = calculate_epoll_event(fde); in Set()
105 if (epoll_ctl(epoll_fd_.get(), EPOLL_CTL_MOD, fde->fd.get(), &ev) != 0) { in Set()
106 PLOG(FATAL) << "failed to modify fd " << fde->fd.get() << " with epoll"; in Set()
148 fdevent* fde = static_cast<fdevent*>(epoll_events[i].data.ptr); in Loop() local
152 CHECK(fde->state & FDE_READ); in Loop()
156 CHECK(fde->state & FDE_WRITE); in Loop()
165 D("%s got events 0x%X", dump_fde(fde).c_str(), events); in Loop()
166 auto& fde_event = fde_events.emplace_back(fde, events); in Loop()
167 event_map[fde] = &fde_event; in Loop()
168 fde->last_active = post_poll; in Loop()
171 for (auto& [fd, fde] : installed_fdevents_) { in Loop()
173 if (auto it = event_map.find(&fde); it != event_map.end()) { in Loop()
178 if (fde.timeout) { in Loop()
179 auto deadline = fde.last_active + *fde.timeout; in Loop()
182 LOG(DEBUG) << dump_fde(&fde) << " timed out"; in Loop()
183 fde_events.emplace_back(&fde, events); in Loop()
184 fde.last_active = post_poll; in Loop()