Skip to content

Commit

Permalink
Backport fd as handle to past and current snapshots (WebAssembly#238)
Browse files Browse the repository at this point in the history
This commit backports fd as handle to past and current snapshots.
I'm hoping this could prove useful in situations where currently
in the implementor's code, any syscall that deals with `fd`s has
to be marked as potentially "unsafe", whereas with `fd` as a handle
this would be shifted to the fact that `fd` *is* a handle rather
than an alias to an int type.
  • Loading branch information
Jakub Konka authored Feb 29, 2020
1 parent 0a767c9 commit d5b0c23
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions phases/old/snapshot_0/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,10 @@ If [`rights::fd_write`](#rights.fd_write) is set, includes the right to invoke [
- <a href="#rights.sock_shutdown" name="rights.sock_shutdown"></a> `sock_shutdown`
The right to invoke [`sock_shutdown`](#sock_shutdown).

## <a href="#fd" name="fd"></a> `fd`: `u32`
A file descriptor index.
## <a href="#fd" name="fd"></a> `fd`
A file descriptor handle.

### Supertypes
## <a href="#iovec" name="iovec"></a> `iovec`: Struct
A region of memory for scatter/gather reads.

Expand Down
4 changes: 2 additions & 2 deletions phases/old/snapshot_0/witx/typenames.witx
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@
)
)

;;; A file descriptor index.
(typename $fd u32)
;;; A file descriptor handle.
(typename $fd (handle))

;;; A region of memory for scatter/gather reads.
(typename $iovec
Expand Down
5 changes: 3 additions & 2 deletions phases/snapshot/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,10 @@ If [`rights::fd_write`](#rights.fd_write) is set, includes the right to invoke [
- <a href="#rights.sock_shutdown" name="rights.sock_shutdown"></a> `sock_shutdown`
The right to invoke [`sock_shutdown`](#sock_shutdown).

## <a href="#fd" name="fd"></a> `fd`: `u32`
A file descriptor index.
## <a href="#fd" name="fd"></a> `fd`
A file descriptor handle.

### Supertypes
## <a href="#iovec" name="iovec"></a> `iovec`: Struct
A region of memory for scatter/gather reads.

Expand Down
4 changes: 2 additions & 2 deletions phases/snapshot/witx/typenames.witx
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@
)
)

;;; A file descriptor index.
(typename $fd u32)
;;; A file descriptor handle.
(typename $fd (handle))

;;; A region of memory for scatter/gather reads.
(typename $iovec
Expand Down

0 comments on commit d5b0c23

Please sign in to comment.