pub unsafe extern "C" fn fdf_channel_call(
handle: fdf_handle_t,
options: u32,
deadline: zx_time_t,
args: *const fdf_channel_call_args_t,
) -> zx_status_tExpand description
fdf_channel_call() is like a combined fdf_channel_write(), fdf_channel_wait_async(), and fdf_channel_read(), with the addition of a feature where a transaction id at the front of the message payload bytes is used to match reply messages with send messages, enabling multiple calling threads to share a channel without any additional client-side bookkeeping.
The first four bytes of the written and read back messages are treated as a transaction ID of type fdf_txid_t. The runtime generates a txid for the written message, replacing that part of the message as read from the user. The runtime generated txid will be between 0x80000000 and 0xFFFFFFFF, and will not collide with any txid from any other fdf_channel_call() in progress against this channel endpoint. If the written message has a length of fewer than four bytes, an error is reported.
While |deadline| has not passed, if an inbound message arrives with a matching txid, instead of being added to the tail of the general inbound message queue, it is delivered directly to the thread waiting in fdf_channel_call().
If such a reply arrives after |deadline| has passed, it will arrive in the general inbound message queue.
All written handles are consumed and are no longer available to the caller, on success or failure.
ยงErrors
ZX_ERR_INVALID_ARGS: |args| is NULL, or |wr_data| or |wr_handles| are non-NULL and not pointers managed by |wr_arena|, or any element in |handles| is not a valid handle, or |wr_num_bytes| is less than four, or at least one of |wr_handles| has a pending callback registered via |fdf_channel_wait_async|, or |rd_arena| is NULL when |rd_data| or |rd_handles| are non-NULL.
ZX_ERR_PEER_CLOSED: The other side of the channel is closed.
ZX_ERR_TIMED_OUT: |deadline| passed before a reply matching the correct txid was received.
ZX_ERR_BAD_STATE: This is called from a driver runtime managed thread that does not allow sync calls.
This operation is thread-safe.