diff --git a/src/os/hpux/hpux_sigar.c b/src/os/hpux/hpux_sigar.c index 8da1d4f1..94550395 100644 --- a/src/os/hpux/hpux_sigar.c +++ b/src/os/hpux/hpux_sigar.c @@ -842,8 +842,8 @@ static int net_conn_get_udp_listen(sigar_t *sigar, } for (i=0; idata[connlist->number++]; @@ -918,8 +918,8 @@ static int net_conn_get_tcp(sigar_t *sigar, } for (i=0; iState; if (!(IS_TCP_SERVER(state, flags) || @@ -928,61 +928,60 @@ static int net_conn_get_tcp(sigar_t *sigar, continue; } + SIGAR_NET_CONNLIST_GROW(connlist); + conn = &connlist->data[connlist->number++]; + switch (state) { case TCCLOSED: - conn.state = SIGAR_TCP_CLOSE; + conn->state = SIGAR_TCP_CLOSE; break; case TCLISTEN: - conn.state = SIGAR_TCP_LISTEN; + conn->state = SIGAR_TCP_LISTEN; break; case TCSYNSENT: - conn.state = SIGAR_TCP_SYN_SENT; + conn->state = SIGAR_TCP_SYN_SENT; break; case TCSYNRECEIVE: - conn.state = SIGAR_TCP_SYN_RECV; + conn->state = SIGAR_TCP_SYN_RECV; break; case TCESTABLISED: - conn.state = SIGAR_TCP_ESTABLISHED; + conn->state = SIGAR_TCP_ESTABLISHED; break; case TCFINWAIT1: - conn.state = SIGAR_TCP_FIN_WAIT1; + conn->state = SIGAR_TCP_FIN_WAIT1; break; case TCFINWAIT2: - conn.state = SIGAR_TCP_FIN_WAIT2; + conn->state = SIGAR_TCP_FIN_WAIT2; break; case TCCLOSEWAIT: - conn.state = SIGAR_TCP_CLOSE_WAIT; + conn->state = SIGAR_TCP_CLOSE_WAIT; break; case TCCLOSING: - conn.state = SIGAR_TCP_CLOSING; + conn->state = SIGAR_TCP_CLOSING; break; case TCLASTACK: - conn.state = SIGAR_TCP_LAST_ACK; + conn->state = SIGAR_TCP_LAST_ACK; break; case TCTIMEWAIT: - conn.state = SIGAR_TCP_TIME_WAIT; + conn->state = SIGAR_TCP_TIME_WAIT; break; case TCDELETETCB: default: - conn.state = SIGAR_TCP_UNKNOWN; + conn->state = SIGAR_TCP_UNKNOWN; break; } - conn.local_port = (unsigned short)entry->LocalPort; - conn.remote_port = (unsigned short)entry->RemPort; - conn.type = SIGAR_NETCONN_TCP; + conn->local_port = (unsigned short)entry->LocalPort; + conn->remote_port = (unsigned short)entry->RemPort; + conn->type = SIGAR_NETCONN_TCP; sigar_inet_ntoa(sigar, entry->LocalAddress, - conn.local_address); + conn->local_address); sigar_inet_ntoa(sigar, entry->RemAddress, - conn.remote_address); + conn->remote_address); - conn.send_queue = conn.receive_queue = SIGAR_FIELD_NOTIMPL; - - SIGAR_NET_CONNLIST_GROW(connlist); - memcpy(&connlist->data[connlist->number++], - &conn, sizeof(conn)); + conn->send_queue = conn->receive_queue = SIGAR_FIELD_NOTIMPL; } free(entries);