mirror of
https://github.com/intel/llvm.git
synced 2026-01-21 12:19:23 +08:00
Provide ADB port forwarding support for abstract sockets.
http://reviews.llvm.org/D14262 llvm-svn: 251879
This commit is contained in:
@@ -50,6 +50,9 @@ const size_t kMaxPushData = 2*1024;
|
||||
// Default mode for pushed files.
|
||||
const uint32_t kDefaultMode = 0100770; // S_IFREG | S_IRWXU | S_IRWXG
|
||||
|
||||
const char * kSocketNamespaceAbstract = "localabstract";
|
||||
const char * kSocketNamespaceFileSystem = "localfilesystem";
|
||||
|
||||
} // namespace
|
||||
|
||||
Error
|
||||
@@ -145,10 +148,17 @@ AdbClient::SetPortForwarding (const uint16_t local_port, const uint16_t remote_p
|
||||
}
|
||||
|
||||
Error
|
||||
AdbClient::SetPortForwarding (const uint16_t local_port, const char* remote_socket_name)
|
||||
AdbClient::SetPortForwarding (const uint16_t local_port,
|
||||
const char* remote_socket_name,
|
||||
const UnixSocketNamespace socket_namespace)
|
||||
{
|
||||
char message[PATH_MAX];
|
||||
snprintf (message, sizeof (message), "forward:tcp:%d;localfilesystem:%s", local_port, remote_socket_name);
|
||||
const char * sock_namespace_str = (socket_namespace == UnixSocketNamespaceAbstract) ?
|
||||
kSocketNamespaceAbstract : kSocketNamespaceFileSystem;
|
||||
snprintf (message, sizeof (message), "forward:tcp:%d;%s:%s",
|
||||
local_port,
|
||||
sock_namespace_str,
|
||||
remote_socket_name);
|
||||
|
||||
const auto error = SendDeviceMessage (message);
|
||||
if (error.Fail ())
|
||||
|
||||
Reference in New Issue
Block a user