kubkon commented on Issue #1329:
@sunfishcode I've applied the tweaks to the design as discussed offline on Zulip. Here's the summary of the changes:
The underlying type in
FdPool
which we use to track and represent raw file descriptors is nowu32
. As a result, the structure ofFdPool
is simplified massively as we no longer need to track the claimed descriptors; in a way, we trust the caller to return the handle after it's done with it. In case the caller decides to be clever and return a handle which was not yet legally allocated, we panic. This should never be a problem inwasi-common
unless we hit a bug.To make all of this work,
Fd
trait is modified to require two methods:as_raw(&self) -> u32
andfrom_raw(raw_fd: u32) -> Self
both of which are used to convert to and from theFdPool
's underlying typeu32
.
Last updated: Dec 23 2024 at 12:05 UTC