mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 11:07:46 +00:00
syscall.Getpagesize(): add test, implement for Linux and Windows
This commit is contained in:
@@ -251,10 +251,6 @@ func Mprotect(b []byte, prot int) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func Getpagesize() int {
|
||||
return int(libc_getpagesize())
|
||||
}
|
||||
|
||||
func Environ() []string {
|
||||
|
||||
// This function combines all the environment into a single allocation.
|
||||
@@ -372,10 +368,6 @@ func libc_munmap(addr unsafe.Pointer, length uintptr) int32
|
||||
//export mprotect
|
||||
func libc_mprotect(addr unsafe.Pointer, len uintptr, prot int32) int32
|
||||
|
||||
// int getpagesize();
|
||||
//export getpagesize
|
||||
func libc_getpagesize() int32
|
||||
|
||||
// int chdir(const char *pathname, mode_t mode);
|
||||
//export chdir
|
||||
func libc_chdir(pathname *byte) int32
|
||||
|
||||
@@ -267,6 +267,14 @@ func readdir_r(dir uintptr, entry *Dirent, result **Dirent) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func Getpagesize() int {
|
||||
return int(libc_getpagesize())
|
||||
}
|
||||
|
||||
// int pipe(int32 *fds);
|
||||
//export pipe
|
||||
func libc_pipe(fds *int32) int32
|
||||
|
||||
// int getpagesize();
|
||||
//export getpagesize
|
||||
func libc_getpagesize() int32
|
||||
|
||||
@@ -67,3 +67,7 @@ func getErrno() error {
|
||||
func Pipe2(p []int, flags int) (err error) {
|
||||
return ENOSYS // TODO
|
||||
}
|
||||
|
||||
func Getpagesize() int {
|
||||
return 4096 // TODO
|
||||
}
|
||||
|
||||
@@ -296,6 +296,11 @@ func Pipe2(p []int, flags int) (err error) {
|
||||
return ENOSYS // TODO
|
||||
}
|
||||
|
||||
func Getpagesize() int {
|
||||
// per upstream
|
||||
return 65536
|
||||
}
|
||||
|
||||
// int stat(const char *path, struct stat * buf);
|
||||
//export stat
|
||||
func libc_stat(pathname *byte, ptr unsafe.Pointer) int32
|
||||
|
||||
@@ -205,3 +205,9 @@ type Timeval struct {
|
||||
Sec int64
|
||||
Usec int64
|
||||
}
|
||||
|
||||
func Getpagesize() int {
|
||||
// There is no right value to return here, but 4096 is a
|
||||
// common assumption when pagesize is unknown
|
||||
return 4096
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user