[BACK]Return to file.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / sndiod

Diff for /src/usr.bin/sndiod/file.c between version 1.10 and 1.11

version 1.10, 2015/07/17 09:51:18 version 1.11, 2015/07/17 10:15:24
Line 272 
Line 272 
 int  int
 file_poll(void)  file_poll(void)
 {  {
         struct pollfd pfds[MAXFDS];          struct pollfd pfds[MAXFDS], *pfd;
         struct file *f, **pf;          struct file *f, **pf;
         struct timespec ts;          struct timespec ts;
 #ifdef DEBUG  #ifdef DEBUG
Line 282 
Line 282 
         int i;          int i;
 #endif  #endif
         long long delta_nsec;          long long delta_nsec;
         int n, nfds, revents, res, immed;          int nfds, revents, res, immed;
   
         /*          /*
          * cleanup zombies           * cleanup zombies
Line 308 
Line 308 
         nfds = 0;          nfds = 0;
         immed = 0;          immed = 0;
         for (f = file_list; f != NULL; f = f->next) {          for (f = file_list; f != NULL; f = f->next) {
                 n = f->ops->pollfd(f->arg, pfds + nfds);                  f->nfds = f->ops->pollfd(f->arg, pfds + nfds);
                 if (n == 0) {                  if (f->nfds == 0)
                         f->pfd = NULL;  
                         continue;                          continue;
                 }                  if (f->nfds < 0) {
                 if (n < 0) {  
                         immed = 1;                          immed = 1;
                         n = 0;                          continue;
                 }                  }
                 f->pfd = pfds + nfds;                  nfds += f->nfds;
                 nfds += n;  
         }          }
 #ifdef DEBUG  #ifdef DEBUG
         if (log_level >= 4) {          if (log_level >= 4) {
                 log_puts("poll:");                  log_puts("poll:");
                 for (i = 0; i < nfds; i++) {                  pfd = pfds;
                   for (f = file_list; f != NULL; f = f->next) {
                           if (f->nfds <= 0)
                                   continue;
                         log_puts(" ");                          log_puts(" ");
                         for (f = file_list; f != NULL; f = f->next) {                          log_puts(f->ops->name);
                                 if (f->pfd == &pfds[i]) {                          log_puts(":");
                                         log_puts(f->ops->name);                          for (i = 0; i < f->nfds; i++) {
                                         log_puts(": ");                                  log_puts(" ");
                                 }                                  log_putx(pfd->events);
                                   pfd++;
                         }                          }
                         log_putx(pfds[i].events);  
                 }                  }
                 log_puts("\n");                  log_puts("\n");
         }          }
Line 365 
Line 365 
         }          }
         if (!immed && res <= 0)          if (!immed && res <= 0)
                 return 1;                  return 1;
           pfd = pfds;
         for (f = file_list; f != NULL; f = f->next) {          for (f = file_list; f != NULL; f = f->next) {
                 if (f->pfd == NULL)                  if (f->nfds <= 0)
                         continue;                          continue;
 #ifdef DEBUG  #ifdef DEBUG
                 if (log_level >= 3)                  if (log_level >= 3)
                         clock_gettime(CLOCK_MONOTONIC, &ts0);                          clock_gettime(CLOCK_MONOTONIC, &ts0);
 #endif  #endif
                 revents = (f->state != FILE_ZOMB) ?                  revents = (f->state != FILE_ZOMB) ?
                     f->ops->revents(f->arg, f->pfd) : 0;                      f->ops->revents(f->arg, pfd) : 0;
                 if ((revents & POLLHUP) && (f->state != FILE_ZOMB))                  if ((revents & POLLHUP) && (f->state != FILE_ZOMB))
                         f->ops->hup(f->arg);                          f->ops->hup(f->arg);
                 if ((revents & POLLIN) && (f->state != FILE_ZOMB))                  if ((revents & POLLIN) && (f->state != FILE_ZOMB))
Line 394 
Line 394 
                         }                          }
                 }                  }
 #endif  #endif
                   pfd += f->nfds;
         }          }
         return 1;          return 1;
 }  }

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11