diff -ru gkrellm-2.2.5/src/client.c gkrellm-2.2.5_inetmem/src/client.c
--- gkrellm-2.2.5/src/client.c	2005-03-19 10:00:16.000000000 -0600
+++ gkrellm-2.2.5_inetmem/src/client.c	2006-03-28 16:32:20.000000000 -0600
@@ -1715,7 +1715,7 @@
 		if (fd >= 0)
 			{
 			memset(&s, 0, sizeof(s));
-			memcpy(&s.sin_addr.s_addr, he->h_addr, he->h_length);
+			memcpy(&s.sin_addr.s_addr, addr->h_addr, addr->h_length);
 			s.sin_family = AF_INET;
 			s.sin_port = htons(server_port);
 			if (connect(fd, (struct sockaddr *)&s, sizeof (s)) < 0)
diff -ru gkrellm-2.2.5/src/inet.c gkrellm-2.2.5_inetmem/src/inet.c
--- gkrellm-2.2.5/src/inet.c	2004-05-14 14:45:14.000000000 -0500
+++ gkrellm-2.2.5_inetmem/src/inet.c	2006-03-28 19:11:48.000000000 -0600
@@ -671,11 +671,15 @@
 				continue;
 			}
 		if (getnameinfo((struct sockaddr *)&ss, salen,
-					hbuf, sizeof(hbuf), NULL, 0, flag))
-			continue;
-		snprintf(buf, sizeof(buf), "%6d:  %s\n",
-					tcp->local_port, hbuf);
-#else
+					hbuf, sizeof(hbuf), NULL, 0, flag)){
+			snprintf(buf, sizeof(buf),
+				 "%6d:  %s\n", tcp->local_port,
+				 inet_ntoa(tcp->remote_addr));            
+        }else{
+   		   snprintf(buf, sizeof(buf), "%6d:  %s\n", 
+	   				tcp->local_port, hbuf);
+        }
+ #else
 		hostent = gethostbyaddr((char *) &tcp->remote_addr,
 					sizeof(struct in_addr), AF_INET);
 		if (hostent)
diff -ru gkrellm-2.2.5/src/sysdeps/darwin.c gkrellm-2.2.5_inetmem/src/sysdeps/darwin.c
--- gkrellm-2.2.5/src/sysdeps/darwin.c	2006-03-28 16:47:49.000000000 -0600
+++ gkrellm-2.2.5_inetmem/src/sysdeps/darwin.c	2006-03-28 16:36:39.000000000 -0600
@@ -397,16 +397,115 @@
 
 /* ===================================================================== */
 /* Inet monitor interface - not implemented */
+#include "../inet.h"
+
+#include <net/route.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#ifdef INET6
+#include <netinet/ip6.h>
+#endif /* INET6 */
+#include <netinet/in_pcb.h>
+#include <netinet/ip_icmp.h>
+#include <netinet/icmp_var.h>
+#include <netinet/igmp_var.h>
+#include <netinet/ip_var.h>
+#include <netinet/tcp.h>
+#include <netinet/tcpip.h>
+#include <netinet/tcp_seq.h>
+#define TCPSTATES
+#include <netinet/tcp_fsm.h>
+#include <netinet/tcp_var.h>
+#include <netinet/udp.h>
+#include <netinet/udp_var.h>
+#include <sys/types.h>
+
+#define warn(x...) fprintf(stderr,x)
 
 void
 gkrellm_sys_inet_read_tcp_data(void)
