Skip to content

Commit 7c6badc

Browse files
committed
unix: convert openbsd/mips64 to direct libc calls
The current code has continued to work on OpenBSD, since it has been using syscall(2) via libc. However, the system call numbers are still hardcoded in golang.org/x/sys/unix. Various system call changes have been made in OpenBSD, resulting in changes to the system call numbers and arguments, which now fail when this package is used. Switch to calling various system calls directly via libc, rather than calling via libc using syscall(2). Unfortunately, this will no longer work on upstream Go since the changes needed to convert it to libc are still blocked pending review. This means that we're in a less than ideal situation where upstream Go openbsd/mips64 does not work on any supported OpenBSD release (in fact has not since OpenBSD 6.8, which was EOL over a year ago), however golang.org/x/sys/unix is now unusable with the Go package that ships with supported releases via OpenBSD ports. It would seem that being able to actually use Go software on a supported OpenBSD release trumps maintaining compatibility with the unusable upstream Go source. Updates golang/go#36435 Change-Id: Id8947cd0e4e05709e96c3d4478ac8789b924d416 Reviewed-on: https://go-review.googlesource.com/c/sys/+/459497 Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Tobias Klauser <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 3b1fc93 commit 7c6badc

File tree

5 files changed

+1342
-140
lines changed

5 files changed

+1342
-140
lines changed

unix/mkall.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ openbsd_arm64)
174174
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
175175
;;
176176
openbsd_mips64)
177+
mkasm="go run mkasm.go"
177178
mkerrors="$mkerrors -m64"
178-
mksyscall="go run mksyscall.go -openbsd"
179+
mksyscall="go run mksyscall.go -openbsd -libc"
179180
mksysctl="go run mksysctl_openbsd.go"
180-
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
181181
# Let the type of C char be signed for making the bare syscall
182182
# API consistent across platforms.
183183
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"

unix/syscall_openbsd_libc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build openbsd && !mips64
6-
// +build openbsd,!mips64
5+
//go:build openbsd
6+
// +build openbsd
77

88
package unix
99

0 commit comments

Comments
 (0)