System calls v0.1.0
The raw system-call entry points and the call numbers they take.
SysGetPid
pub const SysGetPid: uint64 = 20;
getpid(2)'s system-call number.
SysMmap
pub const SysMmap: uint64 = 477;
mmap(2)'s system-call number.
Syscall0
pub func Syscall0(number: uint64) -> int64
Executes a raw FreeBSD system call without arguments.
Parameters
| Name | Type | Description |
|---|---|---|
number | uint64 | the system call to make |
Returns: the kernel's raw result
Syscall6
pub func Syscall6(
number: uint64,
arg0: uint64,
arg1: uint64,
arg2: uint64,
arg3: uint64,
arg4: uint64,
arg5: uint64
) -> int64
Executes a raw FreeBSD system call with six arguments.
Parameters
| Name | Type | Description |
|---|---|---|
number | uint64 | the system call to make |
arg0 | uint64 | the call's first argument |
arg1 | uint64 | the call's second argument |
arg2 | uint64 | the call's third argument |
arg3 | uint64 | the call's fourth argument |
arg4 | uint64 | the call's fifth argument |
arg5 | uint64 | the call's sixth argument |
Returns: the kernel's raw result
SignExtendFd
pub func SignExtendFd(fd: int32) -> uint64
Widens a file descriptor to the register width a system call takes it in.
fd is read by value; the widened value is returned by copy. Sign extension is what matters: -1 has to arrive
as all ones rather than as a small positive number.
Cannot fail. Runs in constant time and allocates nothing.
Parameters
| Name | Type | Description |
|---|---|---|
fd | int32 | the descriptor to widen |
Returns: it sign-extended, so a negative one stays negative