unix: Added posix_fadvise support for Linux and FreeBSD

Support includes 386, amd64, and arm for both Linux and FreeBSD.
FreeBSD changes courtesy Dave Chapeskie <dchapeskie@gmail.com>

Change-Id: I89dc18533d7178e74ae6c442a2e6272c9bd9692c
Reviewed-on: https://go-review.googlesource.com/8055
Reviewed-by: Rob Pike <r@golang.org>
This commit is contained in:
Eric
2015-03-27 16:47:22 +00:00
committed by Rob Pike
parent 71c96e4240
commit ea745763b1
12 changed files with 103 additions and 1 deletions
+17
View File
@@ -411,6 +411,16 @@ func Faccessat(dirfd int, path string, mode uint32, flags int) (err error) {
// 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_FADVISE64, uintptr(fd), 0, uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice), 0, 0)
if e1 != 0 {
err = e1
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fallocate(fd int, mode uint32, off int64, len int64) (err error) {
_, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32))
if e1 != 0 {
@@ -1872,6 +1882,13 @@ func Truncate(path string, length int64) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Fadvise(fd int, advice int64, offset int64, length int) {
Syscall9(SYS_FADVISE64, uintptr(fd), 0, uintptr(advice), uintptr(advice>>32), uintptr(offset), uintptr(offset>>32), uintptr(length), 0, 0)
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Ftruncate(fd int, length int64) (err error) {
_, _, e1 := Syscall6(SYS_FTRUNCATE64, uintptr(fd), 0, uintptr(length), uintptr(length>>32), 0, 0)
if e1 != 0 {