From f6738bc22f2c4065f1681d8a5f06bcaf21ff5c46 Mon Sep 17 00:00:00 2001 From: chenshijun <chenshijun@aiotlink.com> Date: 星期五, 03 四月 2020 13:20:03 +0800 Subject: [PATCH] shmdata 的shmData转内存slice的capacity修改成实际shmdata的长度减去预留32字节记录Len的字段 --- shmwrap.go | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/shmwrap.go b/shmwrap.go index e855c8e..8dad1d7 100644 --- a/shmwrap.go +++ b/shmwrap.go @@ -211,4 +211,15 @@ } return int(idDs.Nattch), nil +} + +func GetKeyById(shmId int) (int,error) { + var idDs shm.IdDs + + _, err := shm.Ctl(shmId, shm.IPC_STAT, &idDs) + if err != nil { + return 0, err + } + + return int(idDs.Perm.Key), nil } \ No newline at end of file -- Gitblit v1.8.0