Comments (4)
didn't try before. Are you interested in giving a PR?
from sonic.
Well it is a very simple change as the syscalls for the BSDs should match those for Darwin (based on BSD anyways) & Linux so something like this should be more than enough:
diff --git a/loader/mmap_unix.go b/loader/mmap_unix.go
index 3ea944e..1d15e54 100644
--- a/loader/mmap_unix.go
+++ b/loader/mmap_unix.go
@@ -1,5 +1,5 @@
-//go:build darwin || linux
-// +build darwin linux
+//go:build !windows
+// +build !windows
/**
* Copyright 2023 ByteDance Inc.
Unless you have reasons for being explict in this case.
from sonic.
I didn't submit a PR, as it's a one line change and that the formatting of the file doesn't follow the standard gofmt
standard so the whole flie would end up being needlessly modified.
diff --git a/loader/mmap_unix.go b/loader/mmap_unix.go
index 3ea944e..1d15e54 100644
--- a/loader/mmap_unix.go
+++ b/loader/mmap_unix.go
@@ -1,5 +1,5 @@
-//go:build darwin || linux
-// +build darwin linux
+//go:build !windows
+// +build !windows
/**
* Copyright 2023 ByteDance Inc.
@@ -20,26 +20,25 @@
package loader
import (
- `syscall`
+ "syscall"
)
const (
- _AP = syscall.MAP_ANON | syscall.MAP_PRIVATE
- _RX = syscall.PROT_READ | syscall.PROT_EXEC
- _RW = syscall.PROT_READ | syscall.PROT_WRITE
+ _AP = syscall.MAP_ANON | syscall.MAP_PRIVATE
+ _RX = syscall.PROT_READ | syscall.PROT_EXEC
+ _RW = syscall.PROT_READ | syscall.PROT_WRITE
)
-
func mmap(nb int) uintptr {
- if m, _, e := syscall.RawSyscall6(syscall.SYS_MMAP, 0, uintptr(nb), _RW, _AP, 0, 0); e != 0 {
- panic(e)
- } else {
- return m
- }
+ if m, _, e := syscall.RawSyscall6(syscall.SYS_MMAP, 0, uintptr(nb), _RW, _AP, 0, 0); e != 0 {
+ panic(e)
+ } else {
+ return m
+ }
}
func mprotect(p uintptr, nb int) {
- if _, _, err := syscall.RawSyscall(syscall.SYS_MPROTECT, p, uintptr(nb), _RX); err != 0 {
- panic(err)
- }
+ if _, _, err := syscall.RawSyscall(syscall.SYS_MPROTECT, p, uintptr(nb), _RX); err != 0 {
+ panic(err)
+ }
}
from sonic.
ok,I will submit it
from sonic.
Related Issues (20)
- How to make the unmarshaling process of json int array faster? HOT 1
- Execute file size is too big, can sonic be optimized when compile? HOT 9
- Add API documents to readme file
- Parse UTF8 characters failed HOT 1
- Any solution for parse sql.NullString field failed? HOT 2
- Panic: &rt.GoString{Ptr:(unsafe.Pointer)(0xc003f6d650), Len:100} has nil pointer while its length is not zero! HOT 1
- Is there a more elegant implementation of re-serialization after partial modification of the contents of ast.Node? HOT 9
- go1.22.0 build error
- WARNING: sonic only supports Go1.16~1.20 && CPU amd64, but your environment is not suitable HOT 2
- go 1.22.0 build error HOT 1
- Depress WARNING: sonic only supports Go1.16~1.22 && CPU amd64, but your environment is not suitable on Apple Chip Macs HOT 4
- bug: `unset()` misbehavior on v1.11.0-x
- can not compile at linux/amd64 and go 1.22 HOT 1
- [ast] invalid memory address or nil pointer dereference HOT 3
- Support golang v1.22 HOT 1
- 使用go的docker镜像编译时cgo报错 HOT 1
- optimize: extra string/[]byte copies when calling Unmarshal HOT 1
- frozenconfig.Unmarshal consumes a large amount of memory. HOT 3
- can sonic support fuzzy decode like jsonitor HOT 3
- 使用sync.Pool管理buf的时候,高QPS可能会导致类似内存占用过大 HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sonic.