-	{
+{
+	ActiveTCP	tcp;
+    const char *mibvar="net.inet.tcp.pcblist";
+	char *buf;
+	struct tcpcb *tp = NULL;
+	struct inpcb *inp;
+	struct xinpgen *xig, *oxig;
+	struct xsocket *so;
+	size_t len=0;
+	if (sysctlbyname(mibvar, 0, &len, 0, 0) < 0) {
+		if (errno != ENOENT)
+			warn("sysctl: %s", mibvar);
+		return;
+	}        
+	if ((buf = malloc(len)) == 0) {
+		warn("malloc %lu bytes", (u_long)len);
+		return;
 	}
+	if (sysctlbyname(mibvar, buf, &len, 0, 0) < 0) {
+		warn("sysctl: %s", mibvar);
+		free(buf);
+		return;
+	}
+     /*
+         * Bail-out to avoid logic error in the loop below when
+         * there is in fact no more control block to process
+         */
+        if (len <= sizeof(struct xinpgen)) {
+            free(buf);
+            return;
+        }
+ 	oxig = xig = (struct xinpgen *)buf;
+	for (xig = (struct xinpgen *)((char *)xig + xig->xig_len);
+	     xig->xig_len > sizeof(struct xinpgen);
+	     xig = (struct xinpgen *)((char *)xig + xig->xig_len)) {
+    	tp = &((struct xtcpcb *)xig)->xt_tp;
+	   	inp = &((struct xtcpcb *)xig)->xt_inp;
+		so = &((struct xtcpcb *)xig)->xt_socket;
+    if (so->xso_protocol != IPPROTO_TCP)
+ 			continue;
+		/* Ignore PCBs which were freed during copyout. */
+		if (inp->inp_gencnt > oxig->xig_gen)
+			continue;
+		if ((inp->inp_vflag & INP_IPV4) == 0
+#ifdef INET6
+		    && (inp->inp_vflag & INP_IPV6) == 0
+#endif /* INET6 */
+			)
+			continue;
+                /*
+                 * Local address is not an indication of listening socket or
+                 * server sockey but just rather the socket has been bound.
+                 * That why many UDP sockets were not displayed in the original code.
+                 */
+                if (tp->t_state <= TCPS_LISTEN){
+                    continue;
+                    }
+			if (inp->inp_vflag & INP_IPV4) {
+			     tcp.local_port=ntohs(inp->inp_lport);
+			     tcp.remote_addr.s_addr=(uint32_t)inp->inp_faddr.s_addr;
+			     tcp.remote_port=ntohs(inp->inp_fport);
+			     tcp.family=AF_INET;
+			     gkrellm_inet_log_tcp_port_data(&tcp);
+            }
+#ifdef INET6
+			else if (inp->inp_vflag & INP_IPV6) {
+			     tcp.local_port=ntohs(inp->inp_lport);
+    			 memcpy(&(tcp.remote_addr6),&(inp->in6p_faddr),sizeof(struct in6_addr));
+			     tcp.remote_port=ntohs(inp->inp_fport);
+			     tcp.family=AF_INET;
+			     gkrellm_inet_log_tcp_port_data(&tcp);
+			} /* else nothing printed now */
+#endif /* INET6 */
+}  
+free(buf);
+}
 
 gboolean
 gkrellm_sys_inet_init(void)
 	{
-	return FALSE;
+	return TRUE;
 	}
 
 
@@ -453,12 +552,12 @@
 			pshift++;
 	}
 	
-	used = (vm_info.active_count + vm_info.inactive_count + vm_info.wire_count) << pshift;
+	used = (vm_info.wire_count +vm_info.active_count)<< pshift;
 	free = vm_info.free_count << pshift;	
 	total = (vm_info.active_count + vm_info.inactive_count + vm_info.free_count + vm_info.wire_count) << pshift;
 	/* Don't know how to get cached or buffers. */
-	buffers = 0;
-	cached = 0;
+	buffers = 0;// vm_info.active_count << pshift;
+	cached =  vm_info.inactive_count << pshift;
 	/* shared  0 for now, shared is a PITA */
         shared = 0;	
 	gkrellm_mem_assign_data(total, used, free, shared, buffers, cached);


# Darwin 7.8 doesn't have (or require) libmd5.  I'm not sure when this occurred,
# so I don't know whether just removing it or creating a new "darwin7.8" or
# somesuch target is the right thing to do.
diff -ur gkrellm-2.2.4/Makefile gkrellm-2.2.4.patched/Makefile
--- gkrellm-2.2.4/Makefile	Mon Sep  6 18:32:40 2004
+++ gkrellm-2.2.4.patched/Makefile	Wed Mar 23 17:18:37 2005
@@ -195,11 +195,11 @@
 darwin: gkrellm.pc
 	(cd po && ${MAKE} all)
 	(cd src && ${MAKE} GTK_CONFIG=gtk-config STRIP= \
-		EXTRAOBJS= SYS_LIBS="-lkvm -lmd5 -framework IOKit" \
+		EXTRAOBJS= SYS_LIBS="-lkvm -framework IOKit" \
 		LINK_FLAGS="-prebind -Wl,-bind_at_load -framework CoreFoundation -lX11" \
 		gkrellm )
 	(cd server && ${MAKE} GTK_CONFIG=gtk-config STRIP= \
-		EXTRAOBJS= SYS_LIBS="-lkvm -lmd5 -framework IOKit" \
+		EXTRAOBJS= SYS_LIBS="-lkvm -framework IOKit" \
 		LINK_FLAGS="-prebind -Wl,-bind_at_load -framework CoreFoundation" \
 		gkrellmd )
 
