Mark `MemoryRange::as_slice()` and `MemoryRange::as_slice_mut()` as
unsafe.
This is due to the fact that not all representable types can be cast to
an arbitrary value. For example, if Process A sends random values to
Process B, then Process B casts the memory to a slice of `bool`, then
any values that are not 0 or 1 are undefined.
Because these functions can leak UB into the program, they are marked as
unsafe.
This patch adds `unsafe {}` blocks to all instances where this function
is called. Additionally, all instances have been checked to verify that
they do not cast to any invalid types -- most use `u8` or `u32`.
Additionally, the long-deprecated `MemoryRange::from_parts()` call was
removed, since that causes UB without being marked as unsafe.
Signed-off-by: Sean Cross <sean@xobs.io>
However, I didn't write this library (and I don't have a test
suite for it), so I'm not quite sure if this preserves the
invariants on the fd_mapping() structure. Needs @xobs' review.
Rather than hardcoding numbers, use an enum with the constant values.
This will make it easier to reason about what the constants mean.
Signed-off-by: Sean Cross <sean@xobs.io>
Add support for libstd calls to pddb.
The pddb uses `:` as the path separator, and grafts the concept of paths
onto dicts.
Currently implemented features:
* mkdir
* rmdir
* create file
* open file
* read file
* write file
* unlink file
* seek file
Other calls may be added as needed.
Signed-off-by: Sean Cross <sean@xobs.io>