From 9eef40adf05b951699605195b829612bd7b69952 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sat, 9 Apr 2016 12:42:01 +0200 Subject: [PATCH] unix: Add FADV_* constants These constants are used for fadvise() on Linux and were missing from the ztypes_linux_*.go files. Including the bluetooth headers is necessary so that cgo can resolve struct sockaddr_hci. Fixes golang/go#15114 Change-Id: I1538b5a7b9b24f910c0520d446b2fa5bd8a09013 Reviewed-on: https://go-review.googlesource.com/21753 Reviewed-by: Brad Fitzpatrick Run-TryBot: Brad Fitzpatrick TryBot-Result: Gobot Gobot --- unix/types_linux.go | 2 ++ unix/ztypes_linux_386.go | 9 +++++++++ unix/ztypes_linux_amd64.go | 9 +++++++++ 3 files changed, 20 insertions(+) diff --git a/unix/types_linux.go b/unix/types_linux.go index 9a8d2b6f..abc5e5d7 100644 --- a/unix/types_linux.go +++ b/unix/types_linux.go @@ -55,6 +55,8 @@ package unix #include #include #include +#include +#include #ifdef TCSETS2 // On systems that have "struct termios2" use this as type Termios. diff --git a/unix/ztypes_linux_386.go b/unix/ztypes_linux_386.go index 72c7f091..fb1257ae 100644 --- a/unix/ztypes_linux_386.go +++ b/unix/ztypes_linux_386.go @@ -151,6 +151,15 @@ type Flock_t struct { Pid int32 } +const ( + FADV_NORMAL = 0x0 + FADV_RANDOM = 0x1 + FADV_SEQUENTIAL = 0x2 + FADV_WILLNEED = 0x3 + FADV_DONTNEED = 0x4 + FADV_NOREUSE = 0x5 +) + type RawSockaddrInet4 struct { Family uint16 Port uint16 diff --git a/unix/ztypes_linux_amd64.go b/unix/ztypes_linux_amd64.go index 70a443f4..34edb368 100644 --- a/unix/ztypes_linux_amd64.go +++ b/unix/ztypes_linux_amd64.go @@ -153,6 +153,15 @@ type Flock_t struct { Pad_cgo_1 [4]byte } +const ( + FADV_NORMAL = 0x0 + FADV_RANDOM = 0x1 + FADV_SEQUENTIAL = 0x2 + FADV_WILLNEED = 0x3 + FADV_DONTNEED = 0x4 + FADV_NOREUSE = 0x5 +) + type RawSockaddrInet4 struct { Family uint16 Port uint16