tg_syscall/
lib.rs

1#![no_std]
2#![deny(warnings)]
3
4#[cfg(all(feature = "kernel", feature = "user"))]
5compile_error!("You can only use one of `supervisor` or `user` features at a time");
6
7mod io;
8mod time;
9
10include!(concat!(env!("OUT_DIR"), "/syscalls.rs"));
11
12pub use io::*;
13pub use tg_signal_defs::{SignalAction, SignalNo, MAX_SIG};
14pub use time::*;
15
16#[cfg(feature = "user")]
17mod user;
18
19#[cfg(feature = "user")]
20pub use user::*;
21
22#[cfg(feature = "kernel")]
23mod kernel;
24
25#[cfg(feature = "kernel")]
26pub use kernel::*;
27
28/// 系统调用号。
29///
30/// 实现为包装类型,在不损失扩展性的情况下实现类型安全性。
31#[derive(PartialEq, Eq, Clone, Copy, Debug)]
32#[repr(transparent)]
33pub struct SyscallId(pub usize);
34
35impl From<usize> for SyscallId {
36    #[inline]
37    fn from(val: usize) -> Self {
38        Self(val)
39    }
40}