-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable compiler on NetBSD, DragonFly, illumos and Solaris (#2343)
- Loading branch information
Showing
10 changed files
with
52 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
//go:build (linux || darwin) && !tinygo | ||
|
||
package platform | ||
|
||
import "syscall" | ||
|
||
// MprotectRX is like syscall.Mprotect with RX permission. | ||
func MprotectRX(b []byte) (err error) { | ||
return syscall.Mprotect(b, syscall.PROT_READ|syscall.PROT_EXEC) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//go:build solaris && !tinygo | ||
|
||
package platform | ||
|
||
import "syscall" | ||
|
||
func MprotectRX(b []byte) error { | ||
return syscall.ENOTSUP | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters