// GetSharedMem creates or retrieves the shared memory segment for an IPC key func GetSharedMem(key int64, size uint64, flags *SHMFlags) (*SharedMem, error) { rc, err := C.shmget(C.key_t(key), C.size_t(size), C.int(flags.flags())) if rc == -1 { return nil, err } return &SharedMem{int64(rc), uint(size)}, nil }
// GetMsgQueue creates or retrieves a message queue id for a given IPC key. func GetMsgQueue(key int64, flags *MQFlags) (MessageQueue, error) { rc, err := C.msgget(C.key_t(key), C.int(flags.flags())) if rc == -1 { return -1, err } return MessageQueue(rc), nil }
// GetSemSet creates or retrieves the semaphore set for a given IPC key. func GetSemSet(key, count int64, flags *SemSetFlags) (*SemaphoreSet, error) { rc, err := C.semget(C.key_t(key), C.int(count), C.int(flags.flags())) if rc == -1 { return nil, err } return &SemaphoreSet{int64(rc), uint(count)}, nil }
// msgget(2) // int msgget(key_t key, int msgflg); func msgget(key int, mode int) (int, error) { res, err := C.msgget(C.key_t(key), C.int(mode)) if err != nil { return -1, err } return int(res), nil }