Skip to main content

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