# 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 ##