From c28acc882ebcbfbe8ce9f0f14b9ac26ee138dd51 Mon Sep 17 00:00:00 2001 From: Christian Pellegrin Date: Sun, 11 Mar 2018 13:24:03 +0000 Subject: [PATCH] unix: fix seek while compiling with gccgo under arm and 386 Fixes golang/go#23361 Change-Id: Ia4fb99b1ac2b109048a1b81f9b1534685f6e31a8 Reviewed-on: https://go-review.googlesource.com/100076 Run-TryBot: Tobias Klauser TryBot-Result: Gobot Gobot Reviewed-by: Tobias Klauser --- unix/syscall_linux_gccgo.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 unix/syscall_linux_gccgo.go diff --git a/unix/syscall_linux_gccgo.go b/unix/syscall_linux_gccgo.go new file mode 100644 index 00000000..df9c1237 --- /dev/null +++ b/unix/syscall_linux_gccgo.go @@ -0,0 +1,21 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build linux +// +build gccgo +// +build 386 arm + +package unix + +import ( + "syscall" + "unsafe" +) + +func seek(fd int, offset int64, whence int) (newoffset int64, err syscall.Errno) { + offsetLow := uint32(offset & 0xffffffff) + offsetHigh := uint32((offset >> 32) & 0xffffffff) + _, _, err = Syscall6(SYS__LLSEEK, uintptr(fd), uintptr(offsetHigh), uintptr(offsetLow), uintptr(unsafe.Pointer(&newoffset)), uintptr(whence), 0) + return newoffset, err +}