arceos_posix_api/
lib.rs

1//! POSIX-compatible APIs for [ArceOS] modules
2//!
3//! [ArceOS]: https://github.com/arceos-org/arceos
4
5#![cfg_attr(all(not(test), not(doc)), no_std)]
6#![feature(doc_cfg)]
7#![feature(doc_auto_cfg)]
8#![allow(clippy::missing_safety_doc)]
9
10#[macro_use]
11extern crate axlog;
12extern crate axruntime;
13
14#[cfg(feature = "alloc")]
15extern crate alloc;
16
17#[macro_use]
18mod utils;
19
20mod imp;
21
22/// Platform-specific constants and parameters.
23pub mod config {
24    pub use axconfig::*;
25}
26
27/// POSIX C types.
28#[rustfmt::skip]
29#[path = "./ctypes_gen.rs"]
30#[allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals, clippy::upper_case_acronyms, missing_docs)]
31pub mod ctypes;
32
33pub use imp::io::{sys_read, sys_write, sys_writev};
34pub use imp::resources::{sys_getrlimit, sys_setrlimit};
35pub use imp::sys::sys_sysconf;
36pub use imp::task::{sys_exit, sys_getpid, sys_sched_yield};
37pub use imp::time::{sys_clock_gettime, sys_nanosleep};
38
39#[cfg(feature = "fd")]
40pub use imp::fd_ops::{sys_close, sys_dup, sys_dup2, sys_fcntl};
41#[cfg(feature = "fs")]
42pub use imp::fs::{sys_fstat, sys_getcwd, sys_lseek, sys_lstat, sys_open, sys_rename, sys_stat};
43#[cfg(feature = "select")]
44pub use imp::io_mpx::sys_select;
45#[cfg(feature = "epoll")]
46pub use imp::io_mpx::{sys_epoll_create, sys_epoll_ctl, sys_epoll_wait};
47#[cfg(feature = "net")]
48pub use imp::net::{
49    sys_accept, sys_bind, sys_connect, sys_freeaddrinfo, sys_getaddrinfo, sys_getpeername,
50    sys_getsockname, sys_listen, sys_recv, sys_recvfrom, sys_send, sys_sendto, sys_shutdown,
51    sys_socket,
52};
53#[cfg(feature = "pipe")]
54pub use imp::pipe::sys_pipe;
55#[cfg(feature = "multitask")]
56pub use imp::pthread::mutex::{
57    sys_pthread_mutex_init, sys_pthread_mutex_lock, sys_pthread_mutex_unlock,
58};
59#[cfg(feature = "multitask")]
60pub use imp::pthread::{sys_pthread_create, sys_pthread_exit, sys_pthread_join, sys_pthread_self};