VirtualBox

Changeset 234 in vbox for trunk/include/VBox


Ignore:
Timestamp:
Jan 23, 2007 1:04:38 PM (18 years ago)
Author:
vboxsync
Message:

VMM: Added support for runtime error notifications (VMSetRuntimeError and friends).

Location:
trunk/include/VBox
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmapi.h

    r1 r234  
    8888 *    @code
    8989 *    return VM_SET_ERROR(pVM, VERR_OF_YOUR_CHOICE, "descriptive message");
    90  *    @codeend
     90 *    @endcode
    9191 * @param   pVM             VM handle. Must be non-NULL.
    9292 * @param   rc              VBox status code.
     
    104104 *    @code
    105105 *    return VM_SET_ERROR(pVM, VERR_OF_YOUR_CHOICE, "descriptive message");
    106  *    @codeend
     106 *    @endcode
    107107 * @param   pVM             VM handle. Must be non-NULL.
    108108 * @param   rc              VBox status code.
     
    121121 *    @code
    122122 *    return VM_SET_ERROR(pVM, VERR_OF_YOUR_CHOICE, "descriptive message");
    123  *    @codeend
     123 *    @endcode
    124124 * @param   pVM             VM handle.
    125125 * @param   rc              VBox status code.
     
    128128 */
    129129#define VM_SET_ERROR(pVM, rc, pszMessage)   (VMSetError(pVM, rc, RT_SRC_POS, pszMessage))
     130
     131
     132/**
     133 * VM runtime error callback function.
     134 * See VMSetRuntimeError for the detailed description of parameters.
     135 *
     136 * @param   pVM             The VM handle.
     137 * @param   pvUser          The user argument.
     138 * @param   fFatal          Whether it is a fatal error or not.
     139 * @param   pszErrorID      Error ID string.
     140 * @param   pszFormat       Error message format string.
     141 * @param   args            Error message arguments.
     142 */
     143typedef DECLCALLBACK(void) FNVMATRUNTIMEERROR(PVM pVM, void *pvUser, bool fFatal,
     144                                              const char *pszErrorID,
     145                                              const char *pszFormat, va_list args);
     146/** Pointer to a VM runtime error callback. */
     147typedef FNVMATRUNTIMEERROR *PFNVMATRUNTIMEERROR;
     148
     149/**
     150 * Sets the runtime error message.
     151 * As opposed VMSetError(), this method is intended to inform the VM user about
     152 * errors and error-like conditions that happen at an arbitrary point during VM
     153 * execution (like "host memory low" or "out of host disk space").
     154 *
     155 * The @a fFatal parameter defines whether the error is fatal or not. If it is
     156 * true, then it is expected that the caller has already paused the VM execution
     157 * before calling this method. The VM user is supposed to power off the VM
     158 * immediately after it has received the runtime error notification via the
     159 * FNVMATRUNTIMEERROR callback.
     160 *
     161 * If @a fFatal is false, then the paused state of the VM defines the kind of
     162 * the error. If the VM is paused before calling this method, it means that
     163 * the VM user may try to fix the error condition (i.e. free more host memory)
     164 * and then resume the VM execution. If the VM is not paused before calling
     165 * this method, it means that the given error is a warning about an error
     166 * condition that may happen soon but that doesn't directly affect the
     167 * VM execution by the time of the call.
     168 *
     169 * The @a pszErrorID parameter defines an unique error identificator.
     170 * It is used by the front-ends to show a proper message to the end user
     171 * containig possible actions (for example, Retry/Ignore). For this reason,
     172 * an error ID assigned once to some particular error condition should not
     173 * change in the future. The format of this parameter is "SomeErrorCondition".
     174 *
     175 * @param   pVM             VM handle. Must be non-NULL.
     176 * @param   fFatal          Whether it is a fatal error or not.
     177 * @param   pszErrorID      Error ID string.
     178 * @param   pszFormat       Error message format string.
     179 * @param   ...             Error message arguments.
     180 *
     181 * @return  VBox status code (whether the error has been successfully set
     182 *          and delivered to callbacks or not).
     183 *
     184 * @thread  Any
     185 */
     186VMDECL(int) VMSetRuntimeError(PVM pVM, bool fFatal, const char *pszErrorID,
     187                              const char *pszFormat, ...);
     188
     189/**
     190 * va_list version of VMSetRuntimeError.
     191 *
     192 * @param   pVM             VM handle. Must be non-NULL.
     193 * @param   fFatal          Whether it is a fatal error or not.
     194 * @param   pszErrorID      Error ID string.
     195 * @param   pszFormat       Error message format string.
     196 * @param   args            Error message arguments.
     197 *
     198 * @return  VBox status code (whether the error has been successfully set
     199 *          and delivered to callbacks or not).
     200 *
     201 * @thread  Any
     202 */
     203VMDECL(int) VMSetRuntimeErrorV(PVM pVM, bool fFatal, const char *pszErrorID,
     204                               const char *pszFormat, va_list args);
    130205
    131206
     
    632707VMR3DECL(void) VMR3SetErrorWorker(PVM pVM);
    633708
     709/**
     710 * Registers a VM runtime error callback.
     711 *
     712 * @returns VBox status code.
     713 * @param   pVM                 The VM handle.
     714 * @param   pfnAtRuntimeError   Pointer to callback.
     715 * @param   pvUser              User argument.
     716 * @thread  Any.
     717 */
     718VMR3DECL(int)   VMR3AtRuntimeErrorRegister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser);
     719
     720/**
     721 * Deregisters a VM runtime error callback.
     722 *
     723 * @returns VBox status code.
     724 * @param   pVM                 The VM handle.
     725 * @param   pfnAtRuntimeError   Pointer to callback.
     726 * @param   pvUser              User argument.
     727 * @thread  Any.
     728 */
     729VMR3DECL(int)   VMR3AtRuntimeErrorDeregister(PVM pVM, PFNVMATRUNTIMEERROR pfnAtRuntimeError, void *pvUser);
     730
     731/**
     732 * This is a worker function for GC and Ring-0 calls to VMSetRuntimeError and VMSetRuntimeErrorV.
     733 * The message is found in VMINT.
     734 *
     735 * @param   pVM             The VM handle.
     736 * @thread  EMT.
     737 */
     738VMR3DECL(void) VMR3SetRuntimeErrorWorker(PVM pVM);
     739
    634740
    635741/**
  • trunk/include/VBox/vmm.h

    r1 r234  
    8686    /** Set the VM error message. */
    8787    VMMCALLHOST_VM_SET_ERROR,
     88    /** Set the VM runtime error message. */
     89    VMMCALLHOST_VM_SET_RUNTIME_ERROR,
    8890    /** The usual 32-bit hack. */
    8991    VMMCALLHOST_32BIT_HACK = 0x7fffffff
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette