• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ delete_area函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中delete_area函数的典型用法代码示例。如果您正苦于以下问题:C++ delete_area函数的具体用法?C++ delete_area怎么用?C++ delete_area使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了delete_area函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:mmuman,项目名称:haiku,代码行数:25,代码来源:mem.c


示例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;
}
开发者ID:DonCN,项目名称:haiku,代码行数:16,代码来源:driver.c


示例3: CALLED

BTimeSource::~BTimeSource()
{
	CALLED();
	if (fArea > 0)
		delete_area(fArea);
	delete fSlaveNodes;
}
开发者ID:mylegacy,项目名称:haiku,代码行数:7,代码来源:TimeSource.cpp


示例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;
	}
}
开发者ID:mmanley,项目名称:Antares,代码行数:16,代码来源:dma_buffer.c


示例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;
}
开发者ID:mmanley,项目名称:Antares,代码行数:16,代码来源:null_multi.c


示例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;
}
开发者ID:mmanley,项目名称:Antares,代码行数:35,代码来源:tracing.cpp


示例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;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:31,代码来源:system_profiler.cpp


示例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);
}
开发者ID:mmanley,项目名称:Antares,代码行数:28,代码来源:DirectWindow.cpp


示例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);
}
开发者ID:FFalcon,项目名称:jbushOS,代码行数:28,代码来源:test_vm.cpp


示例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;
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:30,代码来源:accelerant.cpp


示例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;
}
开发者ID:bayasist,项目名称:vbox,代码行数:29,代码来源:VBoxGuest-haiku.c


示例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);
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:27,代码来源:InitAccelerant.c


示例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;
}
开发者ID:luciang,项目名称:haiku,代码行数:34,代码来源:util.c


示例14: delete_area

	~RequestRelocator()
	{
		if (!fSuccess) {
			for (int32 i = 0; i < *fAreaCount; i++)
				delete_area(fAreas[i]);
		}
	}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:7,代码来源:Requests.cpp


示例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;
}
开发者ID:mmanley,项目名称:Antares,代码行数:32,代码来源:util.c


示例16: APR_DECLARE

APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m)
{
    delete_area(m->aid);
    m->avail = 0;
    m->memblock = NULL;
    return APR_SUCCESS;
}
开发者ID:Kiddinglife,项目名称:geco-game-engine,代码行数:7,代码来源:shm.c


示例17: uninit_common

/*! Clean up data common to both primary and cloned accelerant */
static void
uninit_common(void)
{
	intel_free_memory(gInfo->context_base);

	delete_area(gInfo->regs_area);
	delete_area(gInfo->shared_info_area);

	gInfo->regs_area = gInfo->shared_info_area = -1;

	// close the file handle ONLY if we're the clone
	if (gInfo->is_clone)
		close(gInfo->device);

	free(gInfo);
}
开发者ID:koletzky,项目名称:haiku,代码行数:17,代码来源:accelerant.cpp


示例18: CALLED

status_t
BMediaFiles::RewindTypes()
{
	CALLED();

	_ClearTypes();

	server_get_media_types_request request;
	request.team = BPrivate::current_team();

	server_get_media_types_reply reply;
	status_t status = QueryServer(SERVER_GET_MEDIA_FILE_TYPES, &request,
		sizeof(request), &reply, sizeof(reply));
	if (status != B_OK) {
		ERROR("BMediaFiles::RewindTypes: failed to rewind types: %s\n",
			strerror(status));
		return status;
	}

	const char* types = (const char*)reply.address;
	for (int32 i = 0; i < reply.count; i++)
		fTypes.AddItem(new BString(types + i * B_MEDIA_NAME_LENGTH));

	delete_area(reply.area);

	fTypeIndex = 0;
	return B_OK;
}
开发者ID:mmanley,项目名称:Antares,代码行数:28,代码来源:MediaFiles.cpp


示例19: FreeShared

static void
FreeShared()
{
	delete_area(gPd->sharedArea);
	gPd->sharedArea = -1;
	gPd->si = NULL;
}
开发者ID:DonCN,项目名称:haiku,代码行数:7,代码来源:device.c


示例20: dbprintf

void ATIRadeon::UnmapROM( int nFd, PCI_Info_s *dev )
{
	if (!rinfo.bios_seg)
		return;

	rinfo.bios_seg = NULL;

	m_pROMBase = NULL;

	if(m_hROMArea >= 0)
	{
		/* This is the workaround for the old crash issue
		   - just remapping it to the end of VRAM works -MK */
		if( remap_area (m_hROMArea, (void *)((rinfo.fb_base_phys + rinfo.video_ram))) < 0 ) {
			dbprintf("Radeon :: failed to unmap ROM area (%d)\n", m_hROMArea);
			return;
		}

		delete_area(m_hROMArea);
	}
	
	/* This will disable and set address to unassigned */
	pci_gfx_write_config( nFd, dev->nBus, dev->nDevice,
		dev->nFunction, PCI_ROM_BASE, 4, 0 );
}
开发者ID:rickcaudill,项目名称:Pyro,代码行数:25,代码来源:radeon_rom.cpp



注:本文中的delete_area函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ delete_data函数代码示例发布时间:2022-05-30
下一篇:
C++ deleteTree函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap