/commonlibrary/c_utils/base/test/unittest/rust/ |
H A D | rust_utils_ashmem_test.rs | 17 use utils_rust::ashmem; 27 let ashmem = unsafe { ashmem::ffi::CreateAshmemStd(c_name.as_ptr(), MEMORY_SIZE) }; in test_ashmem_ffi_write_read_001() 28 assert!(!ashmem.is_null()); in test_ashmem_ffi_write_read_001() 29 assert_eq!(ashmem.GetAshmemSize(), MEMORY_SIZE); in test_ashmem_ffi_write_read_001() 31 assert!(ashmem.MapAshmem(ashmem::PROT_READ | ashmem::PROT_WRITE)); in test_ashmem_ffi_write_read_001() 33 ashmem.UnmapAshmem(); in test_ashmem_ffi_write_read_001() 34 ashmem in test_ashmem_ffi_write_read_001() [all...] |
/commonlibrary/c_utils/base/test/unittest/common/ |
H A D | utils_ashmem_test.cpp | 27 #include "ashmem.h" 60 * @tc.desc: create and map ashmem 67 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); in HWTEST_F() local 68 ASSERT_TRUE(ashmem != nullptr); in HWTEST_F() 69 ASSERT_TRUE(ashmem->GetAshmemSize() == MEMORY_SIZE); in HWTEST_F() 71 bool ret = ashmem->MapAshmem(PROT_READ | PROT_WRITE); in HWTEST_F() 74 ashmem->UnmapAshmem(); in HWTEST_F() 75 ashmem->CloseAshmem(); in HWTEST_F() 80 * @tc.desc: write to and read from ashmem 85 sptr<Ashmem> ashmem in HWTEST_F() local 120 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); HWTEST_F() local 154 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); HWTEST_F() local 191 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); HWTEST_F() local 223 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), -1); HWTEST_F() local 242 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); HWTEST_F() local 258 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); HWTEST_F() local 280 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); HWTEST_F() local 304 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); HWTEST_F() local 332 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); HWTEST_F() local [all...] |
/commonlibrary/c_utils/base/test/benchmarktest/ashemem_benchmark_test/ |
H A D | ashemem_benchmark_test.cpp | 26 #include "ashmem.h" 68 * @tc.desc: create and map ashmem 75 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); in BENCHMARK_F() local 76 AssertUnequal(ashmem, nullptr, "ashmem != nullptr did not equal true as expected.", state); in BENCHMARK_F() 77 AssertEqual(ashmem->GetAshmemSize(), MEMORY_SIZE, in BENCHMARK_F() 78 "ashmem->GetAshmemSize() == MEMORY_SIZE did not equal true as expected.", state); in BENCHMARK_F() 80 bool ret = ashmem->MapAshmem(PROT_READ | PROT_WRITE); in BENCHMARK_F() 83 ashmem->UnmapAshmem(); in BENCHMARK_F() 84 ashmem in BENCHMARK_F() 98 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 139 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 178 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 220 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 258 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), -1); BENCHMARK_F() local 281 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 301 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 327 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 355 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 387 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 438 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 470 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local 490 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(MEMORY_NAME.c_str(), MEMORY_SIZE); BENCHMARK_F() local [all...] |
/commonlibrary/c_utils/base/test/fuzztest/ashmem_fuzzer/ |
H A D | ashmem_fuzzer.cpp | 18 #include "ashmem.h" 30 sptr<Ashmem> ashmem = Ashmem::CreateAshmem(name.c_str(), memorySize); in AshmemTestFunc() local 31 if (ashmem == nullptr) { in AshmemTestFunc() 35 bool ret = ashmem->MapReadAndWriteAshmem(); in AshmemTestFunc() 41 ret = ashmem->WriteToAshmem(memoryContent.c_str(), memoryContent.size(), 0); in AshmemTestFunc() 47 ret = ashmem->WriteToAshmem(memoryContent2.c_str(), memoryContent2.size(), memoryContent.size()); in AshmemTestFunc() 52 ashmem->ReadFromAshmem(memoryContent.size(), 0); in AshmemTestFunc() 54 ashmem->ReadFromAshmem(memoryContent2.size(), memoryContent.size()); in AshmemTestFunc() 57 ashmem->SetProtection(prot); in AshmemTestFunc() 59 ashmem in AshmemTestFunc() [all...] |
/commonlibrary/c_utils/base/src/rust/ |
H A D | lib.rs | 17 /// Module Ashmem. Provides interfaces to operate on ashmem(Anonymous shared 19 pub mod ashmem; modules
|
/commonlibrary/memory_utils/libpurgeablemem/cpp/include/ |
H A D | purgeable_ashmem.h | 25 #include <linux/ashmem.h> 27 #include "ashmem.h"
|
/commonlibrary/c_utils/base/include/ |
H A D | ashmem.h | 17 * @file ashmem.h 27 #include <linux/ashmem.h> 87 * The <b>/dev/ashmem</b> file will be opened, whose file 103 * @param fd File descriptor of an ashmem in kenrel. 104 * @param size Size of the corresponding ashmem region in kernel. 110 * @brief Get file descriptor of the corresponding ashmem in kernel. 113 * 0 when ashmem is closed. 121 * @brief Set the protection flag of ashmem region in kernel. 129 * @brief Get the protection flag of ashmem region in kernel. 136 * @brief Get the size of ashmem regio [all...] |
/commonlibrary/c_utils/base/src/ |
H A D | ashmem.cpp | 16 #include "ashmem.h" 22 #include <linux/ashmem.h> 68 int fd = TEMP_FAILURE_RETRY(open("/dev/ashmem", O_RDWR | O_CLOEXEC)); in AshmemOpenLocked() 99 * AshmemCreate - create a new ashmem region and returns the file descriptor
|
/commonlibrary/memory_utils/libpurgeablemem/test/ |
H A D | purgeableashmem_test.cpp | 24 #include <linux/ashmem.h> 27 #include "ashmem.h"
|