crosvm/base
Clarissa Garvey 926d0063d8 base/src: Migrate Unix Tube to use StreamChannel
This CL migrates Tube from directly using a UnixSeqpacket to instead use
a StreamChannel backed by UnixSeqpackets. This CL also migrates users of
the old Tube::new(UnixSeqpacket) function to its renamed counterpart.
Tests are added for new functionality.

This CL enforces that the StreamChannel used by the Tube is backed by a
UnixSeqpacket because the reading and writing behavior of a UnixStream
is different, and it cannot guarantee the same multi-process
concurrent-writers behavior that a UnixSeqpacket can. This is because
the UnixStream does not send data as packets and the size cannot be
queried, so two underlyig writes are required for each Tube write: one
to send a header indicating message size, and one for the actual content
of the sent data. These can be interleaved during concurrent writes,
causing corruption of the Tube's data.

This CL makes the Windows and Unix API closer to each other, with some
differences remaining or added, including Tube::new_from_unix_seqpacket
existing in Unix but necessarily not Windows.

This migration (Tube from UnixSeqpacket to Stream) is intended to move
the Unix Tube API closer to the Windows API, with the eventual goal of
creating a platform-agnostic API for Tube.

Bug: b:231641496
Change-Id: I2422e76b7efa5a20bc40a8d194f5f8390dc71438
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/3818253
Reviewed-by: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: Noah Gold <nkgold@google.com>
Tested-by: Clarissa Garvey <clarissagarvey@chromium.org>
Commit-Queue: Clarissa Garvey <clarissagarvey@chromium.org>
2022-08-15 23:15:12 +00:00
..
base_event_token_derive Reformat imports 2022-07-28 00:15:50 +00:00
src base/src: Migrate Unix Tube to use StreamChannel 2022-08-15 23:15:12 +00:00
.build_test_serial Refactoring: Move common/base into base 2022-03-17 00:01:27 +00:00
Cargo.toml Cargo: bump all rand dependencies to 0.8 2022-06-30 23:22:37 +00:00