本文整理汇总了C++中delete_area函数的典型用法代码示例。如果您正苦于以下问题:C++ delete_area函数的具体用法?C++ delete_area怎么用?C++ delete_area使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_area函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mem_write
status_t
mem_write(void* cookie, off_t position, const void* buffer, size_t* numBytes)
{
void *virtualAddress;
area_id area;
status_t status = B_OK;
/* check permissions */
if (getuid() != 0 && geteuid() != 0) {
*numBytes = 0;
return EPERM;
}
area = mem_map_target(position, *numBytes, B_WRITE_AREA, &virtualAddress);
if (area < 0) {
*numBytes = 0;
return area;
}
if (user_memcpy(virtualAddress, buffer, *numBytes) != B_OK)
status = B_BAD_ADDRESS;
delete_area(area);
return status;
}
示例2: unmap_device
static void unmap_device(device_info *di) {
shared_info *si = di->si;
uint32 tmpUlong;
pci_info *pcii = &(di->pcii);
/* disable memory mapped IO */
tmpUlong = get_pci(PCI_command, 4);
tmpUlong &= 0xfffffffc;
set_pci(PCI_command, 4, tmpUlong);
/* delete the areas */
if (si->regs_area >= 0) delete_area(si->regs_area);
if (si->fb_area >= 0) delete_area(si->fb_area);
si->regs_area = si->fb_area = -1;
si->framebuffer = NULL;
di->regs = NULL;
}
示例3: CALLED
BTimeSource::~BTimeSource()
{
CALLED();
if (fArea > 0)
delete_area(fArea);
delete fSlaveNodes;
}
示例4: scsi_free_dma_buffer
static void
scsi_free_dma_buffer(dma_buffer *buffer)
{
if (buffer->area > 0) {
SHOW_FLOW0(1, "Destroying buffer");
delete_area(buffer->area);
buffer->area = 0;
buffer->size = 0;
}
if (buffer->sg_list_area > 0) {
delete_area(buffer->sg_list_area);
buffer->sg_list_area = 0;
}
}
示例5: buffer_force_stop
static status_t
buffer_force_stop(device_t* device)
{
dprintf("null_audio: %s\n" , __func__ );
if (device && device->running)
null_stop_hardware(device);
delete_area(device->playback_stream.buffer_area);
delete_area(device->record_stream.buffer_area);
delete_sem(device->playback_stream.buffer_ready_sem);
delete_sem(device->record_stream.buffer_ready_sem);
return B_OK;
}
示例6: create_area_etc
/*static*/ status_t
TracingMetaData::_CreateMetaDataArea(bool findPrevious, area_id& _area,
TracingMetaData*& _metaData)
{
// search meta data in memory (from previous session)
TracingMetaData* metaData;
addr_t metaDataAddress = kMetaDataBaseAddress;
for (; metaDataAddress <= kMetaDataBaseEndAddress;
metaDataAddress += kMetaDataAddressIncrement) {
area_id area = create_area_etc(B_SYSTEM_TEAM, "tracing metadata",
(void**)&metaData, B_ANY_KERNEL_ADDRESS, B_PAGE_SIZE,
B_FULL_LOCK, B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA,
metaDataAddress, CREATE_AREA_DONT_CLEAR);
if (area < 0)
continue;
if (!findPrevious) {
_area = area;
_metaData = metaData;
return B_OK;
}
if (metaData->fMagic1 == kMetaDataMagic1
&& metaData->fMagic2 == kMetaDataMagic2
&& metaData->fMagic3 == kMetaDataMagic3) {
_area = area;
_metaData = metaData;
return B_OK;
}
delete_area(area);
}
return B_ENTRY_NOT_FOUND;
}
示例7: _user_system_profiler_recorded
status_t
_user_system_profiler_recorded(struct system_profiler_parameters* userParameters)
{
if (userParameters == NULL || !IS_USER_ADDRESS(userParameters))
return B_BAD_ADDRESS;
if (sRecordedParameters == NULL)
return B_ERROR;
// Transfer the area to the userland process
void* address;
area_id newArea = transfer_area(sRecordedParameters->buffer_area, &address,
B_ANY_ADDRESS, team_get_current_team_id(), true);
if (newArea < 0)
return newArea;
status_t status = set_area_protection(newArea, B_READ_AREA);
if (status == B_OK) {
sRecordedParameters->buffer_area = newArea;
status = user_memcpy(userParameters, sRecordedParameters,
sizeof(system_profiler_parameters));
}
if (status != B_OK)
delete_area(newArea);
delete sRecordedParameters;
sRecordedParameters = NULL;
return status;
}
示例8: while
void
BDirectWindow::_DisposeData()
{
// wait until the connection terminates: we can't destroy
// the object until the client receives the B_DIRECT_STOP
// notification, or bad things will happen
while (fConnectionEnable)
snooze(50000);
_LockDirect();
if (fInitStatus & DW_STATUS_THREAD_STARTED) {
fDaemonKiller = true;
// delete this sem, otherwise the Direct daemon thread
// will wait forever on it
delete_sem(fDisableSem);
status_t retVal;
wait_for_thread(fDirectDaemonId, &retVal);
}
#if DW_NEEDS_LOCKING
if (fInitStatus & DW_STATUS_SEM_CREATED)
delete_sem(fDirectSem);
#endif
if (fInitStatus & DW_STATUS_AREA_CLONED)
delete_area(fClonedClippingArea);
}
示例9: time_faults
void time_faults()
{
const int FAULT_PAGES = 100;
char *addr;
int area = create_area("fault area", (void**) &addr, 0, FAULT_PAGES
* PAGE_SIZE, AREA_NOT_WIRED, USER_READ | USER_WRITE);
bigtime_t start = system_time();
char *c = addr;
for (int i = 0; i < FAULT_PAGES; i++) {
*c = 0;
c += PAGE_SIZE;
}
bigtime_t time1 = system_time() - start;
start = system_time();
c = addr;
for (int i = 0; i < FAULT_PAGES; i++) {
*c = 0;
c += PAGE_SIZE;
}
bigtime_t time2 = system_time() - start;
printf("\n%d pages. fault time %Ldus (%Ldus per fault) no fault time %Ldus (%Ldus per fault)\n",
FAULT_PAGES, time1, time1 / FAULT_PAGES, time2, time2 / FAULT_PAGES);
delete_area(area);
}
示例10: InitCommon
static status_t
InitCommon(int fileDesc)
{
// Initialization function used by primary and cloned accelerants.
gInfo.deviceFileDesc = fileDesc;
// Get area ID of shared data from driver.
area_id sharedArea;
status_t result = ioctl(gInfo.deviceFileDesc, TDFX_GET_SHARED_DATA,
&sharedArea, sizeof(sharedArea));
if (result != B_OK)
return result;
gInfo.sharedInfoArea = clone_area("3DFX shared info",
(void**)&(gInfo.sharedInfo), B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA,
sharedArea);
if (gInfo.sharedInfoArea < 0)
return gInfo.sharedInfoArea; // sharedInfoArea has error code
gInfo.regsArea = clone_area("3DFX regs area", (void**)&(gInfo.regs),
B_ANY_ADDRESS, B_READ_AREA | B_WRITE_AREA, gInfo.sharedInfo->regsArea);
if (gInfo.regsArea < 0) {
delete_area(gInfo.sharedInfoArea);
return gInfo.regsArea; // regsArea has error code
}
return B_OK;
}
示例11: VBoxGuestHaikuDetach
static status_t VBoxGuestHaikuDetach(void)
{
struct VBoxGuestDeviceState *pState = &sState;
if (cUsers > 0)
return EBUSY;
/*
* Reverse what we did in VBoxGuestHaikuAttach.
*/
VBoxGuestHaikuRemoveIRQ(pState);
if (pState->iVMMDevMemAreaId)
delete_area(pState->iVMMDevMemAreaId);
VBoxGuestDeleteDevExt(&g_DevExt);
#ifdef DO_LOG
RTLogDestroy(RTLogRelSetDefaultInstance(NULL));
RTLogSetDefaultInstance(NULL);
// RTLogDestroy(RTLogSetDefaultInstance(NULL));
#endif
RTSpinlockDestroy(g_Spinlock);
g_Spinlock = NIL_RTSPINLOCK;
RTR0Term();
return B_OK;
}
示例12: UNINIT_ACCELERANT
void UNINIT_ACCELERANT(void)
{
if (accelerantIsClone)
{
LOG(4,("UNINIT_ACCELERANT: shutting down clone accelerant.\n"));
}
else
{
LOG(4,("UNINIT_ACCELERANT: shutting down primary accelerant.\n"));
/* delete benaphores ONLY if we are the primary accelerant */
DELETE_BEN(si->engine.lock);
DELETE_BEN(si->overlay.lock);
/* ensure that INIT_ACCELERANT can be executed again */
si->accelerant_in_use = false;
}
/* free our mode list area */
delete_area(my_mode_list_area);
/* paranoia */
my_mode_list = 0;
/* release our cloned data */
uninit_common();
/* close the file handle ONLY if we're the clone */
if (accelerantIsClone) close(fd);
}
示例13: alloc_mem
area_id
alloc_mem(void **virt, void **phy, size_t size, uint32 protection,
const char *name)
{
// TODO: phy should be phys_addr_t*!
physical_entry pe;
void * virtadr;
area_id areaid;
status_t rv;
TRACE("allocating %ld bytes for %s\n", size, name);
size = ROUNDUP(size, B_PAGE_SIZE);
areaid = create_area(name, &virtadr, B_ANY_KERNEL_ADDRESS, size,
B_32_BIT_CONTIGUOUS, protection);
// TODO: The rest of the code doesn't deal correctly with physical
// addresses > 4 GB, so we have to force 32 bit addresses here.
if (areaid < B_OK) {
TRACE("couldn't allocate area %s\n", name);
return B_ERROR;
}
rv = get_memory_map(virtadr, size, &pe, 1);
if (rv < B_OK) {
delete_area(areaid);
TRACE("couldn't map %s\n", name);
return B_ERROR;
}
if (virt)
*virt = virtadr;
if (phy)
*phy = (void*)(addr_t)pe.address;
TRACE("area = %ld, size = %ld, virt = %p, phy = %p\n", areaid, size, virtadr, pe.address);
return areaid;
}
示例14: delete_area
~RequestRelocator()
{
if (!fSuccess) {
for (int32 i = 0; i < *fAreaCount; i++)
delete_area(fAreas[i]);
}
}
示例15: alloc_mem
area_id
alloc_mem(void **phy, void **log, size_t size, const char *name)
{
physical_entry pe;
void * logadr;
area_id areaid;
status_t rv;
LOG(("allocating %d bytes for %s\n",size,name));
size = round_to_pagesize(size);
areaid = create_area(name, &logadr, B_ANY_KERNEL_ADDRESS, size,
B_CONTIGUOUS, B_READ_AREA | B_WRITE_AREA);
if (areaid < B_OK) {
PRINT(("couldn't allocate area %s\n",name));
return B_ERROR;
}
rv = get_memory_map(logadr, size, &pe, 1);
if (rv < B_OK) {
delete_area(areaid);
PRINT(("couldn't map %s\n", name));
return B_ERROR;
}
memset(logadr, 0, size);
if (log)
*log = logadr;
if (phy)
*phy = pe.address;
LOG(("area = %d, size = %d, log = %#08X, phy = %#08X\n", areaid, size,
logadr, pe.address));
return areaid;
}