Crate monotron_api

Source
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.
BorrowedString
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.
FileMode
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§

DayOfWeek
Represents the seven days of the week
EmptyResult
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.
FileType
Describes the sort of files you will find in the system-wide virtual filesystem. Some exist on disk, and some do not.
HandleResult
Describes the result of a function which may return a Handle if everything was Ok, or return an Error 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.
OpenMode
The ways in which we can open a file.
SizeResult
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§

STDERR
Standard Error
STDIN
Standard Input
STDOUT
Standard Output

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.