/kernel/liteos_a/testsuites/unittest/basic/mem/shm/full/ |
D | shm_test_002.cpp | 38 int shmid[SHMID_MAX + 1] = {-1}; in Testcase() local 48 …shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, SHM_FLAG | IPC_CREAT); // 0x1234: a key used to create… in Testcase() 49 ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]); in Testcase() 51 ret = shmctl(shmid[0], IPC_RMID, NULL); in Testcase() 54 shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT); in Testcase() 55 ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]); in Testcase() 57 ret = shmctl(shmid[0], IPC_RMID, NULL); in Testcase() 61 shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT); in Testcase() 62 ICUNIT_ASSERT_NOT_EQUAL(shmid[i], -1, shmid[i]); in Testcase() 65 shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT); in Testcase() [all …]
|
D | shm_test_005.cpp | 35 int shmid; in Testcase() local 42 shmid = shmget(0x111, PAGE_SIZE, 0777 | IPC_EXCL); in Testcase() 43 ICUNIT_ASSERT_EQUAL(shmid, -1, shmid); in Testcase() 46 shmid = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); in Testcase() 47 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 49 shm = shmat(shmid, NULL, SHM_REMAP); in Testcase() 52 shm = shmat(shmid, reinterpret_cast<const void *>(0x100), 0); in Testcase() 55 shm = shmat(shmid, NULL, 0); in Testcase() 59 ICUNIT_ASSERT_EQUAL(ret, -1, shmid); in Testcase() 68 ret = shmctl(shmid, IPC_RMID, NULL); in Testcase() [all …]
|
D | shm_test_004.cpp | 35 int shmid; in Testcase() local 41 shmid = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); in Testcase() 42 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 44 shm = shmat(shmid, NULL, 0); in Testcase() 49 ret = shmctl(shmid, IPC_STAT, &ds); in Testcase() 57 ret = shmctl(shmid, SHM_STAT, &ds); in Testcase() 64 ret = shmctl(shmid, IPC_SET, &ds); in Testcase() 67 ret = shmctl(shmid, IPC_INFO, (struct shmid_ds *)&info); in Testcase() 78 ret = shmctl(shmid, IPC_RMID, NULL); in Testcase() 83 ret = shmctl(shmid, IPC_RMID, NULL); in Testcase()
|
D | shm_test_003.cpp | 35 int shmid; in Testcase() local 41 shmid = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT); in Testcase() 42 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 44 shm = shmat(shmid, NULL, 0); in Testcase() 58 shm = shmat(shmid, vaddrPageAlign, 0); in Testcase() 67 shm = shmat(shmid, vaddr, SHM_REMAP); in Testcase() 70 shm = shmat(shmid, vaddr, 0); in Testcase() 73 ret = shmctl(shmid, IPC_RMID, NULL); in Testcase()
|
D | shm_test_010.cpp | 37 int shmid; in Testcase() local 44 shmid = shmget((key_t)1234, memSize, 0666 | IPC_CREAT); in Testcase() 45 if (shmid < 0) { in Testcase() 53 shmid = shmget((key_t)1234, memSize, 0000 | IPC_CREAT); in Testcase() 54 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 56 ret = shmctl(shmid, IPC_RMID, NULL); in Testcase()
|
D | shm_test_001.cpp | 46 int shmid; in ShmReadFunc() local 49 shmid = shmget((key_t)1234, sizeof(struct shared_use_st), 0666 | IPC_CREAT); in ShmReadFunc() 50 ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID(shmid, -1, shmid); in ShmReadFunc() 52 shm = shmat(shmid, 0, 0); in ShmReadFunc() 75 ret = shmctl(shmid, IPC_RMID, 0); in ShmReadFunc() 87 int shmid; in ShmWriteFunc() local 91 shmid = shmget((key_t)1234, sizeof(struct shared_use_st), 0666 | IPC_CREAT); in ShmWriteFunc() 92 ICUNIT_ASSERT_NOT_EQUAL_NULL_VOID(shmid, -1, shmid); in ShmWriteFunc() 94 shm = shmat(shmid, nullptr, 0); in ShmWriteFunc()
|
D | shm_test_008.cpp | 38 int shmid; in Testcase() local 41 shmid = shmget(IPC_PRIVATE, memSize, SHM_R | IPC_CREAT); in Testcase() 42 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 44 shared = shmat(shmid, 0, 0); in Testcase() 48 shared = shmat(shmid, 0, SHM_RDONLY); in Testcase() 54 ret = shmctl(shmid, IPC_RMID, NULL); in Testcase()
|
D | shm_test_006.cpp | 37 int shmid; in Testcase() local 41 shmid = shmget(IPC_PRIVATE, memSize, 0666 | IPC_CREAT); in Testcase() 42 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 44 shared = shmat(shmid, 0, 0); in Testcase() 51 shared = shmat(shmid, remap, SHM_REMAP); in Testcase() 57 ret = shmctl(shmid, IPC_RMID, NULL); in Testcase()
|
D | shm_test_007.cpp | 37 int shmid; in Testcase() local 44 shmid = shmget((key_t)1234, memSize, 0666 | IPC_CREAT); in Testcase() 45 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 50 if ((shared = static_cast<char *>(shmat(shmid, 0, 0))) == reinterpret_cast<void *>(-1)) { in Testcase() 65 if (shmctl(shmid, IPC_RMID, NULL) == -1) { in Testcase() 75 shared = static_cast<char *>(shmat(shmid, 0, 0)); in Testcase()
|
/kernel/liteos_a/testsuites/unittest/container/smoke/ |
D | It_ipc_container_005.cpp | 57 …int shmid = shmget((key_t)SHM_TEST_KEY1, sizeof(struct shared_use_st), SHM_TEST_OPEN_PERM | IPC_CR… in childFunc() local 58 if (shmid == -1) { in childFunc() 62 void *shm = shmat(shmid, 0, 0); in childFunc() 64 shmctl(shmid, IPC_RMID, 0); in childFunc() 72 shmctl(shmid, IPC_RMID, 0); in childFunc() 78 shmctl(shmid, IPC_RMID, 0); in childFunc() 82 ret = shmctl(shmid, IPC_RMID, 0); in childFunc() 105 …int shmid = shmget((key_t)SHM_TEST_KEY1, sizeof(struct shared_use_st), SHM_TEST_OPEN_PERM | IPC_CR… in testChild() local 106 if (shmid == -1) { in testChild() 110 void *shm = shmat(shmid, 0, 0); in testChild() [all …]
|
D | It_ipc_container_004.cpp | 46 …int shmid = shmget((key_t)SHM_TEST_KEY1, sizeof(struct shared_use_st), SHM_TEST_OPEN_PERM | IPC_CR… in childFunc1() local 47 if (shmid == -1) { in childFunc1() 51 void *shm = shmat(shmid, 0, 0); in childFunc1() 53 shmctl(shmid, IPC_RMID, 0); in childFunc1() 60 shmctl(shmid, IPC_RMID, 0); in childFunc1() 65 shmctl(shmid, IPC_RMID, 0); in childFunc1() 84 …int shmid = shmget((key_t)SHM_TEST_KEY1, sizeof(struct shared_use_st), SHM_TEST_OPEN_PERM | IPC_CR… in childFunc() local 85 if (shmid == -1) { in childFunc() 89 void *shm = shmat(shmid, 0, 0); in childFunc() 91 shmctl(shmid, IPC_RMID, 0); in childFunc() [all …]
|
D | It_ipc_container_006.cpp | 46 …int shmid = shmget((key_t)SHM_TEST_KEY1, sizeof(struct shared_use_st), SHM_TEST_OPEN_PERM | IPC_CR… in childFunc1() local 47 if (shmid == -1) { in childFunc1() 51 void *shm = shmat(shmid, 0, 0); in childFunc1() 53 shmctl(shmid, IPC_RMID, 0); in childFunc1() 61 shmctl(shmid, IPC_RMID, 0); in childFunc1() 67 shmctl(shmid, IPC_RMID, 0); in childFunc1() 117 …int shmid = shmget((key_t)SHM_TEST_KEY1, sizeof(struct shared_use_st), SHM_TEST_OPEN_PERM | IPC_CR… in childFunc() local 118 if (shmid == -1) { in childFunc() 122 void *shm = shmat(shmid, 0, 0); in childFunc() 124 shmctl(shmid, IPC_RMID, 0); in childFunc() [all …]
|
/kernel/linux/linux-5.10/tools/testing/selftests/vm/ |
D | hugepage-shm.c | 57 int shmid; in main() local 61 shmid = shmget(2, LENGTH, SHM_HUGETLB | IPC_CREAT | SHM_R | SHM_W); in main() 62 if (shmid < 0) { in main() 66 printf("shmid: 0x%x\n", shmid); in main() 68 shmaddr = shmat(shmid, ADDR, SHMAT_FLAGS); in main() 71 shmctl(shmid, IPC_RMID, NULL); in main() 94 shmctl(shmid, IPC_RMID, NULL); in main() 98 shmctl(shmid, IPC_RMID, NULL); in main()
|
D | write_to_hugetlbfs.c | 32 static int shmid; variable 53 shmctl(shmid, IPC_RMID, NULL); in sig_handler() 57 shmctl(shmid, IPC_RMID, NULL); in sig_handler() 198 shmid = shmget(key, size, in main() 200 if (shmid < 0) { in main() 201 shmid = shmget(++key, size, in main() 203 if (shmid < 0) in main() 206 printf("shmid: 0x%x, shmget key:%d\n", shmid, key); in main() 208 ptr = shmat(shmid, NULL, 0); in main() 211 shmctl(shmid, IPC_RMID, NULL); in main()
|
/kernel/liteos_a/testsuites/unittest/process/basic/process/full/ |
D | process_test_042.cpp | 37 static void Child2(int shmid) in Child2() argument 40 int *shared = (int *)shmat(shmid, nullptr, 0); in Child2() 54 static void Child1(int shmid) in Child1() argument 57 int *shared = (int *)shmat(shmid, nullptr, 0); in Child1() 82 int shmid; in GroupProcess() local 96 shmid = shmget(static_cast<key_t>(1234), memSize, 0666 | IPC_CREAT); in GroupProcess() 97 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in GroupProcess() 102 Child1(shmid); in GroupProcess() 110 Child2(shmid); in GroupProcess() 115 shared = (int *)shmat(shmid, nullptr, 0); in GroupProcess()
|
D | process_test_062.cpp | 48 int shmid = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0600); // 0600 config of shmget in TestCase() local 49 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in TestCase() 51 g_shmptr = (int *)shmat(shmid, nullptr, 0); in TestCase() 99 shmctl(shmid, IPC_RMID, NULL); in TestCase() 104 shmctl(shmid, IPC_RMID, NULL); in TestCase()
|
D | process_test_052.cpp | 57 int shmid = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0600); // 0600 config of shmget in Testcase() local 58 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 60 g_shmptr = (int *)shmat(shmid, nullptr, 0); in Testcase() 84 shmctl(shmid, IPC_RMID, NULL); in Testcase()
|
D | process_test_050.cpp | 59 int shmid = shmget(IPC_PRIVATE, sizeof(int), IPC_CREAT | 0600); // 0600 config of shmget in Testcase() local 60 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 62 g_shmptr = (int *)shmat(shmid, nullptr, 0); in Testcase() 91 shmctl(shmid, IPC_RMID, NULL); in Testcase()
|
/kernel/liteos_a/testsuites/unittest/basic/mem/shm/smoke/ |
D | shm_test_011.cpp | 38 int shmid; in Testcase() local 42 shmid = shmget((key_t)IPC_PRIVATE, memSize, 0666 | IPC_CREAT); in Testcase() 43 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 47 shared = (int *)shmat(shmid, NULL, 0); in Testcase() 57 shared = (int *)shmat(shmid, NULL, 0); in Testcase() 69 ret = shmctl(shmid, IPC_RMID, NULL); in Testcase()
|
/kernel/liteos_a/testsuites/unittest/extended/signal/full/ |
D | It_ipc_pipe_002.cpp | 39 int shmid; in Testcase() local 43 …shmid = shmget(static_cast<key_t>(IPC_PRIVATE), sizeof(int), 0666 | IPC_CREAT); // 0666 the author… in Testcase() 44 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 45 sharedflag = (int *)shmat(shmid, NULL, 0); in Testcase() 51 sharedflag = (int *)shmat(shmid, NULL, 0); in Testcase()
|
D | pipe_test_005.cpp | 46 int shmid; in PipecommonWrite() local 59 …shmid = shmget(static_cast<key_t>(IPC_PRIVATE), sizeof(int), 0666 | IPC_CREAT); // 0666 the author… in PipecommonWrite() 60 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in PipecommonWrite() 61 sharedflag = (int *)shmat(shmid, NULL, 0); in PipecommonWrite() 69 sharedflag = (int *)shmat(shmid, NULL, 0); in PipecommonWrite()
|
D | It_ipc_pipe_003.cpp | 41 int shmid; in Testcase() local 45 …shmid = shmget(static_cast<key_t>(IPC_PRIVATE), sizeof(int), 0666 | IPC_CREAT); // 0666 the author… in Testcase() 46 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in Testcase() 47 sharedflag = (int *)shmat(shmid, NULL, 0); in Testcase() 53 sharedflag = (int *)shmat(shmid, NULL, 0); in Testcase()
|
/kernel/liteos_a/testsuites/unittest/process/plimits/smoke/ |
D | It_process_plimits_ipc_009.cpp | 50 int shmid; in ItProcessPlimitsIpc009() local 61 shmid = shmget(IPC_PRIVATE, PAGE_SIZE, acessMode | IPC_CREAT); in ItProcessPlimitsIpc009() 62 ASSERT_NE(shmid, -1); in ItProcessPlimitsIpc009() 63 shared = shmat(shmid, nullptr, 0); in ItProcessPlimitsIpc009() 67 ret = shmctl(shmid, IPC_RMID, nullptr); in ItProcessPlimitsIpc009()
|
/kernel/liteos_a/kernel/base/vm/ |
D | shm.c | 327 STATIC struct shmIDSource *ShmFindSeg(int shmid) in ShmFindSeg() argument 331 if ((shmid < 0) || (shmid >= IPC_SHM_INFO.shmmni)) { in ShmFindSeg() 336 seg = &IPC_SHM_SEGS[shmid]; in ShmFindSeg() 368 seg = ShmFindSeg(oldRegion->shmid); in OsShmFork() 375 newRegion->shmid = oldRegion->shmid; in OsShmFork() 387 seg = ShmFindSeg(region->shmid); in OsShmRegionFree() 472 INT32 shmid; in ShmGet() local 488 shmid = ret; in ShmGet() 494 ret = ShmPermCheck(ShmFindSeg(shmid), (UINT32)shmflg & ACCESSPERMS); in ShmGet() 499 ret = ShmSegValidCheck(shmid, size, shmflg); in ShmGet() [all …]
|
/kernel/liteos_a/testsuites/unittest/extended/signal/smoke/ |
D | pipe_test_002.cpp | 50 int shmid; in TestPipeMultiProcess() local 54 …shmid = shmget(static_cast<key_t>(IPC_PRIVATE), sizeof(int), 0666 | IPC_CREAT); // 0666 the author… in TestPipeMultiProcess() 55 ICUNIT_ASSERT_NOT_EQUAL(shmid, -1, shmid); in TestPipeMultiProcess() 56 sharedflag = (int *)shmat(shmid, NULL, 0); in TestPipeMultiProcess() 64 sharedflag = (int *)shmat(shmid, NULL, 0); in TestPipeMultiProcess()
|