From 3ac3ea1d6afea0b128112e6a46b8bf47b4b0e02a Mon Sep 17 00:00:00 2001 From: Jamie Liu Date: Tue, 8 May 2018 11:25:40 -0700 Subject: Correct definition of SysV IPC structures. PiperOrigin-RevId: 195849066 Change-Id: If2146c7ce649522f86e661c5e52a9983345d6967 --- pkg/abi/linux/ipc.go | 34 ++++++++++++++++++++-------------- pkg/abi/linux/sem.go | 20 +++++++++----------- 2 files changed, 29 insertions(+), 25 deletions(-) (limited to 'pkg/abi') diff --git a/pkg/abi/linux/ipc.go b/pkg/abi/linux/ipc.go index 5441492e7..81e9904dd 100644 --- a/pkg/abi/linux/ipc.go +++ b/pkg/abi/linux/ipc.go @@ -14,7 +14,8 @@ package linux -// Control commands used with semctl. Source: //include/uapi/linux/ipc.h. +// Control commands used with semctl, shmctl, and msgctl. Source: +// include/uapi/linux/ipc.h. const ( IPC_RMID = 0 IPC_SET = 1 @@ -22,7 +23,7 @@ const ( IPC_INFO = 3 ) -// resource get request flags. Source: //include/uapi/linux/ipc.h +// resource get request flags. Source: include/uapi/linux/ipc.h const ( IPC_CREAT = 00001000 IPC_EXCL = 00002000 @@ -31,17 +32,22 @@ const ( const IPC_PRIVATE = 0 -// IPCPerm is equivalent to struct ipc_perm. +// In Linux, amd64 does not enable CONFIG_ARCH_WANT_IPC_PARSE_VERSION, so SysV +// IPC unconditionally uses the "new" 64-bit structures that are needed for +// features like 32-bit UIDs. + +// IPCPerm is equivalent to struct ipc64_perm. type IPCPerm struct { - Key uint32 - UID uint32 - GID uint32 - CUID uint32 - CGID uint32 - Mode uint16 - pad1 uint16 - Seq uint16 - pad2 uint16 - reserved1 uint32 - reserved2 uint32 + Key uint32 + UID uint32 + GID uint32 + CUID uint32 + CGID uint32 + Mode uint16 + pad1 uint16 + Seq uint16 + pad2 uint16 + pad3 uint32 + unused1 uint64 + unused2 uint64 } diff --git a/pkg/abi/linux/sem.go b/pkg/abi/linux/sem.go index f8d8debf1..3495f5cd0 100644 --- a/pkg/abi/linux/sem.go +++ b/pkg/abi/linux/sem.go @@ -14,7 +14,7 @@ package linux -// semctl Command Definitions. Source: //include/uapi/linux/sem.h +// semctl Command Definitions. Source: include/uapi/linux/sem.h const ( GETPID = 11 GETVAL = 12 @@ -25,7 +25,7 @@ const ( SETALL = 17 ) -// ipcs ctl cmds. Source: //include/uapi/linux/sem.h +// ipcs ctl cmds. Source: include/uapi/linux/sem.h const ( SEM_STAT = 18 SEM_INFO = 19 @@ -33,16 +33,14 @@ const ( const SEM_UNDO = 0x1000 -// SemidDS is equivalent to struct semid_ds. +// SemidDS is equivalent to struct semid64_ds. type SemidDS struct { - SemPerm IPCPerm - SemOTime TimeT - reserved1 uint32 - SemCTime TimeT - reserved2 uint32 - SemNSems uint32 - reserved3 uint32 - reserved4 uint32 + SemPerm IPCPerm + SemOTime TimeT + SemCTime TimeT + SemNSems uint64 + unused3 uint64 + unused4 uint64 } // Sembuf is equivalent to struct sembuf. -- cgit v1.2.3