*** empty log message ***
This commit is contained in:
@@ -28,25 +28,25 @@
|
||||
|
||||
BEGIN_LIBGTOP_DECLS
|
||||
|
||||
#define GLIBTOP_IMPL_CPU (1 << GLIBTOP_SYSDEPS_CPU)
|
||||
#define GLIBTOP_IMPL_MEM (1 << GLIBTOP_SYSDEPS_MEM)
|
||||
#define GLIBTOP_IMPL_SWAP (1 << GLIBTOP_SYSDEPS_SWAP)
|
||||
#define GLIBTOP_IMPL_UPTIME (1 << GLIBTOP_SYSDEPS_UPTIME)
|
||||
#define GLIBTOP_IMPL_LOADAVG (1 << GLIBTOP_SYSDEPS_LOADAVG)
|
||||
#define GLIBTOP_IMPL_CPU (1L << GLIBTOP_SYSDEPS_CPU)
|
||||
#define GLIBTOP_IMPL_MEM (1L << GLIBTOP_SYSDEPS_MEM)
|
||||
#define GLIBTOP_IMPL_SWAP (1L << GLIBTOP_SYSDEPS_SWAP)
|
||||
#define GLIBTOP_IMPL_UPTIME (1L << GLIBTOP_SYSDEPS_UPTIME)
|
||||
#define GLIBTOP_IMPL_LOADAVG (1L << GLIBTOP_SYSDEPS_LOADAVG)
|
||||
#define GLIBTOP_IMPL_SHM_LIMITS 0
|
||||
#define GLIBTOP_IMPL_MSG_LIMITS 0
|
||||
#define GLIBTOP_IMPL_SEM_LIMITS 0
|
||||
#define GLIBTOP_IMPL_PROCLIST (1 << GLIBTOP_SYSDEPS_PROCLIST)
|
||||
#define GLIBTOP_IMPL_PROC_STATE (1 << GLIBTOP_SYSDEPS_PROC_STATE)
|
||||
#define GLIBTOP_IMPL_PROC_UID (1 << GLIBTOP_SYSDEPS_PROC_UID)
|
||||
#define GLIBTOP_IMPL_PROC_MEM (1 << GLIBTOP_SYSDEPS_PROC_MEM)
|
||||
#define GLIBTOP_IMPL_PROC_TIME (1 << GLIBTOP_SYSDEPS_PROC_TIME)
|
||||
#define GLIBTOP_IMPL_PROC_SIGNAL (1 << GLIBTOP_SYSDEPS_PROC_SIGNAL)
|
||||
#define GLIBTOP_IMPL_PROC_KERNEL (1 << GLIBTOP_SYSDEPS_PROC_KERNEL)
|
||||
#define GLIBTOP_IMPL_PROC_SEGMENT (1 << GLIBTOP_SYSDEPS_PROC_SEGMENT)
|
||||
#define GLIBTOP_IMPL_PROC_ARGS (1 << GLIBTOP_SYSDEPS_PROC_ARGS)
|
||||
#define GLIBTOP_IMPL_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP)
|
||||
#define GLIBTOP_IMPL_NETLOAD (1 << GLIBTOP_SYSDEPS_NETLOAD)
|
||||
#define GLIBTOP_IMPL_PROCLIST (1L << GLIBTOP_SYSDEPS_PROCLIST)
|
||||
#define GLIBTOP_IMPL_PROC_STATE (1L << GLIBTOP_SYSDEPS_PROC_STATE)
|
||||
#define GLIBTOP_IMPL_PROC_UID (1L << GLIBTOP_SYSDEPS_PROC_UID)
|
||||
#define GLIBTOP_IMPL_PROC_MEM (1L << GLIBTOP_SYSDEPS_PROC_MEM)
|
||||
#define GLIBTOP_IMPL_PROC_TIME (1L << GLIBTOP_SYSDEPS_PROC_TIME)
|
||||
#define GLIBTOP_IMPL_PROC_SIGNAL (1L << GLIBTOP_SYSDEPS_PROC_SIGNAL)
|
||||
#define GLIBTOP_IMPL_PROC_KERNEL (1L << GLIBTOP_SYSDEPS_PROC_KERNEL)
|
||||
#define GLIBTOP_IMPL_PROC_SEGMENT (1L << GLIBTOP_SYSDEPS_PROC_SEGMENT)
|
||||
#define GLIBTOP_IMPL_PROC_ARGS (1L << GLIBTOP_SYSDEPS_PROC_ARGS)
|
||||
#define GLIBTOP_IMPL_PROC_MAP (1L << GLIBTOP_SYSDEPS_PROC_MAP)
|
||||
#define GLIBTOP_IMPL_NETLOAD (1L << GLIBTOP_SYSDEPS_NETLOAD)
|
||||
#define GLIBTOP_IMPL_NETINFO 0
|
||||
#define GLIBTOP_IMPL_INTERFACE_NAMES 0
|
||||
#define GLIBTOP_IMPL_PPP 0
|
||||
|
@@ -82,7 +82,7 @@ glibtop_init_netinfo_s (glibtop *server)
|
||||
|
||||
static int
|
||||
_netinfo_ipv4 (glibtop *server, glibtop_netinfo *buf,
|
||||
const char *interface)
|
||||
const char *interface, int only_common)
|
||||
{
|
||||
int skfd;
|
||||
|
||||
@@ -91,8 +91,10 @@ _netinfo_ipv4 (glibtop *server, glibtop_netinfo *buf,
|
||||
struct ifreq ifr;
|
||||
unsigned flags;
|
||||
|
||||
if (!only_common) {
|
||||
buf->transport = GLIBTOP_TRANSPORT_IPV4;
|
||||
buf->flags |= (1L << GLIBTOP_NETINFO_TRANSPORT);
|
||||
}
|
||||
|
||||
strcpy (ifr.ifr_name, interface);
|
||||
if (!ioctl (skfd, SIOCGIFFLAGS, &ifr)) {
|
||||
@@ -131,6 +133,7 @@ _netinfo_ipv4 (glibtop *server, glibtop_netinfo *buf,
|
||||
if (flags & IFF_MULTICAST)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_MULTICAST);
|
||||
|
||||
if (!only_common) {
|
||||
strcpy (ifr.ifr_name, interface);
|
||||
if (!ioctl (skfd, SIOCGIFADDR, &ifr)) {
|
||||
struct sockaddr_in addr =
|
||||
@@ -146,6 +149,7 @@ _netinfo_ipv4 (glibtop *server, glibtop_netinfo *buf,
|
||||
memcpy (&buf->subnet, &addr.sin_addr.s_addr, 4);
|
||||
buf->flags |= (1L << GLIBTOP_NETINFO_SUBNET);
|
||||
}
|
||||
}
|
||||
|
||||
strcpy (ifr.ifr_name, interface);
|
||||
if (!ioctl (skfd, SIOCGIFMTU, &ifr)) {
|
||||
@@ -204,9 +208,15 @@ _netinfo_ipv6 (glibtop *server, glibtop_netinfo *buf,
|
||||
{
|
||||
FILE *f;
|
||||
char addr6[40], devname[20];
|
||||
struct sockaddr_in6 sap;
|
||||
int plen, scope, dad_status, if_idx;
|
||||
extern struct aftype inet6_aftype;
|
||||
|
||||
#ifdef HAVE_AFINET6
|
||||
/* get common things such as mtu and if_flags */
|
||||
_netinfo_ipv4 (server, buf, interface, 1);
|
||||
#endif
|
||||
|
||||
buf->transport = GLIBTOP_TRANSPORT_IPV6;
|
||||
buf->flags |= (1L << GLIBTOP_NETINFO_TRANSPORT);
|
||||
|
||||
if ((f = fopen (_PATH_PROCNET_IFINET6, "r")) != NULL) {
|
||||
while (fscanf (f, "%64s %02x %02x %02x %02x %20s\n",
|
||||
@@ -222,6 +232,8 @@ _netinfo_ipv6 (glibtop *server, glibtop_netinfo *buf,
|
||||
}
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -274,7 +286,7 @@ glibtop_get_netinfo_s (glibtop *server, glibtop_netinfo *buf,
|
||||
switch (transport) {
|
||||
#ifdef HAVE_AFINET
|
||||
case GLIBTOP_TRANSPORT_IPV4:
|
||||
return _netinfo_ipv4 (server, buf, interface);
|
||||
return _netinfo_ipv4 (server, buf, interface, 0);
|
||||
#endif /* HAVE_AFINET */
|
||||
#ifdef HAVE_AFINET6
|
||||
case GLIBTOP_TRANSPORT_IPV6:
|
||||
|
Reference in New Issue
Block a user