Lines Matching refs:ev
79 static void dump_event(struct ril_event * ev) in dump_event() argument
81 dlog("~~~~ Event %x ~~~~", (unsigned int)ev); in dump_event()
82 dlog(" next = %x", (unsigned int)ev->next); in dump_event()
83 dlog(" prev = %x", (unsigned int)ev->prev); in dump_event()
84 dlog(" fd = %d", ev->fd); in dump_event()
85 dlog(" pers = %d", ev->persist); in dump_event()
86 dlog(" timeout = %ds + %dus", (int)ev->timeout.tv_sec, (int)ev->timeout.tv_usec); in dump_event()
87 dlog(" func = %x", (unsigned int)ev->func); in dump_event()
88 dlog(" param = %x", (unsigned int)ev->param); in dump_event()
112 static void addToList(struct ril_event * ev, struct ril_event * list) in addToList() argument
114 ev->next = list; in addToList()
115 ev->prev = list->prev; in addToList()
116 ev->prev->next = ev; in addToList()
117 list->prev = ev; in addToList()
118 dump_event(ev); in addToList()
121 static void removeFromList(struct ril_event * ev) in removeFromList() argument
124 dump_event(ev); in removeFromList()
126 ev->next->prev = ev->prev; in removeFromList()
127 ev->prev->next = ev->next; in removeFromList()
128 ev->next = NULL; in removeFromList()
129 ev->prev = NULL; in removeFromList()
134 static void removeWatch(struct ril_event * ev, int index) in removeWatch() argument
138 ev->index = -1; in removeWatch()
140 FD_CLR(ev->fd, &readFds); in removeWatch()
142 if (ev->fd+1 == nfds) { in removeWatch()
205 struct ril_event * ev = pending_list.next; in firePending() local
206 while (ev != &pending_list) { in firePending()
207 struct ril_event * next = ev->next; in firePending()
208 removeFromList(ev); in firePending()
209 ev->func(ev->fd, 0, ev->param); in firePending()
210 ev = next; in firePending()
252 void ril_event_set(struct ril_event * ev, int fd, bool persist, ril_event_cb func, void * param) in ril_event_set() argument
254 dlog("~~~~ ril_event_set %x ~~~~", (unsigned int)ev); in ril_event_set()
255 memset(ev, 0, sizeof(struct ril_event)); in ril_event_set()
256 ev->fd = fd; in ril_event_set()
257 ev->index = -1; in ril_event_set()
258 ev->persist = persist; in ril_event_set()
259 ev->func = func; in ril_event_set()
260 ev->param = param; in ril_event_set()
265 void ril_event_add(struct ril_event * ev) in ril_event_add() argument
271 watch_table[i] = ev; in ril_event_add()
272 ev->index = i; in ril_event_add()
274 dump_event(ev); in ril_event_add()
275 FD_SET(ev->fd, &readFds); in ril_event_add()
276 if (ev->fd >= nfds) nfds = ev->fd+1; in ril_event_add()
286 void ril_timer_add(struct ril_event * ev, struct timeval * tv) in ril_timer_add() argument
295 ev->fd = -1; // make sure fd is invalid in ril_timer_add()
299 timeradd(&now, tv, &ev->timeout); in ril_timer_add()
302 while (timercmp(&list->timeout, &ev->timeout, < ) in ril_timer_add()
307 addToList(ev, list); in ril_timer_add()
315 void ril_event_del(struct ril_event * ev) in ril_event_del() argument
320 if (ev->index < 0 || ev->index >= MAX_FD_EVENTS) { in ril_event_del()
325 removeWatch(ev, ev->index); in ril_event_del()