Implemented structs
This commit is contained in:
@ -22,8 +22,8 @@ munmap(address Pointer, length Int) -> Int {
|
||||
return syscall(11, address, length)
|
||||
}
|
||||
|
||||
nanosleep(timespec Pointer) -> Int {
|
||||
return syscall(35, timespec, 0)
|
||||
nanosleep(duration Pointer) -> Int {
|
||||
return syscall(35, duration, 0)
|
||||
}
|
||||
|
||||
clone(flags Int, stack Pointer) -> Int {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import mem
|
||||
import sys
|
||||
|
||||
sleep(nanoseconds Int) {
|
||||
@ -8,10 +7,9 @@ sleep(nanoseconds Int) {
|
||||
seconds, nanoseconds = nanoseconds / 1000000000
|
||||
}
|
||||
|
||||
timespec := mem.alloc(16)
|
||||
store(timespec, 8, seconds)
|
||||
offset := timespec + 8
|
||||
store(offset, 8, nanoseconds)
|
||||
sys.nanosleep(timespec)
|
||||
mem.free(timespec, 16)
|
||||
duration := new(timespec)
|
||||
duration.seconds = seconds
|
||||
duration.nanoseconds = nanoseconds
|
||||
sys.nanosleep(duration)
|
||||
delete(duration)
|
||||
}
|
Reference in New Issue
Block a user