Skip to content

Commit

Permalink
update to WASI where snashot event_u flattened to struct
Browse files Browse the repository at this point in the history
  • Loading branch information
pchickey committed Feb 12, 2020
1 parent 014368e commit 8443958
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 23 deletions.
33 changes: 11 additions & 22 deletions libc-bottom-half/headers/public/wasi/api.h
Original file line number Diff line number Diff line change
Expand Up @@ -1166,24 +1166,6 @@ _Static_assert(_Alignof(__wasi_event_fd_readwrite_t) == 8, "witx calculated alig
_Static_assert(offsetof(__wasi_event_fd_readwrite_t, nbytes) == 0, "witx calculated offset");
_Static_assert(offsetof(__wasi_event_fd_readwrite_t, flags) == 8, "witx calculated offset");

/**
* The contents of an $event.
*/
typedef union __wasi_event_u_u_t {
__wasi_event_fd_readwrite_t fd_read;
__wasi_event_fd_readwrite_t fd_write;
} __wasi_event_u_u_t;
typedef struct __wasi_event_u_t {
__wasi_eventtype_t tag;
__wasi_event_u_u_t u;
} __wasi_event_u_t;

_Static_assert(sizeof(__wasi_event_u_t) == 24, "witx calculated size");
_Static_assert(_Alignof(__wasi_event_u_t) == 8, "witx calculated align");
_Static_assert(offsetof(__wasi_event_u_t, u) == 8, "witx calculated union offset");
_Static_assert(sizeof(__wasi_event_u_u_t) == 16, "witx calculated union size");
_Static_assert(_Alignof(__wasi_event_u_u_t) == 8, "witx calculated union align");

/**
* An event that occurred.
*/
Expand All @@ -1199,17 +1181,24 @@ typedef struct __wasi_event_t {
__wasi_errno_t error;

/**
* The type of the event that occurred, and its contents.
* The type of event that occured
*/
__wasi_eventtype_t type;

/**
* The contents of the event, if it is an `eventtype::fd_read` or
* `eventtype::fd_write`. `eventtype::clock` events ignore this field.
*/
__wasi_event_u_t u;
__wasi_event_fd_readwrite_t fd_readwrite;

} __wasi_event_t;

_Static_assert(sizeof(__wasi_event_t) == 40, "witx calculated size");
_Static_assert(sizeof(__wasi_event_t) == 32, "witx calculated size");
_Static_assert(_Alignof(__wasi_event_t) == 8, "witx calculated align");
_Static_assert(offsetof(__wasi_event_t, userdata) == 0, "witx calculated offset");
_Static_assert(offsetof(__wasi_event_t, error) == 8, "witx calculated offset");
_Static_assert(offsetof(__wasi_event_t, u) == 16, "witx calculated offset");
_Static_assert(offsetof(__wasi_event_t, type) == 10, "witx calculated offset");
_Static_assert(offsetof(__wasi_event_t, fd_readwrite) == 16, "witx calculated offset");

/**
* Flags determining how to interpret the timestamp provided in
Expand Down

0 comments on commit 8443958

Please sign in to comment.