Expand description
§Monotron API
This crate contains the Userspace to Kernel API for the Monotron.
It is pulled in by the Kernel (github.com/thejpster/monotron) and the various user-space example applications (github.com/thejpster/monotron-apps).
The API in here is modelled after both the UNIX/POSIX API and the MS-DOS
API. We use function pointers rather than SWI
calls (software
interrupts), provided in a structure. This structure is designed to be
extensible.
A C header file version of this API can be generated with cbindgen
.
All types in this file must be #[repr(C)]
.
Structs§
- Api
- This structure contains all the function pointers the application can use to access OS functions.
- Borrowed
String - Describes a string of fixed length, which must not be free’d by the recipient. The given length must not include any null terminators that may be present. The string must be valid UTF-8 (or 7-bit ASCII, which is a valid subset of UTF-8).
- DirEntry
- Describes a file as it exists on disk.
- File
Mode - A bitfield indicating if a file is:
- Handle
- Describes a handle to some resource.
- Timestamp
- Describes an instant in time. The system only supports local time and has no concept of time zones.
Enums§
- DayOf
Week - Represents the seven days of the week
- Empty
Result - Describes the result of a function which may return nothing if everything
was Ok, or return an
Error
if something went wrong. - Error
- The set of Error codes the API can report.
- File
Type - Describes the sort of files you will find in the system-wide virtual filesystem. Some exist on disk, and some do not.
- Handle
Result - Describes the result of a function which may return a
Handle
if everything was Ok, or return anError
if something went wrong. - Offset
- Represents how far to move the current read/write pointer through a file. You can specify the position as relative to the start of the file, relative to the end of the file, or relative to the current pointer position.
- Open
Mode - The ways in which we can open a file.
- Size
Result - Describes the result of a function which may return a numeric count of
bytes read/written if everything was Ok, or return an
Error
if something went wrong.
Statics§
Functions§
- monotron_
filemode_ is_ archive - Is the archive bit set in this FileMode bit-field?
- monotron_
filemode_ is_ readonly - Is the read-only bit set in this FileMode bit-field?
- monotron_
filemode_ is_ system - Is the system bit set in this FileMode bit-field?
- monotron_
filemode_ is_ volume - Is the volume label bit set in this FileMode bit-field?
- monotron_
openmode_ readonly - Create a new Read Only open mode object, for passing to the
open
syscall. - monotron_
openmode_ readwrite - Create a new Read Write open mode object, for passing to the
open
syscall. - monotron_
openmode_ writeonly - Create a new Write Only open mode object, for passing to the
open
syscall.