================ @@ -44,6 +47,112 @@ using namespace llvm; // option descriptors for getopt_long_only() +#ifdef _WIN32 +typedef pipe_t fd_t; +const fd_t kInvalidSharedFD = LLDB_INVALID_PIPE; +#else +typedef NativeSocket fd_t; +const fd_t kInvalidSharedFD = Socket::kInvalidSocketValue; +#endif + +class SharedSocket { +public: + // Used by the parent process. + SharedSocket(Connection *conn, Status &error) { + m_fd = kInvalidSharedFD; + + const Socket *socket = + static_cast<const Socket *>(conn->GetReadObject().get()); + if (socket == nullptr) { + error = Status("invalid conn socket"); + return; + } + +#ifdef _WIN32 + m_socket = socket->GetNativeSocket(); + + // Create a pipe to transfer WSAPROTOCOL_INFO to the child process. + error = m_socket_pipe.CreateNew(true); + if (error.Fail()) + return; + + m_fd = m_socket_pipe.GetReadPipe(); +#else + m_fd = socket->GetNativeSocket(); + error = Status(); +#endif + } + + // Used by the child process. + SharedSocket(fd_t fd) : m_fd(fd) {} ---------------- labath wrote:
```suggestion explicit SharedSocket(fd_t fd) : m_fd(fd) {} ``` https://github.com/llvm/llvm-project/pull/101283 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits