From 6318cc7a1a95881141e472e2bcdd1e558c292a22 Mon Sep 17 00:00:00 2001 From: Shengliang Guan Date: Thu, 7 Apr 2022 13:53:19 +0800 Subject: [PATCH] remove shm --- source/os/src/osShm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/source/os/src/osShm.c b/source/os/src/osShm.c index 3b75e33d7c..b276b48d0e 100644 --- a/source/os/src/osShm.c +++ b/source/os/src/osShm.c @@ -33,11 +33,13 @@ static void taosDeleteCreatedShms() { int32_t taosCreateShm(SShm* pShm, int32_t key, int32_t shmsize) { pShm->id = -1; +#if 1 key_t __shkey = IPC_PRIVATE; int32_t __shmflag = IPC_CREAT | IPC_EXCL | 0600; - - // key_t __shkey = 0X95270000 + key; - // int32_t __shmflag = IPC_CREAT | 0600; +#else + key_t __shkey = 0X95270000 + key; + int32_t __shmflag = IPC_CREAT | 0600; +#endif int32_t shmid = shmget(__shkey, shmsize, __shmflag); if (shmid < 0) { @@ -53,10 +55,14 @@ int32_t taosCreateShm(SShm* pShm, int32_t key, int32_t shmsize) { pShm->size = shmsize; pShm->ptr = shmptr; +#if 0 if (key >= 0 && key < MAX_SHMIDS) { shmids[key] = pShm->id + 1; } atexit(taosDeleteCreatedShms); +#else + shmctl(pShm->id, IPC_RMID, NULL); +#endif return 0; }