diff options
author | Slack Coder <slackcoder@server.ky> | 2023-10-18 17:27:00 -0500 |
---|---|---|
committer | Slack Coder <slackcoder@server.ky> | 2023-10-18 17:27:00 -0500 |
commit | 2be3a82f3a801a84c98a4de9c818ce8b0497135b (patch) | |
tree | 9fb89a6b10fddbb1560d895215b445813d3ea28c /vendor/golang.org/x/sys/unix/sysvshm_unix.go | |
parent | 2fda2161877e61e16b7f208ba1f92f650776cbe2 (diff) | |
download | pkgtools-go-todo.tar.xz |
move todos to project roottodo
Diffstat (limited to 'vendor/golang.org/x/sys/unix/sysvshm_unix.go')
-rw-r--r-- | vendor/golang.org/x/sys/unix/sysvshm_unix.go | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/vendor/golang.org/x/sys/unix/sysvshm_unix.go b/vendor/golang.org/x/sys/unix/sysvshm_unix.go deleted file mode 100644 index 0bb4c8d..0000000 --- a/vendor/golang.org/x/sys/unix/sysvshm_unix.go +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2021 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build (darwin && !ios) || linux -// +build darwin,!ios linux - -package unix - -import ( - "unsafe" - - "golang.org/x/sys/internal/unsafeheader" -) - -// SysvShmAttach attaches the Sysv shared memory segment associated with the -// shared memory identifier id. -func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) { - addr, errno := shmat(id, addr, flag) - if errno != nil { - return nil, errno - } - - // Retrieve the size of the shared memory to enable slice creation - var info SysvShmDesc - - _, err := SysvShmCtl(id, IPC_STAT, &info) - if err != nil { - // release the shared memory if we can't find the size - - // ignoring error from shmdt as there's nothing sensible to return here - shmdt(addr) - return nil, err - } - - // Use unsafe to convert addr into a []byte. - // TODO: convert to unsafe.Slice once we can assume Go 1.17 - var b []byte - hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b)) - hdr.Data = unsafe.Pointer(addr) - hdr.Cap = int(info.Segsz) - hdr.Len = int(info.Segsz) - return b, nil -} - -// SysvShmDetach unmaps the shared memory slice returned from SysvShmAttach. -// -// It is not safe to use the slice after calling this function. -func SysvShmDetach(data []byte) error { - if len(data) == 0 { - return EINVAL - } - - return shmdt(uintptr(unsafe.Pointer(&data[0]))) -} - -// SysvShmGet returns the Sysv shared memory identifier associated with key. -// If the IPC_CREAT flag is specified a new segment is created. -func SysvShmGet(key, size, flag int) (id int, err error) { - return shmget(key, size, flag) -} |