Add port-generic options to SharedFD vsockets
This allows creating vsocket servers at arbitrary open ports, and
retrieving the automatically assigned port numbers.
Bug: 145247175
Test: Builds
Change-Id: I5051645b7eccfd2bda4d861ca749aa1e6db946d7
diff --git a/common/libs/fs/shared_fd.cpp b/common/libs/fs/shared_fd.cpp
index 82baad3..2f6d100 100644
--- a/common/libs/fs/shared_fd.cpp
+++ b/common/libs/fs/shared_fd.cpp
@@ -421,6 +421,10 @@
return vsock;
}
+SharedFD SharedFD::VsockServer(int type) {
+ return VsockServer(VMADDR_PORT_ANY, type);
+}
+
SharedFD SharedFD::VsockClient(unsigned int cid, unsigned int port, int type) {
auto vsock = cvd::SharedFD::Socket(AF_VSOCK, type, 0);
if (!vsock->IsOpen()) {