mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-28 04:46:44 -04:00
unix: use libc stubs for OpenBSD pledge+unveil
Future OpenBSD releases will remove the syscall(2) interface. This converts the Pledge and Unveil calls to use pledge(2) and unveil(2) from libc, rather than indirectly through syscall(2). Updates golang/go#63900. Change-Id: I61e22d8f52f16c8f5e4c0717acae0d5bf4271503 GitHub-Last-Rev: ebc0461460297de6d4f677a48d3a361d7e620df0 GitHub-Pull-Request: golang/sys#146 Reviewed-on: https://go-review.googlesource.com/c/sys/+/468095 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mauri de Souza Meneguzzo <mauri870@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com> Run-TryBot: Joel Sing <joel@sing.id.au> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Aaron Bieber <aaron@bolddaemon.com> Reviewed-by: Bryan Mills <bcmills@google.com>
This commit is contained in:
@@ -2228,3 +2228,33 @@ func utimensat(dirfd int, path string, times *[2]Timespec, flags int) (err error
|
||||
var libc_utimensat_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_utimensat utimensat "libc.so"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func pledge(promises *byte, execpromises *byte) (err error) {
|
||||
_, _, e1 := syscall_syscall(libc_pledge_trampoline_addr, uintptr(unsafe.Pointer(promises)), uintptr(unsafe.Pointer(execpromises)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_pledge_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_pledge pledge "libc.so"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func unveil(path *byte, flags *byte) (err error) {
|
||||
_, _, e1 := syscall_syscall(libc_unveil_trampoline_addr, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(flags)), 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_unveil_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_unveil unveil "libc.so"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user