📄 rvosmem.h
字号:
/***********************************************************************
Filename : rvosmem.h
Description: rvosmem header file
************************************************************************
Copyright (c) 2001,2002 RADVISION Inc. and RADVISION Ltd.
************************************************************************
NOTICE:
This document contains information that is confidential and proprietary
to RADVISION Inc. and RADVISION Ltd.. No part of this document may be
reproduced in any form whatsoever without written prior approval by
RADVISION Inc. or RADVISION Ltd..
RADVISION Inc. and RADVISION Ltd. reserve the right to revise this
publication and make changes without obligation to notify any person of
such revisions or changes.
***********************************************************************/
/*$
{package:
{name: OSMem}
{superpackage: Memory}
{include: rvmemory.h}
{description:
{p: This module is a driver for the Memory module and provides
standard dynamic memory management using standard OS calls.}
}
{notes:
{note: When calling RvMemoryConstruct, set the drivernum parameter to
RV_MEMORY_DRIVER_OSMEM to create a region using this driver.}
{note: When calling RvMemoryConstruct, the start, size, moremem, and
attr parameters are ignored and have no effect when creating
this type of region.}
{note: Destructing a region of this type will not release memory that
has not been deallocated and will not report an error on most
operating systems.}
{note: Note all operating systems provide complete memory statistics.}
{note: Memory statistics do not account for the overhead that may be
caused by the underlying operating system memory allocation
mechanism.}
{note: This driver is set up as the default driver and is used for
the default region created by the Memory module.}
}
}
$*/
/* Due to type dependencies, rvmemory.h requires that it include driver */
/* headers and not the reverse, so force it to happen. */
#ifndef RV_MEMORY_H
#include "rvmemory.h"
#endif
#ifndef RV_OSMEM_H
#define RV_OSMEM_H
#include "rvlock.h"
/* Error checks to make sure configuration has been done properly */
#if !defined(RV_OSMEM_TYPE) || ((RV_OSMEM_TYPE != RV_OSMEM_MALLOC) && \
(RV_OSMEM_TYPE != RV_OSMEM_OSE) && (RV_OSMEM_TYPE != RV_OSMEM_NUCLEUS) && \
(RV_OSMEM_TYPE != RV_OSMEM_PSOS) && (RV_OSMEM_TYPE != RV_OSMEM_VXWORKS))
#error RV_OSMEM_TYPE not set properly
#endif
/* End of configuration error checks */
/* Module specific error codes (-512..-1023). See rverror.h dor more details */
#if defined(__cplusplus)
extern "C" {
#endif
#if (RV_OSMEM_TYPE == RV_OSMEM_PSOS)
/* Forward declaration needed in RvOsMemData */
typedef struct RvOsMemPsosPool_s RvOsMemPsosPool;
#endif
/* Driver specific region data definition */
typedef struct {
#if (RV_MEMORY_KEEPSTATS != 1) && (RV_OSMEM_TYPE != RV_OSMEM_PSOS)
RvInt dummy; /* make sure structure isn't empty even if its not being used */
#endif
#if (RV_MEMORY_KEEPSTATS == 1)
/* These fields are only used for collecting statistics */
RvLock lock; /* Lock on statistics data */
RvSize_t overhead; /* Overhead that rvmemory asked for */
RvSize_t allocs_requested; /* Number allocs not yet free'd */
RvSize_t bytes_requested; /* Requested bytes alloc'd but not free'd */
RvSize_t bytes_used; /* Total bytes currently in use */
#endif
#if (RV_OSMEM_TYPE == RV_OSMEM_PSOS)
RvOsMemPsosPool *mempools; /* Array of memory pools */
int numpools; /* Number of memory pools */
unsigned long segment_size; /* Segment size of pSOS region (power of 2 >= 16) */
unsigned long psos_region; /* pSOS region ID to get segments from */
#if (RV_MEMORY_KEEPSTATS == 1)
RvSize_t region_bytes_used; /* bytes allocated directly from the region */
#endif
#endif
} RvOsMemData;
/* Prototypes and macros */
RvStatus RvOsMemInit(void);
RvStatus RvOsMemEnd(void);
RvStatus RvOsMemConstruct(void *driverRegion, void *start, RvSize_t size, RvSize_t overhead, RvMemory *moremem, void *attr);
RvStatus RvOsMemDestruct(void *driverRegion);
RvStatus RvOsMemAlloc(void *driverRegion, void **result, RvSize_t size);
RvStatus RvOsMemFree(void *driverRegion, void *ptr);
RvStatus RvOsMemGetInfo(void *driverRegion, RvMemoryInfo *meminfo);
#if defined(RV_TEST_CODE)
void RvOsMemTest(void);
#endif /* RV_TEST_CODE */
#if defined(__cplusplus)
}
#endif
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -