Skip to content

Commit

Permalink
unix: convert openbsd/arm to direct libc calls
Browse files Browse the repository at this point in the history
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).

Updates golang/go#36435

Change-Id: If8e403f0fda7a8b68da71c1f4efba7785b14edf5
Reviewed-on: https://go-review.googlesource.com/c/sys/+/421800
Run-TryBot: Ian Lance Taylor <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
Run-TryBot: Joel Sing <[email protected]>
Reviewed-by: Tobias Klauser <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
4a6f656c committed Aug 17, 2022
1 parent fbc7d0a commit 5a39038
Show file tree
Hide file tree
Showing 5 changed files with 1,464 additions and 139 deletions.
4 changes: 2 additions & 2 deletions unix/mkall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,10 @@ openbsd_amd64)
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
openbsd_arm)
mkasm="go run mkasm.go"
mkerrors="$mkerrors"
mksyscall="go run mksyscall.go -l32 -openbsd -arm"
mksyscall="go run mksyscall.go -l32 -openbsd -arm -libc"
mksysctl="go run mksysctl_openbsd.go"
mksysnum="go run mksysnum.go 'https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/sys/kern/syscalls.master'"
# Let the type of C char be signed for making the bare syscall
# API consistent across platforms.
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
Expand Down
4 changes: 2 additions & 2 deletions unix/syscall_openbsd_libc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

//go:build (openbsd && 386) || (openbsd && amd64) || (openbsd && arm64)
// +build openbsd,386 openbsd,amd64 openbsd,arm64
//go:build (openbsd && 386) || (openbsd && amd64) || (openbsd && arm) || (openbsd && arm64)
// +build openbsd,386 openbsd,amd64 openbsd,arm openbsd,arm64

package unix

Expand Down
Loading

0 comments on commit 5a39038

Please sign in to comment.