Skip to content

Commit 7f89301

Browse files
committed
update to WASI where snashot event_u flattened to struct
1 parent c2ae180 commit 7f89301

2 files changed

Lines changed: 12 additions & 23 deletions

File tree

  • libc-bottom-half/headers/public/wasi
  • tools/wasi-headers

libc-bottom-half/headers/public/wasi/api.h

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,24 +1166,6 @@ _Static_assert(_Alignof(__wasi_event_fd_readwrite_t) == 8, "witx calculated alig
11661166
_Static_assert(offsetof(__wasi_event_fd_readwrite_t, nbytes) == 0, "witx calculated offset");
11671167
_Static_assert(offsetof(__wasi_event_fd_readwrite_t, flags) == 8, "witx calculated offset");
11681168

1169-
/**
1170-
* The contents of an $event.
1171-
*/
1172-
typedef union __wasi_event_u_u_t {
1173-
__wasi_event_fd_readwrite_t fd_read;
1174-
__wasi_event_fd_readwrite_t fd_write;
1175-
} __wasi_event_u_u_t;
1176-
typedef struct __wasi_event_u_t {
1177-
__wasi_eventtype_t tag;
1178-
__wasi_event_u_u_t u;
1179-
} __wasi_event_u_t;
1180-
1181-
_Static_assert(sizeof(__wasi_event_u_t) == 24, "witx calculated size");
1182-
_Static_assert(_Alignof(__wasi_event_u_t) == 8, "witx calculated align");
1183-
_Static_assert(offsetof(__wasi_event_u_t, u) == 8, "witx calculated union offset");
1184-
_Static_assert(sizeof(__wasi_event_u_u_t) == 16, "witx calculated union size");
1185-
_Static_assert(_Alignof(__wasi_event_u_u_t) == 8, "witx calculated union align");
1186-
11871169
/**
11881170
* An event that occurred.
11891171
*/
@@ -1199,17 +1181,24 @@ typedef struct __wasi_event_t {
11991181
__wasi_errno_t error;
12001182

12011183
/**
1202-
* The type of the event that occurred, and its contents.
1184+
* The type of event that occured
1185+
*/
1186+
__wasi_eventtype_t type;
1187+
1188+
/**
1189+
* The contents of the event, if it is an `eventtype::fd_read` or
1190+
* `eventtype::fd_write`. `eventtype::clock` events ignore this field.
12031191
*/
1204-
__wasi_event_u_t u;
1192+
__wasi_event_fd_readwrite_t fd_readwrite;
12051193

12061194
} __wasi_event_t;
12071195

1208-
_Static_assert(sizeof(__wasi_event_t) == 40, "witx calculated size");
1196+
_Static_assert(sizeof(__wasi_event_t) == 32, "witx calculated size");
12091197
_Static_assert(_Alignof(__wasi_event_t) == 8, "witx calculated align");
12101198
_Static_assert(offsetof(__wasi_event_t, userdata) == 0, "witx calculated offset");
12111199
_Static_assert(offsetof(__wasi_event_t, error) == 8, "witx calculated offset");
1212-
_Static_assert(offsetof(__wasi_event_t, u) == 16, "witx calculated offset");
1200+
_Static_assert(offsetof(__wasi_event_t, type) == 10, "witx calculated offset");
1201+
_Static_assert(offsetof(__wasi_event_t, fd_readwrite) == 16, "witx calculated offset");
12131202

12141203
/**
12151204
* Flags determining how to interpret the timestamp provided in

0 commit comments

Comments
 (0)