Lines Matching refs:fd

73     fprintf(stderr,"FDE #%03d %c%c%c %s\n", fde->fd,
95 static void fdevent_subproc_event_func(int fd, unsigned events, void *userdata);
135 if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fde->fd, &ev)) {
155 epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fde->fd, &ev);
181 if(epoll_ctl(epoll_fd, EPOLL_CTL_MOD, fde->fd, &ev)) {
186 if(epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fde->fd, &ev)) {
196 if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fde->fd, &ev)) {
262 if(fde->fd >= select_n) {
263 select_n = fde->fd + 1;
271 FD_CLR(fde->fd, &read_fds);
272 FD_CLR(fde->fd, &write_fds);
273 FD_CLR(fde->fd, &error_fds);
284 FD_SET(fde->fd, &read_fds);
286 FD_CLR(fde->fd, &read_fds);
289 FD_SET(fde->fd, &write_fds);
291 FD_CLR(fde->fd, &write_fds);
294 FD_SET(fde->fd, &error_fds);
296 FD_CLR(fde->fd, &error_fds);
330 // per fd: 4 digits (but really: log10(FD_SETSIZE)), 1 staus, 1 blank
361 D("%s fd_table[]->fd = {%s}\n", extra_msg, msg_buff);
413 FATAL("missing fde for fd %d\n", i);
417 D("got events fde->fd=%d events=%04x, state=%04x\n",
418 fde->fd, fde->events, fde->state);
430 if(fde->fd < 0) {
431 FATAL("bogus negative fd (%d)\n", fde->fd);
434 if(fde->fd >= fd_table_max) {
436 if(fde->fd > 32000) {
437 FATAL("bogus huuuuge fd (%d)\n", fde->fd);
443 while(fd_table_max <= fde->fd) {
453 fd_table[fde->fd] = fde;
458 if((fde->fd < 0) || (fde->fd >= fd_table_max)) {
459 FATAL("fd out of range (%d)\n", fde->fd);
462 if(fd_table[fde->fd] != fde) {
463 FATAL("fd_table out of sync [%d]\n", fde->fd);
466 fd_table[fde->fd] = 0;
470 adb_close(fde->fd);
514 fde->func(fde->fd, events, fde->arg);
517 static void fdevent_subproc_event_func(int fd, unsigned ev, void *userdata)
520 D("subproc handling on fd=%d ev=%04x\n", fd, ev);
523 if((fd < 0) || (fd >= fd_table_max)) {
524 FATAL("fd %d out of range for fd_table \n", fd);
526 fdevent *fde = fd_table[fd];
532 if(readx(fd, &subproc_fd, sizeof(subproc_fd))) {
533 FATAL("Failed to read the subproc's fd from fd=%d\n", fd);
545 if(subproc_fde->fd != subproc_fd) {
547 D("subproc_fd %d != fd_table[].fd %d\n", subproc_fd, subproc_fde->fd);
555 D("subproc with fd=%d has rcount=%d err=%d\n",
575 fdevent *fdevent_create(int fd, fd_func func, void *arg)
579 fdevent_install(fde, fd, func, arg);
593 void fdevent_install(fdevent *fde, int fd, fd_func func, void *arg)
597 fde->fd = fd;
603 fcntl(fd, F_SETFL, O_NONBLOCK);