43 lines
682 B
43 lines
682 B
//! For POSIX and system calls
|
|
|
|
use super::*;
|
|
|
|
use cfg_if::cfg_if;
|
|
|
|
pub mod user;
|
|
|
|
pub mod pipe;
|
|
pub mod fork;
|
|
|
|
pub mod errno;
|
|
use errno::ResultExt;
|
|
|
|
/// Get pid of current process
|
|
#[inline] pub fn get_pid() -> i32
|
|
{
|
|
unsafe{libc::getpid()}
|
|
}
|
|
|
|
/// Start the async runtime manually
|
|
pub fn new_runtime() -> Result<tokio::runtime::Runtime, tokio::io::Error>
|
|
{
|
|
use tokio::runtime::Builder;
|
|
|
|
|
|
cfg_if! {
|
|
if #[cfg(feature="threaded")] {
|
|
Builder::new()
|
|
.enable_all()
|
|
.threaded_scheduler()
|
|
.thread_name("sys invoked runtime")
|
|
.build()
|
|
} else {
|
|
Builder::new()
|
|
.enable_all()
|
|
.basic_scheduler()
|
|
.thread_name("sys invoked runtime")
|
|
.build()
|
|
}
|
|
}
|
|
}
|