base,python: Add a param type for host sockets.

These can either be set to an integer, in which case it's interpreted
as a TCP port, or a string, in which case it's treated as a unix domain
socket. If the unix domain socket is prefixed with a "@", it will be
treated as an abstract socket.

When stored in the ini file, there is always a prefix added to make
parsing the string more systematic and less ambiguous. A port number is
prefixed with "#", an abstract socket with "@", and a socket file with
the prefix "P" for "path".

Change-Id: I1fc7a579074e849b3becd936238c62fb0d9a2087
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69165
Reviewed-by: Yu-hsin Wang <yuhsingw@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2023-03-18 20:25:11 -07:00
parent e4a46cb09d
commit 57aaccdeff
4 changed files with 102 additions and 0 deletions

View File

@@ -223,6 +223,20 @@ init_loader(py::module_ &m_native)
m.def("setInterpDir", &loader::setInterpDir);
}
static void
init_socket(py::module_ &m_native)
{
py::module_ m_socket = m_native.def_submodule("socket");
m_socket
.def("listenSocketEmptyConfig", &listenSocketEmptyConfig)
.def("listenSocketInetConfig", &listenSocketInetConfig)
.def("listenSocketUnixFileConfig", &listenSocketUnixFileConfig)
.def("listenSocketUnixAbstractConfig",
&listenSocketUnixAbstractConfig);
py::class_<ListenSocketConfig>(m_socket, "ListenSocketConfig");
}
void
pybind_init_core(py::module_ &m_native)
{
@@ -334,6 +348,7 @@ pybind_init_core(py::module_ &m_native)
init_net(m_native);
init_loader(m_native);
init_pc(m_native);
init_socket(m_native);
}
} // namespace gem5