(
ctx: &VmCtx,
pollfds: &mut Vec<libc::pollfd>,
fd_data: &mut Vec<(u64, SubscriptionFdType)>,
userdata: u64,
subscription_readwrite: SubscriptionFdReadWrite,
)
| 68 | #[ensures(trace_safe(trace, ctx))] |
| 69 | #[external_methods(push, to_posix)] |
| 70 | pub fn poll_parse_fds( |
| 71 | ctx: &VmCtx, |
| 72 | pollfds: &mut Vec<libc::pollfd>, |
| 73 | fd_data: &mut Vec<(u64, SubscriptionFdType)>, |
| 74 | userdata: u64, |
| 75 | subscription_readwrite: SubscriptionFdReadWrite, |
| 76 | ) -> RuntimeResult<()> { |
| 77 | let fd = ctx.fdmap.fd_to_native(subscription_readwrite.v_fd)?; |
| 78 | let os_fd: usize = fd.to_raw(); |
| 79 | // let event = match subscription_readwrite.typ { |
| 80 | // SubscriptionFdType::Read => libc::POLLIN, |
| 81 | // SubscriptionFdType::Write => libc::POLLOUT, |
| 82 | // }; |
| 83 | let event = subscription_readwrite.typ.to_posix(); |
| 84 | // convert FD subscriptions to their libc versions |
| 85 | let pollfd = libc::pollfd { |
| 86 | fd: os_fd as i32, |
| 87 | events: event, |
| 88 | revents: 0, |
| 89 | }; |
| 90 | pollfds.push(pollfd); |
| 91 | fd_data.push((userdata, subscription_readwrite.typ)); |
| 92 | Ok(()) |
| 93 | } |
| 94 | |
| 95 | #[with_ghost_var(trace: &mut Trace)] |
| 96 | #[requires(ctx_safe(ctx))] |
no test coverage detected