syscall.Getpagesize(): add test, implement for Linux and Windows

This commit is contained in:
Dan Kegel
2022-06-10 17:20:54 -07:00
committed by Ayke
parent caf405b01d
commit 8754f64f3b
10 changed files with 77 additions and 8 deletions
-8
View File
@@ -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
+8
View File
@@ -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
}
+5
View File
@@ -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
+6
View File
@@ -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
}