Allow libgtop2 to build on older versions of FreeBSD, and #ifdef a variable
to prevent a compiler warning while I'm here.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
--- sysdeps/freebsd/netload.c.orig Wed May 3 02:13:41 2006
|
||||
+++ sysdeps/freebsd/netload.c Wed May 3 02:37:57 2006
|
||||
--- sysdeps/freebsd/netload.c.orig Mon Dec 12 05:09:39 2005
|
||||
+++ sysdeps/freebsd/netload.c Wed May 3 13:46:08 2006
|
||||
@@ -28,6 +28,8 @@
|
||||
|
||||
#include <glibtop_suid.h>
|
||||
@@ -9,16 +9,20 @@
|
||||
#include <net/if.h>
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_types.h>
|
||||
@@ -83,7 +85,7 @@
|
||||
@@ -83,9 +85,11 @@ glibtop_get_netload_p (glibtop *server,
|
||||
const char *interface)
|
||||
{
|
||||
struct ifnet ifnet;
|
||||
- u_long ifnetaddr, ifnetfound, ifaddraddr;
|
||||
+ u_long ifnetaddr, ifnetfound;
|
||||
struct sockaddr *sa = NULL;
|
||||
+#if (defined(__FreeBSD__) && (__FreeBSD_version < 501113)) || defined(__bsdi__)
|
||||
char tname [16];
|
||||
+#endif
|
||||
char name [32];
|
||||
@@ -101,12 +103,12 @@
|
||||
|
||||
union {
|
||||
@@ -101,12 +105,12 @@ glibtop_get_netload_p (glibtop *server,
|
||||
&ifnetaddr, sizeof (ifnetaddr)) != sizeof (ifnetaddr))
|
||||
glibtop_error_io_r (server, "kvm_read (ifnet)");
|
||||
|
||||
@@ -34,25 +38,31 @@
|
||||
ifnetfound = ifnetaddr;
|
||||
|
||||
if (kvm_read (server->machine.kd, ifnetaddr, &ifnet,
|
||||
@@ -151,7 +153,7 @@
|
||||
@@ -151,7 +155,11 @@ glibtop_get_netload_p (glibtop *server,
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK);
|
||||
if (ifnet.if_flags & IFF_POINTOPOINT)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT);
|
||||
- if (ifnet.if_flags & IFF_RUNNING)
|
||||
+#ifdef IFF_DRV_RUNNING
|
||||
+ if (ifnet.if_drv_flags & IFF_DRV_RUNNING)
|
||||
+#else
|
||||
if (ifnet.if_flags & IFF_RUNNING)
|
||||
+#endif
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING);
|
||||
if (ifnet.if_flags & IFF_NOARP)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP);
|
||||
@@ -159,7 +161,7 @@
|
||||
@@ -159,7 +167,11 @@ glibtop_get_netload_p (glibtop *server,
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC);
|
||||
if (ifnet.if_flags & IFF_ALLMULTI)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI);
|
||||
- if (ifnet.if_flags & IFF_OACTIVE)
|
||||
+#ifdef IFF_DRV_OACTIVE
|
||||
+ if (ifnet.if_drv_flags & IFF_DRV_OACTIVE)
|
||||
+#else
|
||||
if (ifnet.if_flags & IFF_OACTIVE)
|
||||
+#endif
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_OACTIVE);
|
||||
if (ifnet.if_flags & IFF_SIMPLEX)
|
||||
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_SIMPLEX);
|
||||
@@ -191,7 +193,7 @@
|
||||
@@ -191,7 +203,7 @@ glibtop_get_netload_p (glibtop *server,
|
||||
buf->collisions = ifnet.if_collisions;
|
||||
buf->flags = _glibtop_sysdeps_netload;
|
||||
|
||||
@@ -61,7 +71,7 @@
|
||||
if ((kvm_read (server->machine.kd, ifaddraddr, &ifaddr,
|
||||
sizeof (ifaddr)) != sizeof (ifaddr)))
|
||||
glibtop_error_io_r (server, "kvm_read (ifaddraddr)");
|
||||
@@ -201,7 +203,12 @@
|
||||
@@ -201,7 +213,12 @@ glibtop_get_netload_p (glibtop *server,
|
||||
CP(&ifaddr);
|
||||
sa = (struct sockaddr *)cp;
|
||||
|
||||
@@ -75,7 +85,7 @@
|
||||
sin = (struct sockaddr_in *)sa;
|
||||
#if !defined(__bsdi__)
|
||||
/* Commenting out to "fix" #13345. */
|
||||
@@ -211,8 +218,14 @@
|
||||
@@ -211,8 +228,14 @@ glibtop_get_netload_p (glibtop *server,
|
||||
buf->mtu = ifnet.if_mtu;
|
||||
|
||||
buf->flags |= _glibtop_sysdeps_netload_data;
|
||||
|
||||
Reference in New Issue
Block a user