Lines Matching refs:size

39 std::shared_ptr<Ashmem> CreateAshmemStd(const char *name, int32_t size)
41 if ((name == nullptr) || (size <= 0)) {
42 UTILS_LOGE("%{public}s: Parameter is invalid, size= %{public}d", __func__, size);
46 int fd = AshmemCreate(name, size);
48 UTILS_LOGE("%{public}s: Failed to exec AshmemCreate, fd= %{public}d", __func__, size);
52 return std::make_shared<Ashmem>(fd, size);
103 int AshmemCreate(const char *name, size_t size)
129 ret = TEMP_FAILURE_RETRY(ioctl(fd, ASHMEM_SET_SIZE, size));
131 UTILS_LOGE("%{public}s: Failed to set size, size= %{public}zu, errno = %{public}d", __func__, size, errno);
148 Ashmem::Ashmem(int fd, int32_t size) : memoryFd_(fd), memorySize_(size), flag_(0), startAddr_(nullptr)
158 sptr<Ashmem> Ashmem::CreateAshmem(const char *name, int32_t size)
160 if ((name == nullptr) || (size <= 0)) {
161 UTILS_LOGE("%{public}s: Parameter is invalid, size= %{public}d", __func__, size);
165 int fd = AshmemCreate(name, size);
167 UTILS_LOGE("%{public}s: Failed to exec AshmemCreate, fd= %{public}d", __func__, size);
171 return new Ashmem(fd, size);
255 bool Ashmem::WriteToAshmem(const void *data, int32_t size, int32_t offset) const
257 bool Ashmem::WriteToAshmem(const void *data, int32_t size, int32_t offset)
264 if (!CheckValid(size, offset, PROT_WRITE)) {
270 int ret = memcpy_s(tmpData + offset, memorySize_ - offset, reinterpret_cast<const char *>(data), size);
280 const void *Ashmem::ReadFromAshmem(int32_t size, int32_t offset) const
282 const void *Ashmem::ReadFromAshmem(int32_t size, int32_t offset)
285 if (!CheckValid(size, offset, PROT_READ)) {
293 bool Ashmem::CheckValid(int32_t size, int32_t offset, int cmd) const
298 if ((size < 0) || (size > memorySize_) || (offset < 0) || (offset > memorySize_)) {
299 UTILS_LOGE("%{public}s: , invalid parameter, size = %{public}d, memorySize_ = %{public}d, offset = %{public}d",
300 __func__, size, memorySize_, offset);
303 if (offset + size > memorySize_) {
304 UTILS_LOGE("%{public}s: , invalid parameter, size = %{public}d, memorySize_ = %{public}d, offset = %{public}d",
305 __func__, size, memorySize_, offset);