[Lldb-commits] [lldb] r196586 - Replace all in_port_t with uint16_t to avoid compilation issues on different systems.
Greg Clayton
gclayton at apple.com
Fri Dec 6 09:46:35 PST 2013
Author: gclayton
Date: Fri Dec 6 11:46:35 2013
New Revision: 196586
URL: http://llvm.org/viewvc/llvm-project?rev=196586&view=rev
Log:
Replace all in_port_t with uint16_t to avoid compilation issues on different systems.
Modified:
lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
lldb/trunk/include/lldb/Host/SocketAddress.h
lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
lldb/trunk/source/Host/common/SocketAddress.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
lldb/trunk/tools/debugserver/source/RNBSocket.cpp
lldb/trunk/tools/debugserver/source/RNBSocket.h
lldb/trunk/tools/debugserver/source/debugserver.cpp
Modified: lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h?rev=196586&r1=196585&r2=196586&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h (original)
+++ lldb/trunk/include/lldb/Core/ConnectionFileDescriptor.h Fri Dec 6 11:46:35 2013
@@ -11,9 +11,7 @@
#define liblldb_ConnectionFileDescriptor_h_
// C Includes
-#ifdef _WIN32
-typedef unsigned short in_port_t;
-#else
+#ifndef _WIN32
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
@@ -68,15 +66,15 @@ public:
// If the read file descriptor is a socket, then return
// the port number that is being used by the socket.
- in_port_t
+ uint16_t
GetReadPort () const;
// If the write file descriptor is a socket, then return
// the port number that is being used by the socket.
- in_port_t
+ uint16_t
GetWritePort () const;
- in_port_t
+ uint16_t
GetBoundPort (uint32_t timeout_sec);
protected:
@@ -124,12 +122,12 @@ protected:
int m_pipe_read; // A pipe that we select on the reading end of along with
int m_pipe_write; // m_fd_recv so we can force ourselves out of the select.
Mutex m_mutex;
- Predicate<in_port_t> m_port_predicate; // Used when binding to port zero to wait for the thread that creates the socket, binds and listens to resolve the port number
+ Predicate<uint16_t> m_port_predicate; // Used when binding to port zero to wait for the thread that creates the socket, binds and listens to resolve the port number
bool m_should_close_fd; // True if this class should close the file descriptor when it goes away.
bool m_shutting_down; // This marks that we are shutting down so if we get woken up from BytesAvailable
// to disconnect, we won't try to read again.
- static in_port_t
+ static uint16_t
GetSocketPort (int fd);
static int
Modified: lldb/trunk/include/lldb/Host/SocketAddress.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/SocketAddress.h?rev=196586&r1=196585&r2=196586&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Host/SocketAddress.h (original)
+++ lldb/trunk/include/lldb/Host/SocketAddress.h Fri Dec 6 11:46:35 2013
@@ -18,7 +18,6 @@
#include <winsock2.h>
#include <WS2tcpip.h>
typedef ADDRESS_FAMILY sa_family_t;
-typedef USHORT in_port_t;
#else
#include <sys/socket.h>
#include <netdb.h>
@@ -103,7 +102,7 @@ public:
//------------------------------------------------------------------
// Get the port if the socket address for the family has a port
//------------------------------------------------------------------
- in_port_t
+ uint16_t
GetPort () const;
//------------------------------------------------------------------
@@ -111,7 +110,7 @@ public:
// The family must be set correctly prior to calling this function.
//------------------------------------------------------------------
bool
- SetPort (in_port_t port);
+ SetPort (uint16_t port);
//------------------------------------------------------------------
// Set the socket address according to the first match from a call
@@ -135,11 +134,11 @@ public:
//------------------------------------------------------------------
bool
SetToLocalhost (sa_family_t family,
- in_port_t port);
+ uint16_t port);
bool
SetToAnyAddress (sa_family_t family,
- in_port_t port);
+ uint16_t port);
//------------------------------------------------------------------
// Returns true if there is a valid socket address in this object.
Modified: lldb/trunk/source/Core/ConnectionFileDescriptor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ConnectionFileDescriptor.cpp?rev=196586&r1=196585&r2=196586&view=diff
==============================================================================
--- lldb/trunk/source/Core/ConnectionFileDescriptor.cpp (original)
+++ lldb/trunk/source/Core/ConnectionFileDescriptor.cpp Fri Dec 6 11:46:35 2013
@@ -1675,7 +1675,7 @@ ConnectionFileDescriptor::SetSocketRecei
return false;
}
-in_port_t
+uint16_t
ConnectionFileDescriptor::GetSocketPort (int fd)
{
// We bound to port zero, so we need to figure out which port we actually bound to
@@ -1691,7 +1691,7 @@ ConnectionFileDescriptor::GetSocketPort
// If the read file descriptor is a socket, then return
// the port number that is being used by the socket.
-in_port_t
+uint16_t
ConnectionFileDescriptor::GetReadPort () const
{
return ConnectionFileDescriptor::GetSocketPort (m_fd_recv);
@@ -1699,16 +1699,16 @@ ConnectionFileDescriptor::GetReadPort ()
// If the write file descriptor is a socket, then return
// the port number that is being used by the socket.
-in_port_t
+uint16_t
ConnectionFileDescriptor::GetWritePort () const
{
return ConnectionFileDescriptor::GetSocketPort (m_fd_send);
}
-in_port_t
+uint16_t
ConnectionFileDescriptor::GetBoundPort (uint32_t timeout_sec)
{
- in_port_t bound_port = 0;
+ uint16_t bound_port = 0;
if (timeout_sec == UINT32_MAX)
m_port_predicate.WaitForValueNotEqualTo (0, bound_port);
else
Modified: lldb/trunk/source/Host/common/SocketAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/SocketAddress.cpp?rev=196586&r1=196585&r2=196586&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/SocketAddress.cpp (original)
+++ lldb/trunk/source/Host/common/SocketAddress.cpp Fri Dec 6 11:46:35 2013
@@ -123,7 +123,7 @@ SocketAddress::SetFamily (sa_family_t fa
#endif
}
-in_port_t
+uint16_t
SocketAddress::GetPort () const
{
switch (GetFamily())
@@ -135,7 +135,7 @@ SocketAddress::GetPort () const
}
bool
-SocketAddress::SetPort (in_port_t port)
+SocketAddress::SetPort (uint16_t port)
{
switch (GetFamily())
{
@@ -233,7 +233,7 @@ SocketAddress::getaddrinfo (const char *
bool
-SocketAddress::SetToLocalhost (sa_family_t family, in_port_t port)
+SocketAddress::SetToLocalhost (sa_family_t family, uint16_t port)
{
switch (family)
{
@@ -261,7 +261,7 @@ SocketAddress::SetToLocalhost (sa_family
}
bool
-SocketAddress::SetToAnyAddress (sa_family_t family, in_port_t port)
+SocketAddress::SetToAnyAddress (sa_family_t family, uint16_t port)
{
switch (family)
{
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=196586&r1=196585&r2=196586&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Dec 6 11:46:35 2013
@@ -542,7 +542,7 @@ GDBRemoteCommunication::CheckForPacket (
}
Error
-GDBRemoteCommunication::StartListenThread (const char *hostname, in_port_t port)
+GDBRemoteCommunication::StartListenThread (const char *hostname, uint16_t port)
{
Error error;
if (IS_VALID_LLDB_HOST_THREAD(m_listen_thread))
Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=196586&r1=196585&r2=196586&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Fri Dec 6 11:46:35 2013
@@ -258,7 +258,7 @@ protected:
lldb_private::Error
StartListenThread (const char *hostname = "localhost",
- in_port_t port = 0);
+ uint16_t port = 0);
bool
JoinListenThread ();
Modified: lldb/trunk/tools/debugserver/source/RNBSocket.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBSocket.cpp?rev=196586&r1=196585&r2=196586&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBSocket.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBSocket.cpp Fri Dec 6 11:46:35 2013
@@ -67,7 +67,7 @@ ResolveIPV4HostName (const char *hostnam
}
rnb_err_t
-RNBSocket::Listen (const char *listen_host, in_port_t port, PortBoundCallback callback, const void *callback_baton)
+RNBSocket::Listen (const char *listen_host, uint16_t port, PortBoundCallback callback, const void *callback_baton)
{
//DNBLogThreadedIf(LOG_RNB_COMM, "%8u RNBSocket::%s called", (uint32_t)m_timer.ElapsedMicroSeconds(true), __FUNCTION__);
// Disconnect without saving errno
Modified: lldb/trunk/tools/debugserver/source/RNBSocket.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBSocket.h?rev=196586&r1=196585&r2=196586&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBSocket.h (original)
+++ lldb/trunk/tools/debugserver/source/RNBSocket.h Fri Dec 6 11:46:35 2013
@@ -27,7 +27,7 @@
class RNBSocket
{
public:
- typedef void (*PortBoundCallback) (const void *baton, in_port_t port);
+ typedef void (*PortBoundCallback) (const void *baton, uint16_t port);
RNBSocket () :
m_fd (-1),
@@ -44,7 +44,7 @@ public:
}
rnb_err_t Listen (const char *listen_host,
- in_port_t port,
+ uint16_t port,
PortBoundCallback callback,
const void *callback_baton);
rnb_err_t Connect (const char *host, uint16_t port);
Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=196586&r1=196585&r2=196586&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp Fri Dec 6 11:46:35 2013
@@ -626,7 +626,7 @@ RNBRunLoopPlatform (RNBRemote *remote)
}
static void
-PortWasBoundCallbackNamedPipe (const void *baton, in_port_t port)
+PortWasBoundCallbackNamedPipe (const void *baton, uint16_t port)
{
const char *named_pipe = (const char *)baton;
if (named_pipe && named_pipe[0])
More information about the lldb-commits
mailing list