diff --git a/unix/example_sysvshm_test.go b/unix/example_sysvshm_test.go new file mode 100644 index 00000000..537f7701 --- /dev/null +++ b/unix/example_sysvshm_test.go @@ -0,0 +1,52 @@ +// 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 && amd64) || (linux && !android) +// +build darwin,amd64 linux,!android + +package unix_test + +import ( + "log" + + "golang.org/x/sys/unix" +) + +func ExampleSysvShmGet() { + + // create shared memory region of 1024 bytes + id, err := unix.SysvShmGet(unix.IPC_PRIVATE, 1024, unix.IPC_CREAT|unix.IPC_EXCL|0o600) + if err != nil { + log.Fatal("sysv shm create failed:", err) + } + + // warning: sysv shared memory segments persist even after after a process + // is destroyed, so it's very important to explicitly delete it when you + // don't need it anymore. + defer func() { + _, err := unix.SysvShmCtl(id, unix.IPC_RMID, nil) + if err != nil { + log.Fatal(err) + } + }() + + // to use a shared memory region you must attach to it + b, err := unix.SysvShmAttach(id, 0, 0) + if err != nil { + log.Fatal("sysv attach failed:", err) + } + + // you should detach from the segment when finished with it. The byte + // slice is no longer valid after detaching + defer func() { + if err = unix.SysvShmDetach(b); err != nil { + log.Fatal("sysv detach failed:", err) + } + }() + + // Changes to the contents of the byte slice are reflected in other + // mappings of the shared memory identifer in this and other processes + b[42] = 'h' + b[43] = 'i' +} diff --git a/unix/linux/types.go b/unix/linux/types.go index 515e3b66..faea3d22 100644 --- a/unix/linux/types.go +++ b/unix/linux/types.go @@ -106,6 +106,7 @@ struct termios2 { #include #include #include +#include #include #include #include @@ -128,6 +129,7 @@ struct termios2 { #include #include #include +#include #include #include #include @@ -3835,3 +3837,28 @@ const ( const ( PIDFD_NONBLOCK = C.O_NONBLOCK ) + +// shm + +type SysvIpcPerm C.struct_ipc64_perm +type SysvShmDesc C.struct_shmid64_ds + +const ( + IPC_CREAT = C.IPC_CREAT + IPC_EXCL = C.IPC_EXCL + IPC_NOWAIT = C.IPC_NOWAIT + IPC_PRIVATE = C.IPC_PRIVATE + + ipc_64 = C.IPC_64 +) + +const ( + IPC_RMID = C.IPC_RMID + IPC_SET = C.IPC_SET + IPC_STAT = C.IPC_STAT +) + +const ( + SHM_RDONLY = C.SHM_RDONLY + SHM_RND = C.SHM_RND +) diff --git a/unix/syscall_darwin.go b/unix/syscall_darwin.go index 23f6b576..d59fb95c 100644 --- a/unix/syscall_darwin.go +++ b/unix/syscall_darwin.go @@ -433,6 +433,11 @@ func SysctlKinfoProcSlice(name string) ([]KinfoProc, error) { //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) +//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) +//sys shmget(key int, size int, flag int) (id int, err error) + /* * Exposed directly */ @@ -590,10 +595,6 @@ func SysctlKinfoProcSlice(name string) ([]KinfoProc, error) { // Msgget // Msgsnd // Msgrcv -// Shmat -// Shmctl -// Shmdt -// Shmget // Shm_open // Shm_unlink // Sem_open diff --git a/unix/syscall_linux.go b/unix/syscall_linux.go index e253a912..fff38a84 100644 --- a/unix/syscall_linux.go +++ b/unix/syscall_linux.go @@ -2319,6 +2319,11 @@ 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) +//sys shmget(key int, size int, flag int) (id int, err error) + /* * Unimplemented */ @@ -2400,10 +2405,6 @@ type RemoteIovec struct { // SetRobustList // SetThreadArea // SetTidAddress -// Shmat -// Shmctl -// Shmdt -// Shmget // Sigaltstack // Swapoff // Swapon diff --git a/unix/sysvshm_linux.go b/unix/sysvshm_linux.go new file mode 100644 index 00000000..b9476c64 --- /dev/null +++ b/unix/sysvshm_linux.go @@ -0,0 +1,20 @@ +// 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 linux +// +build linux + +package unix + +import "runtime" + +// SysvShmCtl performs control operations on the shared memory segment +// specified by id. +func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { + if runtime.GOARCH == "arm" { + cmd |= ipc_64 + } + + return shmctl(id, cmd, desc) +} diff --git a/unix/sysvshm_unix.go b/unix/sysvshm_unix.go new file mode 100644 index 00000000..7d6ba360 --- /dev/null +++ b/unix/sysvshm_unix.go @@ -0,0 +1,61 @@ +// 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 && amd64) || linux +// +build darwin,amd64 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) +} diff --git a/unix/sysvshm_unix_other.go b/unix/sysvshm_unix_other.go new file mode 100644 index 00000000..579b53bf --- /dev/null +++ b/unix/sysvshm_unix_other.go @@ -0,0 +1,14 @@ +// 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 && amd64) +// +build darwin,amd64 + +package unix + +// SysvShmCtl performs control operations on the shared memory segment +// specified by id. +func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) { + return shmctl(id, cmd, desc) +} diff --git a/unix/sysvshm_unix_test.go b/unix/sysvshm_unix_test.go new file mode 100644 index 00000000..61c7b8d6 --- /dev/null +++ b/unix/sysvshm_unix_test.go @@ -0,0 +1,74 @@ +// 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 && amd64) || linux +// +build darwin,amd64 linux + +package unix_test + +import ( + "runtime" + "testing" + + "golang.org/x/sys/unix" +) + +func TestSysvSharedMemory(t *testing.T) { + // create ipc + id, err := unix.SysvShmGet(unix.IPC_PRIVATE, 1024, unix.IPC_CREAT|unix.IPC_EXCL|0o600) + + // ipc isn't implemented on android, should fail + if runtime.GOOS == "android" { + if err != unix.ENOSYS { + t.Fatalf("expected android to fail, but it didn't") + } + return + } + + if err != nil { + t.Fatalf("SysvShmGet: %v", err) + } + defer func() { + _, err := unix.SysvShmCtl(id, unix.IPC_RMID, nil) + if err != nil { + t.Errorf("Remove failed: %v", err) + } + }() + + // attach + b1, err := unix.SysvShmAttach(id, 0, 0) + if err != nil { + t.Fatalf("Attach: %v", err) + } + + if len(b1) != 1024 { + t.Fatalf("b1 len = %v, want 1024", len(b1)) + } + + b1[42] = 'x' + + // attach again + b2, err := unix.SysvShmAttach(id, 0, 0) + if err != nil { + t.Fatalf("Attach: %v", err) + } + + if len(b2) != 1024 { + t.Fatalf("b2 len = %v, want 1024", len(b1)) + } + + b2[43] = 'y' + if b2[42] != 'x' || b1[43] != 'y' { + t.Fatalf("shared memory isn't shared") + } + + // detach + if err = unix.SysvShmDetach(b2); err != nil { + t.Fatalf("Detach: %v", err) + } + + if b1[42] != 'x' || b1[43] != 'y' { + t.Fatalf("shared memory was invalidated") + } +} diff --git a/unix/types_darwin.go b/unix/types_darwin.go index 0b13f935..3cbd0dab 100644 --- a/unix/types_darwin.go +++ b/unix/types_darwin.go @@ -27,6 +27,7 @@ package unix #include #include #include +#include #include #include #include @@ -34,6 +35,7 @@ package unix #include #include #include +#include #include #include #include @@ -323,3 +325,26 @@ type Vmspace C.struct_vmspace type Pcred C.struct__pcred type Ucred C.struct__ucred + +// shm + +type SysvIpcPerm C.struct_ipc_perm +type SysvShmDesc C.struct_shmid_ds + +const ( + IPC_CREAT = C.IPC_CREAT + IPC_EXCL = C.IPC_EXCL + IPC_NOWAIT = C.IPC_NOWAIT + IPC_PRIVATE = C.IPC_PRIVATE +) + +const ( + IPC_RMID = C.IPC_RMID + IPC_SET = C.IPC_SET + IPC_STAT = C.IPC_STAT +) + +const ( + SHM_RDONLY = C.SHM_RDONLY + SHM_RND = C.SHM_RND +) diff --git a/unix/zerrors_linux.go b/unix/zerrors_linux.go index b959fe19..78d4b85e 100644 --- a/unix/zerrors_linux.go +++ b/unix/zerrors_linux.go @@ -1397,6 +1397,8 @@ const ( MADV_NOHUGEPAGE = 0xf MADV_NORMAL = 0x0 MADV_PAGEOUT = 0x15 + MADV_POPULATE_READ = 0x16 + MADV_POPULATE_WRITE = 0x17 MADV_RANDOM = 0x1 MADV_REMOVE = 0x9 MADV_SEQUENTIAL = 0x2 diff --git a/unix/zsyscall_darwin_amd64.go b/unix/zsyscall_darwin_amd64.go index d4efe8d4..0ae0ed4c 100644 --- a/unix/zsyscall_darwin_amd64.go +++ b/unix/zsyscall_darwin_amd64.go @@ -734,6 +734,65 @@ var libc_sendfile_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := syscall_syscall(libc_shmat_trampoline_addr, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmat_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmat shmat "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := syscall_syscall(libc_shmctl_trampoline_addr, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmctl_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmctl shmctl "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := syscall_syscall(libc_shmdt_trampoline_addr, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmdt_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmdt shmdt "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := syscall_syscall(libc_shmget_trampoline_addr, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_shmget_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_shmget shmget "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func Access(path string, mode uint32) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) diff --git a/unix/zsyscall_darwin_amd64.s b/unix/zsyscall_darwin_amd64.s index bc169c2a..eac6ca80 100644 --- a/unix/zsyscall_darwin_amd64.s +++ b/unix/zsyscall_darwin_amd64.s @@ -264,6 +264,30 @@ TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB) +TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmat(SB) + +GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB) + +TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmctl(SB) + +GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB) + +TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmdt(SB) + +GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB) + +TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_shmget(SB) + +GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8 +DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB) + TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_access(SB) diff --git a/unix/zsyscall_linux.go b/unix/zsyscall_linux.go index 701f7eb8..4f5da1f5 100644 --- a/unix/zsyscall_linux.go +++ b/unix/zsyscall_linux.go @@ -1974,3 +1974,46 @@ func PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) { } return } + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) { + r0, _, e1 := Syscall(SYS_SHMAT, uintptr(id), uintptr(addr), uintptr(flag)) + ret = uintptr(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) { + r0, _, e1 := Syscall(SYS_SHMCTL, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf))) + result = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmdt(addr uintptr) (err error) { + _, _, e1 := Syscall(SYS_SHMDT, uintptr(addr), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func shmget(key int, size int, flag int) (id int, err error) { + r0, _, e1 := Syscall(SYS_SHMGET, uintptr(key), uintptr(size), uintptr(flag)) + id = int(r0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} diff --git a/unix/ztypes_darwin_amd64.go b/unix/ztypes_darwin_amd64.go index 4c8dc0ba..71db8538 100644 --- a/unix/ztypes_darwin_amd64.go +++ b/unix/ztypes_darwin_amd64.go @@ -639,3 +639,39 @@ type Ucred struct { Ngroups int16 Groups [16]uint32 } + +type SysvIpcPerm struct { + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ uint16 + _ int32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Lpid int32 + Cpid int32 + Nattch uint16 + _ [34]byte +} + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/unix/ztypes_linux.go b/unix/ztypes_linux.go index 06dcd787..249ecfcd 100644 --- a/unix/ztypes_linux.go +++ b/unix/ztypes_linux.go @@ -3936,3 +3936,23 @@ type LandlockPathBeneathAttr struct { const ( LANDLOCK_RULE_PATH_BENEATH = 0x1 ) + +const ( + IPC_CREAT = 0x200 + IPC_EXCL = 0x400 + IPC_NOWAIT = 0x800 + IPC_PRIVATE = 0x0 + + ipc_64 = 0x100 +) + +const ( + IPC_RMID = 0x0 + IPC_SET = 0x1 + IPC_STAT = 0x2 +) + +const ( + SHM_RDONLY = 0x1000 + SHM_RND = 0x2000 +) diff --git a/unix/ztypes_linux_386.go b/unix/ztypes_linux_386.go index 3219aded..eeeb9aa3 100644 --- a/unix/ztypes_linux_386.go +++ b/unix/ztypes_linux_386.go @@ -639,3 +639,32 @@ const ( const ( PIDFD_NONBLOCK = 0x800 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ [2]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Atime_high uint32 + Dtime uint32 + Dtime_high uint32 + Ctime uint32 + Ctime_high uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 +} diff --git a/unix/ztypes_linux_amd64.go b/unix/ztypes_linux_amd64.go index 16acd3bc..d30e1155 100644 --- a/unix/ztypes_linux_amd64.go +++ b/unix/ztypes_linux_amd64.go @@ -657,3 +657,29 @@ const ( const ( PIDFD_NONBLOCK = 0x800 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/unix/ztypes_linux_arm.go b/unix/ztypes_linux_arm.go index c4982a22..69d02975 100644 --- a/unix/ztypes_linux_arm.go +++ b/unix/ztypes_linux_arm.go @@ -634,3 +634,32 @@ const ( const ( PIDFD_NONBLOCK = 0x800 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint16 + _ [2]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Atime_high uint32 + Dtime uint32 + Dtime_high uint32 + Ctime uint32 + Ctime_high uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 +} diff --git a/unix/ztypes_linux_arm64.go b/unix/ztypes_linux_arm64.go index 98bb8a41..28a0455b 100644 --- a/unix/ztypes_linux_arm64.go +++ b/unix/ztypes_linux_arm64.go @@ -636,3 +636,29 @@ const ( const ( PIDFD_NONBLOCK = 0x800 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/unix/ztypes_linux_mips.go b/unix/ztypes_linux_mips.go index d5bfc356..64a84548 100644 --- a/unix/ztypes_linux_mips.go +++ b/unix/ztypes_linux_mips.go @@ -640,3 +640,31 @@ const ( const ( PIDFD_NONBLOCK = 0x80 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Dtime uint32 + Ctime uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + Atime_high uint16 + Dtime_high uint16 + Ctime_high uint16 + _ uint16 +} diff --git a/unix/ztypes_linux_mips64.go b/unix/ztypes_linux_mips64.go index b52c568d..a1b7dee4 100644 --- a/unix/ztypes_linux_mips64.go +++ b/unix/ztypes_linux_mips64.go @@ -639,3 +639,29 @@ const ( const ( PIDFD_NONBLOCK = 0x80 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/unix/ztypes_linux_mips64le.go b/unix/ztypes_linux_mips64le.go index a340b84b..936fa6a2 100644 --- a/unix/ztypes_linux_mips64le.go +++ b/unix/ztypes_linux_mips64le.go @@ -639,3 +639,29 @@ const ( const ( PIDFD_NONBLOCK = 0x80 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/unix/ztypes_linux_mipsle.go b/unix/ztypes_linux_mipsle.go index b43d8e2c..5dd546fb 100644 --- a/unix/ztypes_linux_mipsle.go +++ b/unix/ztypes_linux_mipsle.go @@ -640,3 +640,31 @@ const ( const ( PIDFD_NONBLOCK = 0x80 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint32 + _ uint32 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint32 + Atime uint32 + Dtime uint32 + Ctime uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + Atime_high uint16 + Dtime_high uint16 + Ctime_high uint16 + _ uint16 +} diff --git a/unix/ztypes_linux_ppc.go b/unix/ztypes_linux_ppc.go index efd7313a..947b32e4 100644 --- a/unix/ztypes_linux_ppc.go +++ b/unix/ztypes_linux_ppc.go @@ -646,3 +646,33 @@ const ( const ( PIDFD_NONBLOCK = 0x800 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime_high uint32 + Atime uint32 + Dtime_high uint32 + Dtime uint32 + Ctime_high uint32 + Ctime uint32 + _ uint32 + Segsz uint32 + Cpid int32 + Lpid int32 + Nattch uint32 + _ uint32 + _ uint32 + _ [4]byte +} diff --git a/unix/ztypes_linux_ppc64.go b/unix/ztypes_linux_ppc64.go index 22cedda5..2a606151 100644 --- a/unix/ztypes_linux_ppc64.go +++ b/unix/ztypes_linux_ppc64.go @@ -646,3 +646,28 @@ const ( const ( PIDFD_NONBLOCK = 0x800 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/unix/ztypes_linux_ppc64le.go b/unix/ztypes_linux_ppc64le.go index 452a76df..d0d735d0 100644 --- a/unix/ztypes_linux_ppc64le.go +++ b/unix/ztypes_linux_ppc64le.go @@ -646,3 +646,28 @@ const ( const ( PIDFD_NONBLOCK = 0x800 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + Seq uint32 + _ uint32 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/unix/ztypes_linux_riscv64.go b/unix/ztypes_linux_riscv64.go index 96c667df..95e3d6d0 100644 --- a/unix/ztypes_linux_riscv64.go +++ b/unix/ztypes_linux_riscv64.go @@ -664,3 +664,29 @@ const ( const ( PIDFD_NONBLOCK = 0x800 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ [0]uint8 + Seq uint16 + _ uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/unix/ztypes_linux_s390x.go b/unix/ztypes_linux_s390x.go index af04ee17..cccf1ef2 100644 --- a/unix/ztypes_linux_s390x.go +++ b/unix/ztypes_linux_s390x.go @@ -660,3 +660,28 @@ const ( const ( PIDFD_NONBLOCK = 0x800 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ uint16 + Seq uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Segsz uint64 + Atime int64 + Dtime int64 + Ctime int64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +} diff --git a/unix/ztypes_linux_sparc64.go b/unix/ztypes_linux_sparc64.go index 6f385cf6..44fcbe4e 100644 --- a/unix/ztypes_linux_sparc64.go +++ b/unix/ztypes_linux_sparc64.go @@ -641,3 +641,28 @@ const ( const ( PIDFD_NONBLOCK = 0x4000 ) + +type SysvIpcPerm struct { + Key int32 + Uid uint32 + Gid uint32 + Cuid uint32 + Cgid uint32 + Mode uint32 + _ uint16 + Seq uint16 + _ uint64 + _ uint64 +} +type SysvShmDesc struct { + Perm SysvIpcPerm + Atime int64 + Dtime int64 + Ctime int64 + Segsz uint64 + Cpid int32 + Lpid int32 + Nattch uint64 + _ uint64 + _ uint64 +}