debuggers.hg

changeset 22095:f68726cdf357

libxc: remus: unbreak after 21488:dd6bbdc42033

The aforementioned patch missed several calls to read_exact, causing spurious
timeouts under Remus.

Also add a couple of additional error reports to rdexact.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Brendan Cully <brendan@cs.ubc.ca>
date Thu Aug 19 18:24:12 2010 +0100 (2010-08-19)
parents aab4938edd9c
children f77261710856
files tools/libxc/xc_domain_restore.c
line diff
     1.1 --- a/tools/libxc/xc_domain_restore.c	Thu Aug 19 18:15:44 2010 +0100
     1.2 +++ b/tools/libxc/xc_domain_restore.c	Thu Aug 19 18:24:12 2010 +0100
     1.3 @@ -77,10 +77,14 @@ static ssize_t rdexact(struct xc_interfa
     1.4          len = read(fd, buf + offset, size - offset);
     1.5          if ( (len == -1) && ((errno == EINTR) || (errno == EAGAIN)) )
     1.6              continue;
     1.7 -        if ( len == 0 )
     1.8 +        if ( len == 0 ) {
     1.9 +            ERROR("0-length read");
    1.10              errno = 0;
    1.11 -        if ( len <= 0 )
    1.12 +        }
    1.13 +        if ( len <= 0 ) {
    1.14 +            ERROR("read_exact_timed failed (read rc: %d, errno: %d)", len, errno);
    1.15              return -1;
    1.16 +        }
    1.17          offset += len;
    1.18      }
    1.19  
    1.20 @@ -694,8 +698,8 @@ static int pagebuf_get_one(xc_interface 
    1.21          return pagebuf_get_one(xch, ctx, buf, fd, dom);
    1.22      } else if (count == -3) {
    1.23          /* Skip padding 4 bytes then read the EPT identity PT location. */
    1.24 -        if ( read_exact(fd, &buf->identpt, sizeof(uint32_t)) ||
    1.25 -             read_exact(fd, &buf->identpt, sizeof(uint64_t)) )
    1.26 +        if ( RDEXACT(fd, &buf->identpt, sizeof(uint32_t)) ||
    1.27 +             RDEXACT(fd, &buf->identpt, sizeof(uint64_t)) )
    1.28          {
    1.29              PERROR("error read the address of the EPT identity map");
    1.30              return -1;
    1.31 @@ -704,8 +708,8 @@ static int pagebuf_get_one(xc_interface 
    1.32          return pagebuf_get_one(xch, ctx, buf, fd, dom);
    1.33      } else if ( count == -4 )  {
    1.34          /* Skip padding 4 bytes then read the vm86 TSS location. */
    1.35 -        if ( read_exact(fd, &buf->vm86_tss, sizeof(uint32_t)) ||
    1.36 -             read_exact(fd, &buf->vm86_tss, sizeof(uint64_t)) )
    1.37 +        if ( RDEXACT(fd, &buf->vm86_tss, sizeof(uint32_t)) ||
    1.38 +             RDEXACT(fd, &buf->vm86_tss, sizeof(uint64_t)) )
    1.39          {
    1.40              PERROR("error read the address of the vm86 TSS");
    1.41              return -1;
    1.42 @@ -729,10 +733,10 @@ static int pagebuf_get_one(xc_interface 
    1.43      } else if ( count == -7 ) {
    1.44          uint32_t tsc_mode, khz, incarn;
    1.45          uint64_t nsec;
    1.46 -        if ( read_exact(fd, &tsc_mode, sizeof(uint32_t)) ||
    1.47 -             read_exact(fd, &nsec, sizeof(uint64_t)) ||
    1.48 -             read_exact(fd, &khz, sizeof(uint32_t)) ||
    1.49 -             read_exact(fd, &incarn, sizeof(uint32_t)) ||
    1.50 +        if ( RDEXACT(fd, &tsc_mode, sizeof(uint32_t)) ||
    1.51 +             RDEXACT(fd, &nsec, sizeof(uint64_t)) ||
    1.52 +             RDEXACT(fd, &khz, sizeof(uint32_t)) ||
    1.53 +             RDEXACT(fd, &incarn, sizeof(uint32_t)) ||
    1.54               xc_domain_set_tsc_info(xch, dom, tsc_mode, nsec, khz, incarn) ) {
    1.55              PERROR("error reading/restoring tsc info");
    1.56              return -1;
    1.57 @@ -740,8 +744,8 @@ static int pagebuf_get_one(xc_interface 
    1.58          return pagebuf_get_one(xch, ctx, buf, fd, dom);
    1.59      } else if (count == -8 ) {
    1.60          /* Skip padding 4 bytes then read the console pfn location. */
    1.61 -        if ( read_exact(fd, &buf->console_pfn, sizeof(uint32_t)) ||
    1.62 -             read_exact(fd, &buf->console_pfn, sizeof(uint64_t)) )
    1.63 +        if ( RDEXACT(fd, &buf->console_pfn, sizeof(uint32_t)) ||
    1.64 +             RDEXACT(fd, &buf->console_pfn, sizeof(uint64_t)) )
    1.65          {
    1.66              PERROR("error read the address of the console pfn");
    1.67              return -1;
    1.68 @@ -768,7 +772,7 @@ static int pagebuf_get_one(xc_interface 
    1.69          }
    1.70          buf->pfn_types = ptmp;
    1.71      }
    1.72 -    if ( read_exact(fd, buf->pfn_types + oldcount, count * sizeof(*(buf->pfn_types)))) {
    1.73 +    if ( RDEXACT(fd, buf->pfn_types + oldcount, count * sizeof(*(buf->pfn_types)))) {
    1.74          PERROR("Error when reading region pfn types");
    1.75          return -1;
    1.76      }
    1.77 @@ -795,7 +799,7 @@ static int pagebuf_get_one(xc_interface 
    1.78          }
    1.79          buf->pages = ptmp;
    1.80      }
    1.81 -    if ( read_exact(fd, buf->pages + oldcount * PAGE_SIZE, countpages * PAGE_SIZE) ) {
    1.82 +    if ( RDEXACT(fd, buf->pages + oldcount * PAGE_SIZE, countpages * PAGE_SIZE) ) {
    1.83          PERROR("Error when reading pages");
    1.84          return -1;
    1.85      }