arch |
|
|
c.rs |
Adapt the Linux API to resemble a POSIX-style libc API.
The linux_raw backend doesn't use actual libc; this just defines certain
types that are convenient to have defined. |
16122 |
conv.rs |
Convert values to [`ArgReg`] and from [`RetReg`].
System call arguments and return values are all communicated with inline
asm and FFI as `*mut Opaque`. To protect these raw pointers from escaping
or being accidentally misused as they travel through the code, we wrap them
in [`ArgReg`] and [`RetReg`] structs. This file provides `From`
implementations and explicit conversion functions for converting values
into and out of these wrapper structs.
# Safety
Some of this code is `unsafe` in order to work with raw file descriptors,
and some is `unsafe` to interpret the values in a `RetReg`. |
29523 |
event |
|
|
fs |
|
|
io |
|
|
io_uring |
|
|
mm |
|
|
mod.rs |
The linux_raw backend.
This makes Linux syscalls directly, without going through libc.
# Safety
These files performs raw system calls, and sometimes passes them
uninitialized memory buffers. The signatures in this file are currently
manually maintained and must correspond with the signatures of the actual
Linux syscalls.
Some of this could be auto-generated from the Linux header file
<linux/syscalls.h>, but we often need more information than it provides,
such as which pointers are array slices, out parameters, or in-out
parameters, which integers are owned or borrowed file descriptors, etc. |
3291 |
mount |
|
|
net |
|
|
param |
|
|
pid |
|
|
pipe |
|
|
prctl |
|
|
process |
|
|
pty |
|
|
rand |
|
|
reg.rs |
Encapsulation for system call arguments and return values.
The inline-asm code paths do some amount of reordering of arguments; to
ensure that we don't accidentally misroute an argument or return value, we
use distinct types for each argument index and return value.
# Safety
The `ToAsm` and `FromAsm` traits are unsafe to use; they should only be
used by the syscall code which executes actual syscall machine
instructions. |
7176 |
runtime |
|
|
shm |
|
|
system |
|
|
termios |
|
|
thread |
|
|
time |
|
|
ugid |
|
|
vdso.rs |
Parse the Linux vDSO.
The following code is transliterated from
tools/testing/selftests/vDSO/parse_vdso.c in Linux 5.11, which is licensed
with Creative Commons Zero License, version 1.0,
available at <https://creativecommons.org/publicdomain/zero/1.0/legalcode>
# Safety
Parsing the vDSO involves a lot of raw pointer manipulation. This
implementation follows Linux's reference implementation, and adds several
additional safety checks. |
11218 |
vdso_wrappers.rs |
Implement syscalls using the vDSO.
<https://man7.org/linux/man-pages/man7/vdso.7.html>
# Safety
Similar to syscalls.rs, this file performs raw system calls, and sometimes
passes them uninitialized memory buffers. This file also calls vDSO
functions. |
20165 |