浏览代码

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 <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Alexander Neumann 9 年之前
父节点
当前提交
9eef40adf0
共有 3 个文件被更改,包括 20 次插入0 次删除
  1. 2 0
      unix/types_linux.go
  2. 9 0
      unix/ztypes_linux_386.go
  3. 9 0
      unix/ztypes_linux_amd64.go

+ 2 - 0
unix/types_linux.go

@@ -55,6 +55,8 @@ package unix
 #include <unistd.h>
 #include <ustat.h>
 #include <utime.h>
+#include <bluetooth/bluetooth.h>
+#include <bluetooth/hci.h>
 
 #ifdef TCSETS2
 // On systems that have "struct termios2" use this as type Termios.

+ 9 - 0
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

+ 9 - 0
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