status_t VMArea::Init(const char* name, uint32 allocationFlags) { // restrict the area name to B_OS_NAME_LENGTH size_t length = strlen(name) + 1; if (length > B_OS_NAME_LENGTH) length = B_OS_NAME_LENGTH; // clone the name this->name = (char*)malloc_etc(length, allocationFlags); if (this->name == NULL) return B_NO_MEMORY; strlcpy(this->name, name, length); id = atomic_add(&sNextAreaID, 1); return B_OK; }
IOBuffer* IOBuffer::Create(uint32 count, bool vip) { size_t size = sizeof(IOBuffer) + sizeof(iovec) * (count - 1); IOBuffer* buffer = (IOBuffer*)(malloc_etc(size, vip ? HEAP_PRIORITY_VIP : 0)); if (buffer == NULL) return NULL; buffer->fCapacity = count; buffer->fVecCount = 0; buffer->fUser = false; buffer->fPhysical = false; buffer->fVIP = vip; buffer->fMemoryLocked = false; return buffer; }