提交 6318cc7a 编写于 作者: S Shengliang Guan

remove shm

上级 c1a87795
...@@ -33,11 +33,13 @@ static void taosDeleteCreatedShms() { ...@@ -33,11 +33,13 @@ static void taosDeleteCreatedShms() {
int32_t taosCreateShm(SShm* pShm, int32_t key, int32_t shmsize) { int32_t taosCreateShm(SShm* pShm, int32_t key, int32_t shmsize) {
pShm->id = -1; pShm->id = -1;
#if 1
key_t __shkey = IPC_PRIVATE; key_t __shkey = IPC_PRIVATE;
int32_t __shmflag = IPC_CREAT | IPC_EXCL | 0600; int32_t __shmflag = IPC_CREAT | IPC_EXCL | 0600;
#else
// key_t __shkey = 0X95270000 + key; key_t __shkey = 0X95270000 + key;
// int32_t __shmflag = IPC_CREAT | 0600; int32_t __shmflag = IPC_CREAT | 0600;
#endif
int32_t shmid = shmget(__shkey, shmsize, __shmflag); int32_t shmid = shmget(__shkey, shmsize, __shmflag);
if (shmid < 0) { if (shmid < 0) {
...@@ -53,10 +55,14 @@ int32_t taosCreateShm(SShm* pShm, int32_t key, int32_t shmsize) { ...@@ -53,10 +55,14 @@ int32_t taosCreateShm(SShm* pShm, int32_t key, int32_t shmsize) {
pShm->size = shmsize; pShm->size = shmsize;
pShm->ptr = shmptr; pShm->ptr = shmptr;
#if 0
if (key >= 0 && key < MAX_SHMIDS) { if (key >= 0 && key < MAX_SHMIDS) {
shmids[key] = pShm->id + 1; shmids[key] = pShm->id + 1;
} }
atexit(taosDeleteCreatedShms); atexit(taosDeleteCreatedShms);
#else
shmctl(pShm->id, IPC_RMID, NULL);
#endif
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册