Lines Matching refs:fd

54 void IOEventReactor::InsertNodeFront(int fd, IOEventHandler* target)
56 IOEventHandler* h = ioHandlers_[fd].head.get();
84 UTILS_LOGE("%{public}s: Failed, Bad fd.", __FUNCTION__);
93 int fd = target->fd_;
94 if (static_cast<size_t>(fd) > ioHandlers_.size() - 1u) {
95 UTILS_LOGD("%{public}s: Resize when fd: %{public}d", __FUNCTION__, fd);
96 ioHandlers_.resize(fd * EXPANSION_COEFF);
99 InsertNodeFront(fd, target);
101 if ((ioHandlers_[fd].events & target->events_) != target->events_) {
103 UTILS_LOGE("%{public}s: Update fd: %{public}d to backend failed.", __FUNCTION__, target->fd_);
120 UTILS_LOGE("%{public}s: Failed, Bad fd.", __FUNCTION__);
130 UTILS_LOGE("%{public}s: Update fd: %{public}d to backend failed.", __FUNCTION__, target->fd_);
146 UTILS_LOGE("%{public}s: Failed, Bad fd.", __FUNCTION__);
162 UTILS_LOGE("%{public}s: Update fd: %{public}d to backend failed.", __FUNCTION__, target->fd_);
189 UTILS_LOGD("%{public}s: Failed, Bad fd.", __FUNCTION__);
203 bool IOEventReactor::UpdateToDemultiplexer(int fd)
206 for (IOEventHandler* cur = ioHandlers_[fd].head.get(); cur != nullptr; cur = cur->next_) {
210 if (emask == ioHandlers_[fd].events) {
215 ErrCode res = backend_->ModifyEvents(fd, emask);
217 UTILS_LOGE("%{public}s: Modify events on backend failed. fd: %{public}d, \
218 new event: %{public}d, error code: %{public}d", __FUNCTION__, fd, emask, res);
222 ioHandlers_[fd].events = emask;
233 ErrCode IOEventReactor::HandleEvents(int fd, EventId event)
238 if (!(ioHandlers_[fd].events & event)) {
239 UTILS_LOGD("%{public}s: Non-interested event: %{public}d with fd: %{public}d, interested events: \
240 %{public}d", __FUNCTION__, event, fd, ioHandlers_[fd].events);
244 for (IOEventHandler* cur = ioHandlers_[fd].head.get()->next_; cur != nullptr; cur = cur->next_) {
247 UTILS_LOGD("%{public}s: Handling event success: %{public}d with fd: %{public}d; \
249 __FUNCTION__, event, fd, cur->events_, cur->enabled_);
251 UTILS_LOGD("%{public}s: Handling event ignore: %{public}d with fd: %{public}d; \
253 __FUNCTION__, event, fd, cur->events_, cur->enabled_);
265 int fd = events[idx].first;
268 UTILS_LOGD("%{public}s: Processing. Handling event: %{public}d, with fd: %{public}d.", \
269 __FUNCTION__, event, fd);
271 if (HandleEvents(fd, event) == EVENT_SYS_ERR_BADEVENT) {
312 bool IOEventReactor::DoClean(int fd)
314 if (ioHandlers_[fd].head->next_ == nullptr) {
318 for (IOEventHandler* cur = ioHandlers_[fd].head->next_; cur != nullptr; cur = cur->next_) {
324 if (!UpdateToDemultiplexer(fd)) {
336 for (size_t fd = 0u; fd < ioHandlers_.size() && fd <= INT_MAX; fd++) {
337 if (!DoClean(fd)) {
346 ErrCode IOEventReactor::Clean(int fd)
348 if (fd == -1) {
349 UTILS_LOGD("%{public}s: Failed, bad fd.", __FUNCTION__);
354 if (!DoClean(fd)) {