Skip to content
  • Yasmin Beatriz's avatar
    dump.c: allow fd_write_vmcore to return errno on failure · 0c33659d
    Yasmin Beatriz authored
    fd_write_vmcore can fail to execute for a lot of reasons that can be
    retrieved by errno, but it only returns -1. This makes difficult for
    the caller to know what happened and only a generic error message is
    propagated back to the user. This is an example using dump-guest-memory:
    
    (qemu) dump-guest-memory /home/yasmin/mnt/test.dump
    dump: failed to save memory
    
    All callers of fd_write_vmcore of dump.c does error handling via
    error_setg(), so at first it seems feasible to add the Error pointer as
    an argument of fd_write_vmcore. This proved to be more complex than it
    first looked. fd_write_vmcore is used by write_elf64_notes and
    write_elf32_notes as a WriteCoreDumpFunction prototype. WriteCoreDumpFunction
    is declared in include/qom/cpu.h and is used all around the code. This
    leaves us with few alternatives:
    
    - change the WriteCoreDumpFunction prototype to include an error pointer.
    This would require to change all functions that implements this prototype...
    0c33659d