Shmget implements shmget(2).
(t *kernel.Task, sysno uintptr, args arch.SyscallArguments)
| 25 | |
| 26 | // Shmget implements shmget(2). |
| 27 | func Shmget(t *kernel.Task, sysno uintptr, args arch.SyscallArguments) (uintptr, *kernel.SyscallControl, error) { |
| 28 | key := ipc.Key(args[0].Int()) |
| 29 | size := uint64(args[1].SizeT()) |
| 30 | flag := args[2].Int() |
| 31 | |
| 32 | private := key == linux.IPC_PRIVATE |
| 33 | create := flag&linux.IPC_CREAT == linux.IPC_CREAT |
| 34 | exclusive := flag&linux.IPC_EXCL == linux.IPC_EXCL |
| 35 | mode := linux.FileMode(flag & 0777) |
| 36 | |
| 37 | pid := int32(t.ThreadGroup().ID()) |
| 38 | r := t.IPCNamespace().ShmRegistry() |
| 39 | segment, err := r.FindOrCreate(t, pid, key, size, mode, private, create, exclusive) |
| 40 | if err != nil { |
| 41 | return 0, nil, err |
| 42 | } |
| 43 | defer segment.DecRef(t) |
| 44 | return uintptr(segment.ID()), nil, nil |
| 45 | } |
| 46 | |
| 47 | // findSegment retrieves a shm segment by the given id. |
| 48 | // |
nothing calls this directly
no test coverage detected
searching dependent graphs…