Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Src/Syscall.rux
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ module Linux {
const SYS_MUNMAP: uint64 = 11u64;
const SYS_BRK: uint64 = 12u64;
const SYS_GETPID: uint64 = 39u64;
const SYS_NANOSLEEP: uint64 = 35u64;
const SYS_EXIT: uint64 = 60u64;
const SYS_TIME: uint64 = 201u64;
const SYS_CLOCK_GETTIME: uint64 = 228u64;

// mmap protection and mapping flags used by Mmap.
const PROT_READ: int32 = 1i32;
Expand Down Expand Up @@ -111,4 +114,23 @@ module Linux {
func Errno(result: int64) -> int64 {
return IsError(result) ? -result : 0i64;
}

struct timespec {
tv_sec: int64;
tv_nsec: int64;
}

@[Import(lib: "rux-linux")]
extern {
func __rux_linux_nanosleep(req: *timespec, rem: *timespec) -> int64;
func __rux_linux_clock_gettime(clk_id: int32, tp: *timespec) -> int64;
}

func Nanosleep(req: *timespec, rem: *timespec) -> int64 {
return __rux_linux_nanosleep(req, rem);
}

func ClockGettime(clk_id: int32, tp: *timespec) -> int64 {
return __rux_linux_clock_gettime(clk_id, tp);
}
}