diff options
author | 2024-11-26 16:25:48 +0000 | |
---|---|---|
committer | 2024-11-26 16:25:48 +0000 | |
commit | 61f8f1e0e3236993f5522215f1900d35e49680c0 (patch) | |
tree | b8bec737013b8213996a40ab913a810833ac5e4e /vendor/github.com/tetratelabs/wazero/internal/platform/mprotect_bsd.go | |
parent | [bugfix] Allow unsetting filter expiration dates (#3560) (diff) | |
download | gotosocial-61f8f1e0e3236993f5522215f1900d35e49680c0.tar.xz |
pull in ncruces/go-sqlite3 v0.20.3 with tetratelabs/wazero v1.8.2 (#3574)
Diffstat (limited to 'vendor/github.com/tetratelabs/wazero/internal/platform/mprotect_bsd.go')
-rw-r--r-- | vendor/github.com/tetratelabs/wazero/internal/platform/mprotect_bsd.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/github.com/tetratelabs/wazero/internal/platform/mprotect_bsd.go b/vendor/github.com/tetratelabs/wazero/internal/platform/mprotect_bsd.go new file mode 100644 index 000000000..f8f40cabe --- /dev/null +++ b/vendor/github.com/tetratelabs/wazero/internal/platform/mprotect_bsd.go @@ -0,0 +1,22 @@ +//go:build (freebsd || netbsd || dragonfly) && !tinygo + +package platform + +import ( + "syscall" + "unsafe" +) + +// MprotectRX is like syscall.Mprotect with RX permission, defined locally so that BSD compiles. +func MprotectRX(b []byte) (err error) { + var _p0 unsafe.Pointer + if len(b) > 0 { + _p0 = unsafe.Pointer(&b[0]) + } + const prot = syscall.PROT_READ | syscall.PROT_EXEC + _, _, e1 := syscall.Syscall(syscall.SYS_MPROTECT, uintptr(_p0), uintptr(len(b)), uintptr(prot)) + if e1 != 0 { + err = syscall.Errno(e1) + } + return +} |