Update scheme documentation

This commit is contained in:
Jeremy Soller 2016-11-04 13:38:40 -06:00
parent cab27d0f67
commit 92ac91f4a5
2 changed files with 17 additions and 73 deletions

View file

@ -1,68 +1,7 @@
//! # The Redox OS Kernel, version 2 //! # The Redox OS Kernel, version 2
//! //!
//! The Redox OS Kernel is a hybrid kernel that supports X86 systems and //! The Redox OS Kernel is a hybrid kernel that supports X86_64 systems and
//! provides Unix-like syscalls for primarily Rust applications //! provides Unix-like syscalls for primarily Rust applications
//!
//! ## Syscalls
//! Syscalls in Redox are often handled by userspace `schemes`.
//! The essential syscalls in Redox are as follows:
//!
//! ### Open
//! `open(path: &str, flags: usize) -> Result<file_descriptor: usize>`
//!
//! Open a file, providing a path as a `&str` and flags, defined elsewhere.
//!
//! Returns a number, known as a file descriptor, that is passed to other syscalls
//!
//! ### Close
//! `close(file_descriptor: usize) -> Result<()>`
//!
//! Close a file descriptor, providing the file descriptor from `open`
//!
//! Returns an error, `EBADF`, if the file descriptor was not found.
//!
//! This potential error is often ignored by userspace
//!
//! ### Duplicate
//! `dup(file_descriptor: usize) -> Result<file_descriptor: usize>`
//!
//! Duplicate a file descriptor, providing the file descriptor from `open`
//!
//! Returns a new file descriptor, or an error
//!
//! ### Read
//! `read(file_descriptor: usize, buffer: &mut [u8]) -> Result<count: usize>`
//!
//! Read from a file descriptor, providing the file descriptor from `open` and a mutable buffer
//!
//! Returns the number of bytes actually read, or an error
//!
//! ### Write
//! `write(file_descriptor: usize, buffer: &[u8]) -> Result<count: usize>`
//!
//! Write to a file descriptor, providing the file descriptor from `open` and a const buffer
//!
//! Returns the number of bytes actually written, or an error
//!
//! ### Stat
//! `fstat(file_descriptor: usize, stat: &mut Stat) -> Result<()>`
//!
//! Get information from a file descriptor, providing the file descriptor from `open`
//! and a mutable Stat struct, defined elsewhere.
//!
//! Returns an error if the operation failed
//!
//! ### Path
//! `fpath(file_descriptor: usize, buffer: &mut [u8]) -> Result<count: usize>`
//!
//! Read the path of a file descriptor, providing the file descriptor from `open` and
//! a mutable buffer.
//!
//! Returns the number of bytes actually read, or an error
//!
//! The buffer should be 4096 bytes, to ensure that the entire path will fit.
//! An error will be returned, `ENOBUFS`, if the buffer is not long enough for the name.
//! In this case, it is recommended to add one page, 4096 bytes, to the buffer and retry.
#![feature(alloc)] #![feature(alloc)]
#![feature(arc_counts)] #![feature(arc_counts)]
@ -215,6 +154,11 @@ pub extern fn kmain_ap(id: usize) {
let pid = syscall::getpid(); let pid = syscall::getpid();
println!("AP {}: {:?}", id, pid); println!("AP {}: {:?}", id, pid);
// Disable APs for now
loop {
unsafe { interrupt::enable_and_halt(); }
}
loop { loop {
unsafe { unsafe {
interrupt::disable(); interrupt::disable();

View file

@ -26,37 +26,37 @@ use self::root::{ROOT_SCHEME_ID, RootScheme};
use self::sys::SysScheme; use self::sys::SysScheme;
use self::zero::ZeroScheme; use self::zero::ZeroScheme;
/// Debug scheme /// `debug:` - provides access to serial console
pub mod debug; pub mod debug;
/// Kernel events /// `event:` - allows reading of `Event`s which are registered using `fevent`
pub mod event; pub mod event;
/// Environmental variables /// `env:` - access and modify environmental variables
pub mod env; pub mod env;
/// InitFS scheme /// `initfs:` - a readonly filesystem used for initializing the system
pub mod initfs; pub mod initfs;
/// IRQ handling /// `irq:` - allows userspace handling of IRQs
pub mod irq; pub mod irq;
/// Null scheme /// `null:` - a scheme that will discard all writes, and read no bytes
pub mod null; pub mod null;
/// Anonymouse pipe /// `pipe:` - used internally by the kernel to implement `pipe`
pub mod pipe; pub mod pipe;
/// Root scheme /// `:` - allows the creation of userspace schemes, tightly dependent on `user`
pub mod root; pub mod root;
/// System information /// `sys:` - system information, such as the context list and scheme list
pub mod sys; pub mod sys;
/// Userspace schemes /// A wrapper around userspace schemes, tightly dependent on `root`
pub mod user; pub mod user;
/// Zero scheme /// `zero:` - a scheme that will discard all writes, and always fill read buffers with zero
pub mod zero; pub mod zero;
/// Limit on number of schemes /// Limit on number of schemes