From 4e03e87547853523d4ff941935a6ef1712518c61 Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Tue, 12 Jan 2021 12:36:17 -0800 Subject: Fix simple mistakes identified by goreportcard. These are primarily simplification and lint mistakes. However, minor fixes are also included and tests added where appropriate. PiperOrigin-RevId: 351425971 --- pkg/abi/linux/fadvise.go | 1 + pkg/abi/linux/ipc.go | 14 ++++++++++---- pkg/abi/linux/netfilter_ipv6.go | 1 + pkg/abi/linux/sched.go | 1 + pkg/abi/linux/seccomp.go | 2 ++ pkg/abi/linux/sem.go | 5 ++++- 6 files changed, 19 insertions(+), 5 deletions(-) (limited to 'pkg/abi/linux') diff --git a/pkg/abi/linux/fadvise.go b/pkg/abi/linux/fadvise.go index b06ff9964..97e2e4532 100644 --- a/pkg/abi/linux/fadvise.go +++ b/pkg/abi/linux/fadvise.go @@ -14,6 +14,7 @@ package linux +// Fadvise constants. const ( POSIX_FADV_NORMAL = 0 POSIX_FADV_RANDOM = 1 diff --git a/pkg/abi/linux/ipc.go b/pkg/abi/linux/ipc.go index c6e65df62..f84144355 100644 --- a/pkg/abi/linux/ipc.go +++ b/pkg/abi/linux/ipc.go @@ -14,8 +14,9 @@ package linux -// Control commands used with semctl, shmctl, and msgctl. 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 @@ -23,14 +24,19 @@ 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 IPC_NOWAIT = 00004000 ) -const IPC_PRIVATE = 0 +// IPC flags. +const ( + IPC_PRIVATE = 0 +) // 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 diff --git a/pkg/abi/linux/netfilter_ipv6.go b/pkg/abi/linux/netfilter_ipv6.go index 6d31eb5e3..bcb57642e 100644 --- a/pkg/abi/linux/netfilter_ipv6.go +++ b/pkg/abi/linux/netfilter_ipv6.go @@ -288,6 +288,7 @@ type IP6TIP struct { _ [3]byte } +// SizeOfIP6TIP is the size of an IP6 header. const SizeOfIP6TIP = 136 // Flags in IP6TIP.Flags. Corresponding constants are in diff --git a/pkg/abi/linux/sched.go b/pkg/abi/linux/sched.go index 70e820823..2a67921e6 100644 --- a/pkg/abi/linux/sched.go +++ b/pkg/abi/linux/sched.go @@ -29,6 +29,7 @@ const ( SCHED_RESET_ON_FORK = 0x40000000 ) +// Scheduling priority group selectors. const ( PRIO_PGRP = 0x1 PRIO_PROCESS = 0x0 diff --git a/pkg/abi/linux/seccomp.go b/pkg/abi/linux/seccomp.go index 5be3f10f9..e64501fac 100644 --- a/pkg/abi/linux/seccomp.go +++ b/pkg/abi/linux/seccomp.go @@ -30,8 +30,10 @@ const ( SECCOMP_GET_ACTION_AVAIL = 2 ) +// BPFAction is an action for a BPF filter. type BPFAction uint32 +// BPFAction definitions. const ( SECCOMP_RET_KILL_PROCESS BPFAction = 0x80000000 SECCOMP_RET_KILL_THREAD BPFAction = 0x00000000 diff --git a/pkg/abi/linux/sem.go b/pkg/abi/linux/sem.go index 2424884c1..bc7b4f0ee 100644 --- a/pkg/abi/linux/sem.go +++ b/pkg/abi/linux/sem.go @@ -49,7 +49,10 @@ const ( SEMUSZ = 20 ) -const SEM_UNDO = 0x1000 +// Semaphore flags. +const ( + SEM_UNDO = 0x1000 +) // Sembuf is equivalent to struct sembuf. // -- cgit v1.2.3