2023-08-21 17:26:44 +03:00
|
|
|
#![no_std]
|
2023-12-10 20:54:15 +02:00
|
|
|
#![feature(
|
|
|
|
maybe_uninit_slice,
|
|
|
|
step_trait,
|
|
|
|
const_trait_impl,
|
|
|
|
effects,
|
|
|
|
slice_ptr_get,
|
2023-12-10 23:01:39 +02:00
|
|
|
strict_provenance,
|
|
|
|
never_type,
|
2023-12-18 17:04:01 +02:00
|
|
|
let_chains,
|
2024-01-04 21:22:18 +02:00
|
|
|
allocator_api,
|
|
|
|
maybe_uninit_uninit_array,
|
2024-01-15 18:15:59 +02:00
|
|
|
const_maybe_uninit_uninit_array,
|
2024-01-25 12:12:07 +02:00
|
|
|
new_uninit,
|
2024-02-09 14:20:13 +02:00
|
|
|
inline_const,
|
|
|
|
trait_alias
|
2023-12-10 20:54:15 +02:00
|
|
|
)]
|
2023-12-10 18:52:33 +02:00
|
|
|
|
2024-01-25 13:10:01 +02:00
|
|
|
use core::time::Duration;
|
|
|
|
|
|
|
|
use yggdrasil_abi::{error::Error, process::Signal};
|
2023-12-10 23:22:21 +02:00
|
|
|
|
2023-12-10 18:52:33 +02:00
|
|
|
extern crate alloc;
|
2023-08-21 17:26:44 +03:00
|
|
|
|
2023-11-30 11:00:51 +02:00
|
|
|
pub(crate) mod api;
|
|
|
|
|
2024-02-08 13:11:29 +02:00
|
|
|
pub mod device;
|
2023-12-10 23:01:39 +02:00
|
|
|
pub mod runtime;
|
2023-08-21 17:26:44 +03:00
|
|
|
pub mod sync;
|
2023-12-10 23:01:39 +02:00
|
|
|
pub mod thread;
|
2023-09-06 18:48:00 +03:00
|
|
|
|
2023-12-11 21:13:33 +02:00
|
|
|
#[inline]
|
|
|
|
pub fn cpu_index() -> usize {
|
|
|
|
unsafe { api::__cpu_index() }
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn cpu_count() -> usize {
|
|
|
|
unsafe { api::__cpu_count() }
|
|
|
|
}
|
|
|
|
|
2024-01-04 21:22:18 +02:00
|
|
|
#[inline]
|
|
|
|
pub fn signal_process_group(group_id: u32, signal: Signal) {
|
|
|
|
unsafe { api::__signal_process_group(group_id, signal) }
|
|
|
|
}
|
|
|
|
|
2023-09-06 18:48:00 +03:00
|
|
|
#[repr(C)]
|
|
|
|
pub struct AlignedTo<Align, Bytes: ?Sized> {
|
|
|
|
pub align: [Align; 0],
|
|
|
|
pub bytes: Bytes,
|
|
|
|
}
|
2024-01-25 13:10:01 +02:00
|
|
|
|
|
|
|
#[inline]
|
|
|
|
pub fn monotonic_timestamp() -> Result<Duration, Error> {
|
|
|
|
unsafe { api::__monotonic_timestamp() }
|
|
|
|
}
|