# Two changes here:
#   (gkrellm_sys_proc_read_data): Change integer type to shut up compiler warnings.
#   (gkrellm_sys_disk_init): Reshuffle code a bit to tolerate failures for some
#     of the IOKit entries returned.  On one of my systems, the first entry
#     returned by IOIteratorNext caused a "no such device" error; with the original
#     code, all subsequent iterations would fail as well because 'status' was
#     never reset, even though subsequent items returned by IOIteratorNext were
#     valid.  The new execution path risks running through the loop several times
#     even if one of the IOKit calls returns a "general" error, but I don't see
#     that this would do any harm, nor do I see a good way to make the distinction
#     programmatically.
#     I also bail out early if we can't even get a device iterator.
diff -ur gkrellm-2.2.4/src/sysdeps/darwin.c gkrellm-2.2.4.patched/src/sysdeps/darwin.c
--- gkrellm-2.2.4/src/sysdeps/darwin.c	Sat May  1 13:46:38 2004
+++ gkrellm-2.2.4.patched/src/sysdeps/darwin.c	Wed Mar 23 18:01:55 2005
@@ -153,7 +153,7 @@
 	static u_int	n_processes, n_forks = 0, curpid = -1;
 	u_int		n_vforks, n_rforks;
 	gint		r_forks, r_vforks, r_rforks;
-	gint		len;
+	size_t		len;
 	gint		nextpid, nforked;
 	static struct nlist nl[] = {
 #define N_NEXTPID	0
@@ -350,32 +350,33 @@
 gboolean
 gkrellm_sys_disk_init(void)
     {
-    kern_return_t status = 0;
     io_registry_entry_t drive      = 0;  /* needs release */
     io_registry_entry_t child      = 0;  /* needs release */
     
     /* get ports and services for drive stats */
     /* Obtain the I/O Kit communication handle */
-    status = IOMasterPort(MACH_PORT_NULL, &masterPort);
+    if (IOMasterPort(MACH_PORT_NULL, &masterPort)) return FALSE;
 
     /* Obtain the list of all drive objects */
-    status = IOServiceGetMatchingServices(masterPort,
-                                            IOServiceMatching("IOBlockStorageDriver"),
-                                            &drivelist);                      
+    if (IOServiceGetMatchingServices(masterPort,
+				     IOServiceMatching("IOBlockStorageDriver"),
+				     &drivelist))
+      return FALSE;
+
     while ( (drive = IOIteratorNext(drivelist)) )
     {
         gchar * name = malloc(128); /* io_name_t is char[128] */
+	kern_return_t status = 0;
         int ptr = 0;
    		
    		if(!name) return FALSE;
    		
         /* Obtain the properties for this drive object */           
+	status = IORegistryEntryGetChildEntry(drive, kIOServicePlane, &child );
+
         if(!status)
-        status = IORegistryEntryGetChildEntry(drive, kIOServicePlane, &child );
-        
-        if(!status)
-        status = IORegistryEntryGetName(child, name );
-        
+	status = IORegistryEntryGetName(child, name );
+
         /* Convert spaces to underscores, for prefs safety */
         if(!status)
         {
@@ -384,13 +385,13 @@
                 if(name[ptr] == ' ') 
                     name[ptr] = '_';
             }
-           disk_list = g_list_append(disk_list, name);
+            disk_list = g_list_append(disk_list, name);
         }
         IOObjectRelease(drive); drive = 0;
     }
     IOIteratorReset(drivelist);
     
-	return (disk_list != NULL) ? TRUE : FALSE;
+    return (disk_list != NULL) ? TRUE : FALSE;
 }
 
 

## End of patch ##
