Fixes building strace - the network types should be reworked to work with the
new syscalls, though. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25075 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
* Ingo Weinhold <[email protected]>
|
* Ingo Weinhold <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// headers required for network structures
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
@@ -15,8 +14,6 @@
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include <net_stack_driver.h>
|
|
||||||
|
|
||||||
#include "Context.h"
|
#include "Context.h"
|
||||||
#include "MemoryReader.h"
|
#include "MemoryReader.h"
|
||||||
#include "TypeHandler.h"
|
#include "TypeHandler.h"
|
||||||
@@ -24,6 +21,7 @@
|
|||||||
using std::map;
|
using std::map;
|
||||||
using std::pair;
|
using std::pair;
|
||||||
|
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
static bool
|
static bool
|
||||||
obtain_pointer_data(Context &context, Type *data, void *address, uint32 what)
|
obtain_pointer_data(Context &context, Type *data, void *address, uint32 what)
|
||||||
@@ -40,6 +38,7 @@ obtain_pointer_data(Context &context, Type *data, void *address, uint32 what)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_number(uint32 value)
|
format_number(uint32 value)
|
||||||
{
|
{
|
||||||
@@ -48,6 +47,7 @@ format_number(uint32 value)
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
read_fdset(Context &context, void *data)
|
read_fdset(Context &context, void *data)
|
||||||
{
|
{
|
||||||
@@ -89,10 +89,11 @@ read_fdset(Context &context, void *data)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string
|
string
|
||||||
TypeHandlerImpl<fd_set *>::GetParameterValue(Context &context, Parameter *,
|
TypeHandlerImpl<fd_set *>::GetParameterValue(Context &context, Parameter *,
|
||||||
const void *address)
|
const void *address)
|
||||||
{
|
{
|
||||||
void *data = *(void **)address;
|
void *data = *(void **)address;
|
||||||
if (data != NULL && context.GetContents(Context::SIMPLE_STRUCTS))
|
if (data != NULL && context.GetContents(Context::SIMPLE_STRUCTS))
|
||||||
@@ -100,6 +101,7 @@ TypeHandlerImpl<fd_set *>::GetParameterValue(Context &context, Parameter *,
|
|||||||
return context.FormatPointer(data);
|
return context.FormatPointer(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
string
|
string
|
||||||
TypeHandlerImpl<fd_set *>::GetReturnValue(Context &context, uint64 value)
|
TypeHandlerImpl<fd_set *>::GetReturnValue(Context &context, uint64 value)
|
||||||
@@ -107,6 +109,7 @@ TypeHandlerImpl<fd_set *>::GetReturnValue(Context &context, uint64 value)
|
|||||||
return context.FormatPointer((void *)value);
|
return context.FormatPointer((void *)value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
static string
|
static string
|
||||||
format_pointer_value(Context &context, void *address)
|
format_pointer_value(Context &context, void *address)
|
||||||
@@ -119,6 +122,7 @@ format_pointer_value(Context &context, void *address)
|
|||||||
return context.FormatPointer(address);
|
return context.FormatPointer(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
get_ipv4_address(in_addr *addr)
|
get_ipv4_address(in_addr *addr)
|
||||||
{
|
{
|
||||||
@@ -131,6 +135,7 @@ get_ipv4_address(in_addr *addr)
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_socket_family(Context &context, int family)
|
format_socket_family(Context &context, int family)
|
||||||
{
|
{
|
||||||
@@ -140,56 +145,61 @@ format_socket_family(Context &context, int family)
|
|||||||
return #family
|
return #family
|
||||||
|
|
||||||
switch (family) {
|
switch (family) {
|
||||||
SOCKET_FAMILY(AF_UNSPEC);
|
SOCKET_FAMILY(AF_UNSPEC);
|
||||||
SOCKET_FAMILY(AF_INET);
|
SOCKET_FAMILY(AF_INET);
|
||||||
SOCKET_FAMILY(AF_APPLETALK);
|
SOCKET_FAMILY(AF_APPLETALK);
|
||||||
SOCKET_FAMILY(AF_ROUTE);
|
SOCKET_FAMILY(AF_ROUTE);
|
||||||
SOCKET_FAMILY(AF_LINK);
|
SOCKET_FAMILY(AF_LINK);
|
||||||
SOCKET_FAMILY(AF_INET6);
|
SOCKET_FAMILY(AF_INET6);
|
||||||
SOCKET_FAMILY(AF_LOCAL);
|
SOCKET_FAMILY(AF_LOCAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "family = " + context.FormatSigned(family);
|
return "family = " + context.FormatSigned(family);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
static string
|
static string
|
||||||
format_socket_type(Context &context, int type)
|
format_socket_type(Context &context, int type)
|
||||||
{
|
{
|
||||||
if (context.GetContents(Context::ENUMERATIONS)) {
|
if (context.GetContents(Context::ENUMERATIONS)) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SOCK_RAW:
|
case SOCK_RAW:
|
||||||
return "SOCK_RAW";
|
return "SOCK_RAW";
|
||||||
case SOCK_DGRAM:
|
case SOCK_DGRAM:
|
||||||
return "SOCK_DGRAM";
|
return "SOCK_DGRAM";
|
||||||
case SOCK_STREAM:
|
case SOCK_STREAM:
|
||||||
return "SOCK_STREAM";
|
return "SOCK_STREAM";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "type = " + context.FormatSigned(type);
|
return "type = " + context.FormatSigned(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_socket_protocol(Context &context, int protocol)
|
format_socket_protocol(Context &context, int protocol)
|
||||||
{
|
{
|
||||||
if (context.GetContents(Context::ENUMERATIONS)) {
|
if (context.GetContents(Context::ENUMERATIONS)) {
|
||||||
switch (protocol) {
|
switch (protocol) {
|
||||||
case IPPROTO_IP:
|
case IPPROTO_IP:
|
||||||
return "IPPROTO_IP";
|
return "IPPROTO_IP";
|
||||||
case IPPROTO_RAW:
|
case IPPROTO_RAW:
|
||||||
return "IPPROTO_RAW";
|
return "IPPROTO_RAW";
|
||||||
case IPPROTO_ICMP:
|
case IPPROTO_ICMP:
|
||||||
return "IPPROTO_ICMP";
|
return "IPPROTO_ICMP";
|
||||||
case IPPROTO_UDP:
|
case IPPROTO_UDP:
|
||||||
return "IPPROTO_UDP";
|
return "IPPROTO_UDP";
|
||||||
case IPPROTO_TCP:
|
case IPPROTO_TCP:
|
||||||
return "IPPROTO_TCP";
|
return "IPPROTO_TCP";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return "protocol = " + context.FormatSigned(protocol);
|
return "protocol = " + context.FormatSigned(protocol);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_pointer(Context &context, sockaddr *saddr)
|
format_pointer(Context &context, sockaddr *saddr)
|
||||||
@@ -201,20 +211,22 @@ format_pointer(Context &context, sockaddr *saddr)
|
|||||||
r = format_socket_family(context, saddr->sa_family) + ", ";
|
r = format_socket_family(context, saddr->sa_family) + ", ";
|
||||||
|
|
||||||
switch (saddr->sa_family) {
|
switch (saddr->sa_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
r += get_ipv4_address(&sin->sin_addr);
|
r += get_ipv4_address(&sin->sin_addr);
|
||||||
r += "/";
|
r += "/";
|
||||||
r += format_number(ntohs(sin->sin_port));
|
r += format_number(ntohs(sin->sin_port));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
r += "...";
|
r += "...";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
static string
|
static string
|
||||||
format_pointer(Context &context, sockaddr_args *args)
|
format_pointer(Context &context, sockaddr_args *args)
|
||||||
{
|
{
|
||||||
@@ -226,6 +238,7 @@ format_pointer(Context &context, sockaddr_args *args)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct socket_option_info {
|
struct socket_option_info {
|
||||||
int level;
|
int level;
|
||||||
int option;
|
int option;
|
||||||
@@ -306,6 +319,7 @@ private:
|
|||||||
|
|
||||||
static const SocketOptionsMap kSocketOptionsMap;
|
static const SocketOptionsMap kSocketOptionsMap;
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_pointer(Context &context, sockopt_args *args)
|
format_pointer(Context &context, sockopt_args *args)
|
||||||
{
|
{
|
||||||
@@ -344,6 +358,7 @@ format_pointer(Context &context, sockopt_args *args)
|
|||||||
return level + ", " + option + ", " + value;
|
return level + ", " + option + ", " + value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_pointer(Context &context, socket_args *args)
|
format_pointer(Context &context, socket_args *args)
|
||||||
{
|
{
|
||||||
@@ -356,6 +371,7 @@ format_pointer(Context &context, socket_args *args)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
get_iovec(Context &context, iovec *iov, int iovlen)
|
get_iovec(Context &context, iovec *iov, int iovlen)
|
||||||
{
|
{
|
||||||
@@ -368,6 +384,7 @@ get_iovec(Context &context, iovec *iov, int iovlen)
|
|||||||
return r + "}";
|
return r + "}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_pointer(Context &context, message_args *msg)
|
format_pointer(Context &context, message_args *msg)
|
||||||
{
|
{
|
||||||
@@ -381,6 +398,7 @@ format_pointer(Context &context, message_args *msg)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_pointer(Context &context, msghdr *h)
|
format_pointer(Context &context, msghdr *h)
|
||||||
{
|
{
|
||||||
@@ -397,6 +415,7 @@ format_pointer(Context &context, msghdr *h)
|
|||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_pointer(Context &context, ifreq *ifr)
|
format_pointer(Context &context, ifreq *ifr)
|
||||||
@@ -404,6 +423,7 @@ format_pointer(Context &context, ifreq *ifr)
|
|||||||
return string(ifr->ifr_name) + ", ...";
|
return string(ifr->ifr_name) + ", ...";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static string
|
static string
|
||||||
format_pointer(Context &context, ifconf *conf)
|
format_pointer(Context &context, ifconf *conf)
|
||||||
{
|
{
|
||||||
@@ -452,10 +472,11 @@ format_pointer(Context &context, ifconf *conf)
|
|||||||
return r + "]";
|
return r + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<typename Type>
|
template<typename Type>
|
||||||
class SpecializedPointerTypeHandler : public TypeHandler {
|
class SpecializedPointerTypeHandler : public TypeHandler {
|
||||||
string GetParameterValue(Context &context, Parameter *,
|
string GetParameterValue(Context &context, Parameter *,
|
||||||
const void *address)
|
const void *address)
|
||||||
{
|
{
|
||||||
return format_pointer_value<Type>(context, *(void **)address);
|
return format_pointer_value<Type>(context, *(void **)address);
|
||||||
}
|
}
|
||||||
@@ -481,8 +502,11 @@ class SpecializedPointerTypeHandler : public TypeHandler {
|
|||||||
DEFINE_TYPE(fdset_ptr, fd_set *);
|
DEFINE_TYPE(fdset_ptr, fd_set *);
|
||||||
POINTER_TYPE(ifconf_ptr, ifconf);
|
POINTER_TYPE(ifconf_ptr, ifconf);
|
||||||
POINTER_TYPE(ifreq_ptr, ifreq);
|
POINTER_TYPE(ifreq_ptr, ifreq);
|
||||||
|
#if 0
|
||||||
POINTER_TYPE(message_args_ptr, message_args);
|
POINTER_TYPE(message_args_ptr, message_args);
|
||||||
POINTER_TYPE(msghdr_ptr, msghdr);
|
POINTER_TYPE(msghdr_ptr, msghdr);
|
||||||
POINTER_TYPE(sockaddr_args_ptr, sockaddr_args);
|
POINTER_TYPE(sockaddr_args_ptr, sockaddr_args);
|
||||||
POINTER_TYPE(sockopt_args_ptr, sockopt_args);
|
POINTER_TYPE(sockopt_args_ptr, sockopt_args);
|
||||||
POINTER_TYPE(socket_args_ptr, socket_args);
|
POINTER_TYPE(socket_args_ptr, socket_args);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user