VirtualBox

Changeset 51074 in vbox for trunk/include


Ignore:
Timestamp:
Apr 15, 2014 11:26:10 AM (11 years ago)
Author:
vboxsync
Message:

Runtime: Add RTMemLocked* API to allocate locked memory

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/mangling.h

    r50832 r51074  
    896896# define RTMemFree                                      RT_MANGLER(RTMemFree)
    897897# define RTMemFreeEx                                    RT_MANGLER(RTMemFreeEx)
     898# define RTMemLockedAllocExTag                          RT_MANGLER(RTMemLockedAllocExTag)
     899# define RTMemLockedAllocZExTag                         RT_MANGLER(RTMemLockedAllocExZTag)
     900# define RTMemLockedAllocTag                            RT_MANGLER(RTMemLockedAllocTag)
     901# define RTMemLockedAllocZTag                           RT_MANGLER(RTMemLockedAllocZTag)
     902# define RTMemLockedFree                                RT_MANGLER(RTMemLockedFree)
    898903# define RTMemPageAllocTag                              RT_MANGLER(RTMemPageAllocTag)
    899904# define RTMemPageAllocZTag                             RT_MANGLER(RTMemPageAllocZTag)
  • trunk/include/iprt/mem.h

    r46567 r51074  
    506506RTDECL(void) RTMemWipeThoroughly(void *pv, size_t cb, size_t cMinPasses) RT_NO_THROW;
    507507
     508/**
     509 * Allocate locked memory with default tag - extended version.
     510 *
     511 * @returns IPRT status code.
     512 * @param   cb      The amount of memory to allocate.
     513 * @param   ppv     Where to store the pointer to the allocated memory on success.
     514 */
     515#define RTMemLockedAllocEx(cb, ppv) RTMemLockedAllocExTag((cb), RTMEM_TAG, (ppv))
     516
     517/**
     518 * Allocate locked memory - extended version.
     519 *
     520 * @returns IPRT status code.
     521 * @param   cb      The amount of memory to allocate.
     522 * @param   pszTag  Allocation tag used for statistics and such.
     523 * @param   ppv     Where to store the pointer to the allocated memory on success.
     524 */
     525RTDECL(int) RTMemLockedAllocExTag(size_t cb, const char *pszTag, void **ppv) RT_NO_THROW;
     526
     527/**
     528 * Allocate zeroed locked memory with default tag - extended version.
     529 *
     530 * @returns IPRT status code.
     531 * @param   cb      The amount of memory to allocate.
     532 * @param   ppv     Where to store the pointer to the allocated memory on success.
     533 */
     534#define RTMemLockedAllocZEx(cb, ppv) RTMemLockedAllocZExTag((cb), RTMEM_TAG, (ppv))
     535
     536/**
     537 * Allocate zeroed locked memory - extended version.
     538 *
     539 * @returns IPRT status code.
     540 * @param   cb      The amount of memory to allocate.
     541 * @param   pszTag  Allocation tag used for statistics and such.
     542 * @param   ppv     Where to store the pointer to the allocated memory on success.
     543 */
     544RTDECL(int) RTMemLockedAllocZExTag(size_t cb, const char *pszTag, void **ppv) RT_NO_THROW;
     545
     546/**
     547 * Allocate locked memory with the default tag - shortcut for RTMemLockedAllocExTag().
     548 *
     549 * @returns Pointer to allocated memory on success.
     550 * @returns NULL on failure (use RTMemLockedAllocExTag() if the specific reason is required)
     551 * @param   cb      The amount of memory to allocate.
     552 */
     553#define RTMemLockedAlloc(cb) RTMemLockedAllocTag((cb), RTMEM_TAG)
     554
     555/**
     556 * Allocate locked memory - shortcut for RTMemLockedAllocExTag().
     557 *
     558 * @returns Pointer to allocated memory on success.
     559 * @returns NULL on failure (use RTMemLockedAllocExTag() if the specific reason is required)
     560 * @param   cb      The amount of memory to allocate.
     561 * @param   pszTag  Allocation tag used for statistics and such.
     562 */
     563RTDECL(void *) RTMemLockedAllocTag(size_t cb, const char *pszTag) RT_NO_THROW;
     564
     565/**
     566 * Allocate locked zeroed memory with the default tag - shortcut for RTMemLockedAllocZExTag().
     567 *
     568 * @returns Pointer to allocated memory on success.
     569 * @returns NULL on failure (use RTMemLockedAllocZExTag() if the specific reason is required)
     570 * @param   cb      The amount of memory to allocate.
     571 */
     572#define RTMemLockedAllocZ(cb) RTMemLockedAllocZTag((cb), RTMEM_TAG)
     573
     574/**
     575 * Allocate locked zeroed memory - shortcut for RTMemLockedAllocZExTag().
     576 *
     577 * @returns Pointer to allocated memory on success.
     578 * @returns NULL on failure (use RTMemLockedAllocZExTag() if the specific reason is required)
     579 * @param   cb      The amount of memory to allocate.
     580 * @param   pszTag  Allocation tag used for statistics and such.
     581 */
     582RTDECL(void *) RTMemLockedAllocZTag(size_t cb, const char *pszTag) RT_NO_THROW;
     583
     584/**
     585 * Frees memory allocated with any of the RTMemLockedAlloc* API.
     586 *
     587 * @returns nothing.
     588 * @param   pv    Pointer to the memory block to free.
     589 */
     590RTDECL(void) RTMemLockedFree(void *pv) RT_NO_THROW;
     591
     592
    508593#ifdef IN_RING0
    509594
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