-
Notifications
You must be signed in to change notification settings - Fork 3
/
shm.go
38 lines (30 loc) · 933 Bytes
/
shm.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2020 Meng Huang ([email protected])
// This package is licensed under a MIT license that can be found in the LICENSE file.
package ipc
import (
"github.com/hslam/shm"
)
// Shmget calls the shmget system call.
func Shmget(key int, size int, shmFlg int) (int, error) {
return shm.Get(key, size, shmFlg)
}
// Shmat calls the shmat system call.
func Shmat(shmid int, shmFlg int) (uintptr, error) {
return shm.At(shmid, shmFlg)
}
// Shmdt calls the shmdt system call.
func Shmdt(addr uintptr) error {
return shm.Dt(addr)
}
// Shmgetattach calls the shmget and shmat system call.
func Shmgetattach(key int, size int, shmFlg int) (int, []byte, error) {
return shm.GetAttach(key, size, shmFlg)
}
// Shmdetach calls the shmdt system call with []byte b.
func Shmdetach(b []byte) error {
return shm.Detach(b)
}
// Shmrm removes the shm with the given id.
func Shmrm(shmid int) error {
return shm.Remove(shmid)
}