Lines Matching refs:fd
63 fprintf(stderr,"FDE #%03d %c%c%c %s\n", fde->fd, in dump_fde()
84 static void fdevent_subproc_event_func(int fd, unsigned events, void *userdata);
89 .fd = -1,
130 if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fde->fd, &ev)) { in fdevent_connect()
150 epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fde->fd, &ev); in fdevent_disconnect()
176 if(epoll_ctl(epoll_fd, EPOLL_CTL_MOD, fde->fd, &ev)) { in fdevent_update()
181 if(epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fde->fd, &ev)) { in fdevent_update()
191 if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fde->fd, &ev)) { in fdevent_update()
257 if(fde->fd >= select_n) { in fdevent_connect()
258 select_n = fde->fd + 1; in fdevent_connect()
266 FD_CLR(fde->fd, &read_fds); in fdevent_disconnect()
267 FD_CLR(fde->fd, &write_fds); in fdevent_disconnect()
268 FD_CLR(fde->fd, &error_fds); in fdevent_disconnect()
279 FD_SET(fde->fd, &read_fds); in fdevent_update()
281 FD_CLR(fde->fd, &read_fds); in fdevent_update()
284 FD_SET(fde->fd, &write_fds); in fdevent_update()
286 FD_CLR(fde->fd, &write_fds); in fdevent_update()
289 FD_SET(fde->fd, &error_fds); in fdevent_update()
291 FD_CLR(fde->fd, &error_fds); in fdevent_update()
413 fde->fd, fde->events, fde->state); in fdevent_process()
425 if(fde->fd < 0) { in fdevent_register()
426 FATAL("bogus negative fd (%d)\n", fde->fd); in fdevent_register()
429 if(fde->fd >= fd_table_max) { in fdevent_register()
431 if(fde->fd > 32000) { in fdevent_register()
432 FATAL("bogus huuuuge fd (%d)\n", fde->fd); in fdevent_register()
438 while(fd_table_max <= fde->fd) { in fdevent_register()
449 fd_table[fde->fd] = fde; in fdevent_register()
454 if((fde->fd < 0) || (fde->fd >= fd_table_max)) { in fdevent_unregister()
455 FATAL("fd out of range (%d)\n", fde->fd); in fdevent_unregister()
458 if(fd_table[fde->fd] != fde) { in fdevent_unregister()
459 FATAL("fd_table out of sync [%d]\n", fde->fd); in fdevent_unregister()
462 fd_table[fde->fd] = 0; in fdevent_unregister()
466 adb_close(fde->fd); in fdevent_unregister()
510 fde->func(fde->fd, events, fde->arg); in fdevent_call_fdfunc()
513 static void fdevent_subproc_event_func(int fd, unsigned ev, in fdevent_subproc_event_func() argument
517 D("subproc handling on fd=%d ev=%04x\n", fd, ev); in fdevent_subproc_event_func()
520 if((fd < 0) || (fd >= fd_table_max)) { in fdevent_subproc_event_func()
521 FATAL("fd %d out of range for fd_table \n", fd); in fdevent_subproc_event_func()
523 fdevent *fde = fd_table[fd]; in fdevent_subproc_event_func()
529 if(!ReadFdExactly(fd, &subproc_fd, sizeof(subproc_fd))) { in fdevent_subproc_event_func()
530 FATAL("Failed to read the subproc's fd from fd=%d\n", fd); in fdevent_subproc_event_func()
542 if(subproc_fde->fd != subproc_fd) { in fdevent_subproc_event_func()
544 D("subproc_fd %d != fd_table[].fd %d\n", subproc_fd, subproc_fde->fd); in fdevent_subproc_event_func()
572 fdevent *fdevent_create(int fd, fd_func func, void *arg) in fdevent_create() argument
576 fdevent_install(fde, fd, func, arg); in fdevent_create()
591 void fdevent_install(fdevent *fde, int fd, fd_func func, void *arg) in fdevent_install() argument
595 fde->fd = fd; in fdevent_install()
601 fcntl(fd, F_SETFL, O_NONBLOCK); in fdevent_install()