Lines Matching defs:fd

65     fprintf(stderr,"FDE #%03d %c%c%c %s\n", fde->fd,
86 static void fdevent_subproc_event_func(int fd, unsigned events, void *userdata);
126 if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fde->fd, &ev)) {
146 epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fde->fd, &ev);
172 if(epoll_ctl(epoll_fd, EPOLL_CTL_MOD, fde->fd, &ev)) {
177 if(epoll_ctl(epoll_fd, EPOLL_CTL_DEL, fde->fd, &ev)) {
187 if(epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fde->fd, &ev)) {
253 if(fde->fd >= select_n) {
254 select_n = fde->fd + 1;
262 FD_CLR(fde->fd, &read_fds);
263 FD_CLR(fde->fd, &write_fds);
264 FD_CLR(fde->fd, &error_fds);
275 FD_SET(fde->fd, &read_fds);
277 FD_CLR(fde->fd, &read_fds);
280 FD_SET(fde->fd, &write_fds);
282 FD_CLR(fde->fd, &write_fds);
285 FD_SET(fde->fd, &error_fds);
287 FD_CLR(fde->fd, &error_fds);
321 // per fd: 4 digits (but really: log10(FD_SETSIZE)), 1 staus, 1 blank
352 D("%s fd_table[]->fd = {%s}\n", extra_msg, msg_buff);
404 FATAL("missing fde for fd %d\n", i);
408 D("got events fde->fd=%d events=%04x, state=%04x\n",
409 fde->fd, fde->events, fde->state);
421 if(fde->fd < 0) {
422 FATAL("bogus negative fd (%d)\n", fde->fd);
425 if(fde->fd >= fd_table_max) {
427 if(fde->fd > 32000) {
428 FATAL("bogus huuuuge fd (%d)\n", fde->fd);
434 while(fd_table_max <= fde->fd) {
444 fd_table[fde->fd] = fde;
449 if((fde->fd < 0) || (fde->fd >= fd_table_max)) {
450 FATAL("fd out of range (%d)\n", fde->fd);
453 if(fd_table[fde->fd] != fde) {
454 FATAL("fd_table out of sync [%d]\n", fde->fd);
457 fd_table[fde->fd] = 0;
461 adb_close(fde->fd);
505 fde->func(fde->fd, events, fde->arg);
508 static void fdevent_subproc_event_func(int fd, unsigned ev, void *userdata)
511 D("subproc handling on fd=%d ev=%04x\n", fd, ev);
514 if((fd < 0) || (fd >= fd_table_max)) {
515 FATAL("fd %d out of range for fd_table \n", fd);
517 fdevent *fde = fd_table[fd];
523 if(readx(fd, &subproc_fd, sizeof(subproc_fd))) {
524 FATAL("Failed to read the subproc's fd from fd=%d\n", fd);
536 if(subproc_fde->fd != subproc_fd) {
538 D("subproc_fd %d != fd_table[].fd %d\n", subproc_fd, subproc_fde->fd);
546 D("subproc with fd=%d has rcount=%d err=%d\n",
566 fdevent *fdevent_create(int fd, fd_func func, void *arg)
570 fdevent_install(fde, fd, func, arg);
584 void fdevent_install(fdevent *fde, int fd, fd_func func, void *arg)
588 fde->fd = fd;
594 fcntl(fd, F_SETFL, O_NONBLOCK);