Add various basic docstrings

This commit is contained in:
Peter Limkilde Svendsen
2024-10-27 23:25:57 +01:00
parent 9ac0226c93
commit 06fec0b843
12 changed files with 29 additions and 0 deletions
+2
View File
@@ -1,3 +1,5 @@
//! Nul-terminated byte strings.
use core::{marker::PhantomData, ptr::NonNull, str::Utf8Error};
use alloc::{
+2
View File
@@ -1,3 +1,5 @@
//! Equivalent of Rust's `Vec<T>`, but using relibc's own allocator.
use crate::{
io::{self, Write},
platform::{self, types::*, WriteByte},
+2
View File
@@ -1,3 +1,5 @@
//! POSIX header implementations.
pub mod _aio;
pub mod _fenv;
pub mod arpa_inet;
+2
View File
@@ -1,3 +1,5 @@
//! Dynamic loading and linking.
use core::{mem, ptr};
use goblin::elf::program_header::{self, program_header32, program_header64, ProgramHeader};
+8
View File
@@ -1,3 +1,11 @@
//! POSIX C library, implemented in Rust.
//!
//! This crate exists to provide a standard libc as its public API. This is
//! largely provided by automatically generated bindings to the functions and
//! data structures in the [`header`] module.
//!
//! Currently, Linux and Redox syscall backends are supported.
#![no_std]
#![allow(warnings)]
#![allow(non_camel_case_types)]
+1
View File
@@ -65,6 +65,7 @@ pub fn e_raw(sys: usize) -> Result<usize> {
}
}
/// Linux syscall implementation of the platform abstraction layer.
pub struct Sys;
impl Sys {
+4
View File
@@ -1,3 +1,5 @@
//! Platform abstractions and environment.
use crate::{
error::ResultExt,
io::{self, Read, Write},
@@ -38,9 +40,11 @@ pub use redox_rt::auxv_defs;
use self::types::*;
pub mod types;
/// The global `errno` variable used internally in relibc.
#[thread_local]
pub static ERRNO: Cell<c_int> = Cell::new(0);
/// The `argv` argument available to a program's `main` function.
#[allow(non_upper_case_globals)]
pub static mut argv: *mut *mut c_char = ptr::null_mut();
#[allow(non_upper_case_globals)]
+1
View File
@@ -25,6 +25,7 @@ mod signal;
pub use self::socket::PalSocket;
mod socket;
/// Platform abstraction layer, a platform-agnostic abstraction over syscalls.
pub trait Pal {
fn access(path: CStr, mode: c_int) -> Result<()>;
+1
View File
@@ -74,6 +74,7 @@ macro_rules! path_from_c_str {
use self::{exec::Executable, path::canonicalize};
/// Redox syscall implementation of the platform abstraction layer.
pub struct Sys;
impl Pal for Sys {
+2
View File
@@ -1,3 +1,5 @@
//! C data types for this platform.
use core::i32;
// Use repr(u8) as LLVM expects `void*` to be the same as `i8*` to help enable
+2
View File
@@ -1,3 +1,5 @@
//! Startup code.
use alloc::{boxed::Box, vec::Vec};
use core::{intrinsics, ptr};
+2
View File
@@ -1,3 +1,5 @@
//! Synchronization primitives.
// TODO: set this for entire crate when possible
#![deny(unsafe_op_in_unsafe_fn)]