debuggers.hg

changeset 21109:0a91254533dc

Fix gdbserver-xen support on older kernels.

The xc_ptrace API relies on errno for passing success/failure
indication back to callers. However, mapping operations that fall
back on legacy APIs may leave errno set to a non-zero result even
thought the operation is successful. This patch resets errno after
successful map operations so that xc_ptrace doesn't inadvertently
return a failure.

Signed-off-by: Justin Gibbs <gibbs@scsiguy.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Mar 25 07:41:55 2010 +0000 (2010-03-25)
parents eb7812d0d610
children 9472f08ddd71
files tools/libxc/xc_ptrace.c
line diff
     1.1 --- a/tools/libxc/xc_ptrace.c	Thu Mar 25 07:40:40 2010 +0000
     1.2 +++ b/tools/libxc/xc_ptrace.c	Thu Mar 25 07:41:55 2010 +0000
     1.3 @@ -193,6 +193,13 @@ map_domain_va(
     1.4      if (map == NULL)
     1.5          return NULL;
     1.6  
     1.7 +    /*
     1.8 +     * Due to the use of API fallback code in libxc, errno may
     1.9 +     * be clobberred during successful operations.  Since the caller
    1.10 +     * of xc_ptrace is depending on errno for return status, clear
    1.11 +     * errno here.
    1.12 +     */
    1.13 +    errno = 0;
    1.14      return map + (va & ~PAGE_MASK);
    1.15  }
    1.16