1 #ifndef __UVWASI_POLL_ONEOFF_H__ 2 #define __UVWASI_POLL_ONEOFF_H__ 3 4 #include "fd_table.h" 5 #include "wasi_types.h" 6 7 struct uvwasi_s; 8 9 struct uvwasi__poll_fdevent_t { 10 struct uvwasi_fd_wrap_t* wrap; 11 uvwasi_userdata_t userdata; 12 uvwasi_eventtype_t type; 13 uvwasi_errno_t error; 14 uv_poll_t* poll_handle; 15 int is_duplicate_fd; 16 int events; 17 int revents; 18 }; 19 20 struct uvwasi_poll_oneoff_state_t { 21 struct uvwasi_s* uvwasi; 22 struct uvwasi__poll_fdevent_t* fdevents; 23 uv_poll_t* poll_handles; 24 uv_timer_t timer; 25 uint64_t timeout; 26 uv_loop_t loop; 27 uvwasi_size_t max_fds; 28 int has_timer; 29 uvwasi_size_t fdevent_cnt; 30 uvwasi_size_t handle_cnt; 31 int result; 32 }; 33 34 35 uvwasi_errno_t uvwasi__poll_oneoff_state_init( 36 struct uvwasi_s* uvwasi, 37 struct uvwasi_poll_oneoff_state_t* state, 38 uvwasi_size_t max_fds 39 ); 40 41 uvwasi_errno_t uvwasi__poll_oneoff_state_cleanup( 42 struct uvwasi_poll_oneoff_state_t* state 43 ); 44 45 uvwasi_errno_t uvwasi__poll_oneoff_state_set_timer( 46 struct uvwasi_poll_oneoff_state_t* state, 47 uvwasi_timestamp_t timeout 48 ); 49 50 uvwasi_errno_t uvwasi__poll_oneoff_state_add_fdevent( 51 struct uvwasi_poll_oneoff_state_t* state, 52 uvwasi_subscription_t* subscription 53 ); 54 55 uvwasi_errno_t uvwasi__poll_oneoff_run( 56 struct uvwasi_poll_oneoff_state_t* state 57 ); 58 59 60 #endif /* __UVWASI_POLL_ONEOFF_H__ */ 61