Browse Source

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 <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Christian Pellegrin 7 years ago
parent
commit
c28acc882e
1 changed files with 21 additions and 0 deletions
  1. 21 0
      unix/syscall_linux_gccgo.go

+ 21 - 0
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
+}