//! # The Redox OS Kernel, version 2 //! //! The Redox OS Kernel is a hybrid kernel that supports X86 systems and //! 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` //! //! 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` //! //! 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` //! //! 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` //! //! 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` //! //! 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(lang_items)] #![no_std] #[macro_use] extern crate bitflags; use arch::interrupt::{set_interrupts, halt}; /// Architecture specific items #[macro_use] extern crate arch; /// Intrinsics for panic handling pub mod panic; #[no_mangle] pub extern fn kmain() { println!("TEST"); unsafe { set_interrupts() }; loop { unsafe { halt() }; } }