Skip to content

Commit

Permalink
move descriptor_table.h to headers/private
Browse files Browse the repository at this point in the history
We're not yet ready to commit to making this API public, so we'll make it
private for now.

I've also expanded a comment in descriptor_table.c to explain the current ABI
for resource handles.

Signed-off-by: Joel Dice <[email protected]>
  • Loading branch information
dicej committed Feb 12, 2024
1 parent 8769ff8 commit eff57e8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
1 change: 0 additions & 1 deletion expected/wasm32-wasi-preview2/include-all.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@
#include <utime.h>
#include <values.h>
#include <wasi/api.h>
#include <wasi/descriptor_table.h>
#include <wasi/libc-environ.h>
#include <wasi/libc-find-relpath.h>
#include <wasi/libc-nocwd.h>
Expand Down
1 change: 0 additions & 1 deletion expected/wasm32-wasi-preview2/predefined-macros.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@
#define DECIMAL_DIG 36
#define DELAYTIMER_MAX 0x7fffffff
#define DELETE ns_uop_delete
#define DESCRIPTOR_TABLE_H
#define DEV_BSIZE 512
#define DIRTYPE '5'
#define DM 242
Expand Down
11 changes: 6 additions & 5 deletions libc-bottom-half/sources/descriptor_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
* descriptors.
*
* WASI Preview 2 has no notion of file descriptors and instead uses unforgeable
* resource handles. Moreover, there's not necessarily a one-to-one
* correspondence between POSIX file descriptors and resource handles (e.g. a
* TCP connection may require separate handles for reading, writing, and polling
* the same connection). We use this table to map each POSIX descriptor to a
* set of one or more handles.
* resource handles (which are currently represented as integers at the ABI
* level, used as indices into per-component tables managed by the host).
* Moreover, there's not necessarily a one-to-one correspondence between POSIX
* file descriptors and resource handles (e.g. a TCP connection may require
* separate handles for reading, writing, and polling the same connection). We
* use this table to map each POSIX descriptor to a set of one or more handles.
*
* As of this writing, we still rely on the WASI Preview 1 adapter
* (https://github.com/bytecodealliance/wasmtime/tree/main/crates/wasi-preview1-component-adapter)
Expand Down

0 comments on commit eff57e8

Please sign in to comment.