Commit ee8db001 authored by Tobias Klauser's avatar Tobias Klauser Committed by Tobias Klauser

unix: add Fadvise on NetBSD

Change-Id: I7b32bbbfc73e8e05898bd640e9e92a183c72b92b
Reviewed-on: https://go-review.googlesource.com/101935
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarMatt Layher <mdlayher@gmail.com>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent bb729a57
...@@ -233,6 +233,7 @@ func Uname(uname *Utsname) error { ...@@ -233,6 +233,7 @@ func Uname(uname *Utsname) error {
//sys Dup(fd int) (nfd int, err error) //sys Dup(fd int) (nfd int, err error)
//sys Dup2(from int, to int) (err error) //sys Dup2(from int, to int) (err error)
//sys Exit(code int) //sys Exit(code int)
//sys Fadvise(fd int, offset int64, length int64, advice int) (err error) = SYS_POSIX_FADVISE
//sys Fchdir(fd int) (err error) //sys Fchdir(fd int) (err error)
//sys Fchflags(fd int, flags int) (err error) //sys Fchflags(fd int, flags int) (err error)
//sys Fchmod(fd int, mode uint32) (err error) //sys Fchmod(fd int, mode uint32) (err error)
...@@ -322,7 +323,6 @@ func Uname(uname *Utsname) error { ...@@ -322,7 +323,6 @@ func Uname(uname *Utsname) error {
// __msync13 // __msync13
// __ntp_gettime30 // __ntp_gettime30
// __posix_chown // __posix_chown
// __posix_fadvise50
// __posix_fchown // __posix_fchown
// __posix_lchown // __posix_lchown
// __posix_rename // __posix_rename
......
...@@ -118,6 +118,17 @@ const ( ...@@ -118,6 +118,17 @@ const (
PathMax = C.PATH_MAX PathMax = C.PATH_MAX
) )
// Advice to Fadvise
const (
FADV_NORMAL = C.POSIX_FADV_NORMAL
FADV_RANDOM = C.POSIX_FADV_RANDOM
FADV_SEQUENTIAL = C.POSIX_FADV_SEQUENTIAL
FADV_WILLNEED = C.POSIX_FADV_WILLNEED
FADV_DONTNEED = C.POSIX_FADV_DONTNEED
FADV_NOREUSE = C.POSIX_FADV_NOREUSE
)
// Sockets // Sockets
type RawSockaddrInet4 C.struct_sockaddr_in type RawSockaddrInet4 C.struct_sockaddr_in
......
...@@ -571,6 +571,16 @@ func Exit(code int) { ...@@ -571,6 +571,16 @@ func Exit(code int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall9(SYS_POSIX_FADVISE, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), 0, uintptr(length), uintptr(length>>32), uintptr(advice), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchdir(fd int) (err error) { func Fchdir(fd int) (err error) {
_, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -571,6 +571,16 @@ func Exit(code int) { ...@@ -571,6 +571,16 @@ func Exit(code int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall6(SYS_POSIX_FADVISE, uintptr(fd), 0, uintptr(offset), 0, uintptr(length), uintptr(advice))
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchdir(fd int) (err error) { func Fchdir(fd int) (err error) {
_, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -571,6 +571,16 @@ func Exit(code int) { ...@@ -571,6 +571,16 @@ func Exit(code int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, offset int64, length int64, advice int) (err error) {
_, _, e1 := Syscall9(SYS_POSIX_FADVISE, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), 0, uintptr(length), uintptr(length>>32), uintptr(advice), 0)
if e1 != 0 {
err = errnoErr(e1)
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fchdir(fd int) (err error) { func Fchdir(fd int) (err error) {
_, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0) _, _, e1 := Syscall(SYS_FCHDIR, uintptr(fd), 0, 0)
if e1 != 0 { if e1 != 0 {
......
...@@ -103,6 +103,15 @@ const ( ...@@ -103,6 +103,15 @@ const (
PathMax = 0x400 PathMax = 0x400
) )
const (
FADV_NORMAL = 0x0
FADV_RANDOM = 0x1
FADV_SEQUENTIAL = 0x2
FADV_WILLNEED = 0x3
FADV_DONTNEED = 0x4
FADV_NOREUSE = 0x5
)
type RawSockaddrInet4 struct { type RawSockaddrInet4 struct {
Len uint8 Len uint8
Family uint8 Family uint8
......
...@@ -107,6 +107,15 @@ const ( ...@@ -107,6 +107,15 @@ const (
PathMax = 0x400 PathMax = 0x400
) )
const (
FADV_NORMAL = 0x0
FADV_RANDOM = 0x1
FADV_SEQUENTIAL = 0x2
FADV_WILLNEED = 0x3
FADV_DONTNEED = 0x4
FADV_NOREUSE = 0x5
)
type RawSockaddrInet4 struct { type RawSockaddrInet4 struct {
Len uint8 Len uint8
Family uint8 Family uint8
......
...@@ -108,6 +108,15 @@ const ( ...@@ -108,6 +108,15 @@ const (
PathMax = 0x400 PathMax = 0x400
) )
const (
FADV_NORMAL = 0x0
FADV_RANDOM = 0x1
FADV_SEQUENTIAL = 0x2
FADV_WILLNEED = 0x3
FADV_DONTNEED = 0x4
FADV_NOREUSE = 0x5
)
type RawSockaddrInet4 struct { type RawSockaddrInet4 struct {
Len uint8 Len uint8
Family uint8 Family uint8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment