зеркало из https://github.com/golang/sys.git
Address review comments
This commit is contained in:
Родитель
bf8c8bbe4a
Коммит
befbd7af6b
|
@ -2,23 +2,18 @@
|
|||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (darwin && amd64) || linux
|
||||
// +build darwin,amd64 linux
|
||||
//go:build (darwin && amd64) || (linux && !android)
|
||||
// +build darwin,amd64 linux,!android
|
||||
|
||||
package unix_test
|
||||
|
||||
import (
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func ExampleSysvShmGet() {
|
||||
// sysv shared memory isn't implemented on Android
|
||||
if runtime.GOOS == "android" {
|
||||
return
|
||||
}
|
||||
|
||||
// create shared memory region of 1024 bytes
|
||||
id, err := unix.SysvShmGet(unix.IPC_PRIVATE, 1024, unix.IPC_CREAT|unix.IPC_EXCL|0o600)
|
||||
|
|
|
@ -2318,6 +2318,7 @@ type RemoteIovec struct {
|
|||
|
||||
//sys PidfdOpen(pid int, flags int) (fd int, err error) = SYS_PIDFD_OPEN
|
||||
//sys PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) = SYS_PIDFD_GETFD
|
||||
|
||||
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
||||
//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error)
|
||||
//sys shmdt(addr uintptr) (err error)
|
||||
|
|
|
@ -47,7 +47,7 @@ func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) {
|
|||
//
|
||||
// It is not safe to use the slice after calling this function.
|
||||
func SysvShmDetach(data []byte) error {
|
||||
if data == nil {
|
||||
if len(data) == 0 {
|
||||
return EINVAL
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче