diff options
author | Joe Marcus Clarke <marcus@FreeBSD.org> | 2004-02-07 04:49:34 +0000 |
---|---|---|
committer | Joe Marcus Clarke <marcus@FreeBSD.org> | 2004-02-07 04:49:34 +0000 |
commit | d336d4435c8c5f4b4d5edec13b95f2f277c17535 (patch) | |
tree | 4dbb1ebd6473900c907ba2b43a7c9a026842fcac /x11-wm/epplets | |
parent | 6286cff9f72964035e7ceb645bf0cdaf54eaef14 (diff) | |
download | ports-d336d4435c8c5f4b4d5edec13b95f2f277c17535.tar.gz ports-d336d4435c8c5f4b4d5edec13b95f2f277c17535.zip |
Notes
Diffstat (limited to 'x11-wm/epplets')
-rw-r--r-- | x11-wm/epplets/Makefile | 3 | ||||
-rw-r--r-- | x11-wm/epplets/files/patch-epplets::E-Cpu.c | 92 | ||||
-rw-r--r-- | x11-wm/epplets/files/patch-epplets::E-Load.c | 75 | ||||
-rw-r--r-- | x11-wm/epplets/files/patch-epplets::E-Net.c | 36 | ||||
-rw-r--r-- | x11-wm/epplets/files/patch-epplets::Makefile.in | 33 | ||||
-rw-r--r-- | x11-wm/epplets/files/patch-epplets::net.c | 247 |
6 files changed, 18 insertions, 468 deletions
diff --git a/x11-wm/epplets/Makefile b/x11-wm/epplets/Makefile index c6ffadcf8852..4453e47e4ed1 100644 --- a/x11-wm/epplets/Makefile +++ b/x11-wm/epplets/Makefile @@ -7,7 +7,7 @@ PORTNAME= epplets PORTVERSION= 0.7 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= x11-wm MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITE_SUBDIR= enlightenment @@ -17,7 +17,6 @@ COMMENT= A collection of Enlightenment dock applications BUILD_DEPENDS= enlightenment:${PORTSDIR}/x11-wm/enlightenment LIB_DEPENDS= cdaudio.1:${PORTSDIR}/audio/libcdaudio \ - gtop.1:${PORTSDIR}/devel/libgtop \ epplet.1:${PORTSDIR}/x11-wm/libepplet RUN_DEPENDS= import:${PORTSDIR}/graphics/ImageMagick \ enlightenment:${PORTSDIR}/x11-wm/enlightenment diff --git a/x11-wm/epplets/files/patch-epplets::E-Cpu.c b/x11-wm/epplets/files/patch-epplets::E-Cpu.c deleted file mode 100644 index 513f4fd2aaa3..000000000000 --- a/x11-wm/epplets/files/patch-epplets::E-Cpu.c +++ /dev/null @@ -1,92 +0,0 @@ ---- epplets/E-Cpu.c.orig Wed Dec 29 06:08:09 1999 -+++ epplets/E-Cpu.c Wed Aug 1 12:10:17 2001 -@@ -7,10 +7,23 @@ - #include "config.h" - #include "epplet.h" - --#ifdef HAVE_LIBGTOP -+#ifdef __FreeBSD__ -+ -+#include <sys/sysctl.h> -+#include <sys/dkstat.h> -+ -+#ifndef KERN_CP_TIME -+#define KERN_CP_TIME 106 -+#endif -+ -+int cpu_old[CPUSTATES]; -+ -+#elif defined(HAVE_LIBGTOP) -+ - #include <glibtop.h> - #include <glibtop/cpu.h> - #include "proc.h" -+ - #endif - - int cpus = 0; -@@ -201,7 +214,33 @@ - static void - cb_timer(void *data) - { --#ifdef HAVE_LIBGTOP -+#ifdef __FreeBSD__ -+ -+ int cpu_new[CPUSTATES]; -+ int i, total, mib[2]; -+ size_t cpu_size; -+ double val; -+ -+ mib[0] = CTL_KERN; -+ mib[1] = KERN_CP_TIME; -+ cpu_size = sizeof(cpu_new); -+ -+ if(sysctl(mib, 2, cpu_new, &cpu_size, NULL, 0) == 0) -+ { -+ total=0; -+ for(i=0;i<CPUSTATES;i++) -+ total += cpu_new[i] - cpu_old[i]; -+ -+ val = 100.00 - (double)(cpu_new[CP_IDLE]-cpu_old[CP_IDLE])/total*100; -+ -+ for(i=0;i<CPUSTATES;i++) -+ cpu_old[i] = cpu_new[i]; -+ -+ for(i=0;i<cpus;i++) -+ prev_val[i] = load_val[i] = val; -+ } -+ -+#elif HAVE_LIBGTOP - - glibtop_cpu cpu; - double val, val2; -@@ -322,13 +361,27 @@ - static int - count_cpus(void) - { --#ifdef HAVE_LIBGTOP -+#ifdef __FreeBSD__ -+ -+ int ncpu, mib[2]; -+ size_t size; -+ -+ mib[0] = CTL_HW; -+ mib[1] = HW_NCPU; -+ size = sizeof(ncpu); -+ -+ if(sysctl(mib, 2, &ncpu, &size, NULL, 0) == -1) -+ return 1; -+ -+ return ncpu; -+ -+#elif defined(HAVE_LIBGTOP) - int i,c = 0; - int bits; - glibtop_cpu cpu; - - glibtop_get_cpu (&cpu); -- bits= (int)cpu.xcpu_flags; -+ bits= (int)cpu.flags; - for (i=0; i<GLIBTOP_NCPU; i++) { - c += bits&1; - /* printf ("%d: %o - %d\n",i,bits,c ); */ diff --git a/x11-wm/epplets/files/patch-epplets::E-Load.c b/x11-wm/epplets/files/patch-epplets::E-Load.c deleted file mode 100644 index ba9cd874c724..000000000000 --- a/x11-wm/epplets/files/patch-epplets::E-Load.c +++ /dev/null @@ -1,75 +0,0 @@ ---- epplets/E-Load.c.orig Fri Nov 19 13:46:24 1999 -+++ epplets/E-Load.c Fri Aug 3 18:45:55 2001 -@@ -1,11 +1,17 @@ - #include "config.h" - #include "epplet.h" - --#ifdef HAVE_LIBGTOP -+#ifdef __FreeBSD__ -+ -+#include <sys/sysctl.h> -+ -+#elif defined(HAVE_LIBGTOP) -+ - #include <glibtop.h> - #include <glibtop/loadavg.h> - #include <glibtop/cpu.h> - #include "proc.h" -+ - #endif - - int cpus = 0; -@@ -20,7 +26,22 @@ - static void - cb_timer(void *data) - { --#ifdef HAVE_LIBGTOP -+#ifdef __FreeBSD__ -+ -+ double val; -+ -+ if(getloadavg(&val, 1) == -1) -+ return; -+ -+ val *= 20; -+ -+ if(val > 100) -+ val = 100; -+ -+ load_val[0] = val; -+ Epplet_gadget_data_changed(load[0]); -+ -+#elif defined(HAVE_LIBGTOP) - - /* libgtop only handles total load, not per-CPU load */ - -@@ -89,13 +110,27 @@ - int - count_cpus(void) - { --#ifdef HAVE_LIBGTOP -+#ifdef __FreeBSD__ -+ -+ int ncpu, mib[2]; -+ size_t size; -+ -+ mib[0] = CTL_HW; -+ mib[1] = HW_NCPU; -+ size = sizeof(ncpu); -+ -+ if(sysctl(mib, 2, &ncpu, &size, NULL, 0) == -1) -+ return 1; -+ -+ return ncpu; -+ -+#elif HAVE_LIBGTOP - int i,c = 0; - int bits; - glibtop_cpu cpu; - - glibtop_get_cpu (&cpu); -- bits= (int)cpu.xcpu_flags; -+ bits= (int)cpu.flags; - for (i=0; i<GLIBTOP_NCPU; i++) { - c += bits&1; - /* printf ("%d: %o - %d\n",i,bits,c ); */ diff --git a/x11-wm/epplets/files/patch-epplets::E-Net.c b/x11-wm/epplets/files/patch-epplets::E-Net.c deleted file mode 100644 index 1fdecf40cef1..000000000000 --- a/x11-wm/epplets/files/patch-epplets::E-Net.c +++ /dev/null @@ -1,36 +0,0 @@ ---- epplets/E-Net.c.orig Wed Aug 1 19:46:50 2001 -+++ epplets/E-Net.c Wed Aug 1 19:52:34 2001 -@@ -14,6 +14,7 @@ - - double upstream_max = 1540000; - double downstream_max = 1540000; -+char *netdev; - int up_val = 0; - int down_val = 0; - double up_last = 0; -@@ -34,7 +35,7 @@ - double val = -1.0, val2 = -1.0, dval, dval2; - unsigned char invalid; - -- invalid = net_get_bytes_inout("eth0", &val, &val2); -+ invalid = net_get_bytes_inout(netdev, &val, &val2); - if (invalid) - { - char err[255]; -@@ -74,6 +75,7 @@ - Epplet_modify_config("upstream_max", s); - Esnprintf(s, sizeof(s), "%f", downstream_max); - Epplet_modify_config("downstream_max", s); -+ Epplet_modify_config("device", netdev); - Epplet_save_config(); - } - -@@ -87,6 +89,8 @@ - - s = Epplet_query_config_def("downstream_max", "1540000"); - downstream_max = (double)atof(s); -+ -+ netdev = Epplet_query_config_def("device", "eth0"); - } - - static void diff --git a/x11-wm/epplets/files/patch-epplets::Makefile.in b/x11-wm/epplets/files/patch-epplets::Makefile.in index f80ea8952b60..f4658bdb3efa 100644 --- a/x11-wm/epplets/files/patch-epplets::Makefile.in +++ b/x11-wm/epplets/files/patch-epplets::Makefile.in @@ -1,14 +1,24 @@ ---- epplets/Makefile.in.orig Thu Nov 6 07:09:42 2003 -+++ epplets/Makefile.in Mon Dec 8 04:09:40 2003 -@@ -107,7 +107,7 @@ +--- epplets/Makefile.in.orig Wed Nov 5 17:09:42 2003 ++++ epplets/Makefile.in Fri Feb 6 23:32:36 2004 +@@ -106,13 +106,13 @@ + bindir = $(EBIN) edatadir = $(EROOT) - bin_PROGRAMS = E-Load.epplet E-Clock.epplet E-Time.epplet E-Net.epplet \ +-bin_PROGRAMS = E-Load.epplet E-Clock.epplet E-Time.epplet E-Net.epplet \ -E-Cpu.epplet E-Biff.epplet E-Power.epplet @TEST_PROGS@ @MIXER_PROGS@ \ -+E-Cpu.epplet E-Biff.epplet @APM_PROGS@ @TEST_PROGS@ @MIXER_PROGS@ \ - @GL_PROGS@ E-MemWatch.epplet E-Disk.epplet E-Areas.epplet E-Magic.epplet \ - E-Toolbox.epplet E-NetFlame.epplet E-Sys.epplet E-ScreenShoot.epplet \ +-@GL_PROGS@ E-MemWatch.epplet E-Disk.epplet E-Areas.epplet E-Magic.epplet \ +-E-Toolbox.epplet E-NetFlame.epplet E-Sys.epplet E-ScreenShoot.epplet \ ++bin_PROGRAMS = E-Clock.epplet E-Time.epplet \ ++E-Biff.epplet E-Power.epplet @TEST_PROGS@ @MIXER_PROGS@ \ ++@GL_PROGS@ E-Disk.epplet E-Areas.epplet E-Magic.epplet \ ++E-Toolbox.epplet E-NetFlame.epplet E-ScreenShoot.epplet \ E-Slides.epplet E-Xss.epplet E-Mountbox.epplet E-Exec.epplet @ESD_PROGS@ \ + @PLAYCD_PROGS@ E-ScreenSave.epplet E-NetGraph.epplet E-MoonClock.epplet \ +-E-UrlWatch.epplet E-LoadMeter.epplet E-GtkRc.epplet E-Pinger.epplet \ ++E-UrlWatch.epplet E-GtkRc.epplet E-Pinger.epplet \ + E-Pants.epplet E-Bandwidth.epplet E-Wireless.epplet + + @@ -123,166 +123,130 @@ ################ Conditional Builds ################ @@ -191,12 +201,3 @@ # You can use the following command to generate this line: # ABOUT_DOCS = `(cd epplets && ls -1d *.ABOUT/* 2>/dev/null | grep -v CVS)` -@@ -407,7 +371,7 @@ - CONFIG_HEADER = ../config.h - CONFIG_CLEAN_FILES = - bin_PROGRAMS = E-Load.epplet E-Clock.epplet E-Time.epplet E-Net.epplet \ --E-Cpu.epplet E-Biff.epplet E-Power.epplet @TEST_PROGS@ @MIXER_PROGS@ \ -+E-Cpu.epplet E-Biff.epplet @APM_PROGS@ @TEST_PROGS@ @MIXER_PROGS@ \ - @GL_PROGS@ E-MemWatch.epplet E-Disk.epplet E-Areas.epplet \ - E-Magic.epplet E-Toolbox.epplet E-NetFlame.epplet E-Sys.epplet \ - E-ScreenShoot.epplet E-Slides.epplet E-Xss.epplet E-Mountbox.epplet \ diff --git a/x11-wm/epplets/files/patch-epplets::net.c b/x11-wm/epplets/files/patch-epplets::net.c deleted file mode 100644 index 709c13c821fb..000000000000 --- a/x11-wm/epplets/files/patch-epplets::net.c +++ /dev/null @@ -1,247 +0,0 @@ ---- epplets/net.c.orig Wed Dec 22 02:52:54 1999 -+++ epplets/net.c Tue Nov 18 22:57:45 2003 -@@ -35,6 +35,23 @@ - # include <kstat.h> - # include <sys/sysinfo.h> - #endif -+ -+#ifdef __FreeBSD__ -+ -+#include <sys/types.h> -+#include <sys/socket.h> -+#include <sys/param.h> -+ -+#include <net/if.h> -+#include <net/if_var.h> -+#include <netinet/in.h> -+#include <netinet/in_var.h> -+ -+#include <kvm.h> -+#include <nlist.h> -+ -+#endif -+ - #include "epplet.h" - #include "net.h" - -@@ -51,6 +68,18 @@ - char buff[256], **names = NULL, *s; - unsigned long i; - -+#ifdef __FreeBSD__ -+ -+ kvm_t *kd; -+ struct nlist magicsymbol[] = { {"_ifnet"}, {""} }; -+ char name[32], type[16]; -+ int num; -+ unsigned long ifnetaddr; -+ struct ifnet ifnet; -+ struct ifnethead ifnethead; -+ -+#endif -+ - names = (char **) malloc(sizeof(char *)); - memset(names, 0, sizeof(char *)); - -@@ -80,6 +109,70 @@ - return (names); - #elif defined(__sun__) - return ((char **) NULL); -+#elif defined(__FreeBSD__) -+ -+ if((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL)) == NULL) -+ { -+ perror("kvm_open()"); -+ return NULL; -+ } -+ -+ if(kvm_nlist(kd, magicsymbol) == -1) -+ { -+ perror("kvm_nlist()"); -+ kvm_close(kd); -+ return NULL; -+ } -+ -+ if(kvm_read(kd, magicsymbol[0].n_value, &ifnethead, sizeof(ifnethead)) == -1) -+ { -+ perror("kread magic"); -+ kvm_close(kd); -+ return NULL; -+ } -+ -+ ifnetaddr = (unsigned long)TAILQ_FIRST(&ifnethead); -+ -+ if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1) -+ { -+ perror("kvm_read ifnet\n"); -+ kvm_close(kd); -+ return NULL; -+ } -+ -+ num = 0; -+ while(ifnetaddr) -+ { -+#if __FreeBSD_version < 501113 -+ if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1 || -+ kvm_read(kd, (long)ifnet.if_name, type, 16) == -1) -+ { -+ break; -+ } -+ -+ type[15] = '\0'; -+ ifnetaddr = (unsigned long)TAILQ_NEXT(&ifnet, if_link); -+ -+ snprintf(name, 32, "%s%d", type, ifnet.if_unit); -+#else -+ strlcpy(name, ifnet.if_xname, sizeof(name)); -+#endif -+ -+ if((names = (char **)realloc(names, (++num + 1)*sizeof(char *))) == NULL) -+ return NULL; -+ -+ asprintf(&names[num-1], "%s", name); -+ -+ names[num] = NULL; -+ } -+ -+ kvm_close(kd); -+ -+ if(count) -+ *count = num; -+ -+ return names; -+ - #else - return ((char **) NULL); - #endif -@@ -97,6 +190,21 @@ - unsigned char match = 0; - FILE *fp; - char buff[256], *colon = NULL, dev[64], in_str[64], out_str[64]; -+#elif defined(__FreeBSD__) -+ -+ kvm_t *kd; -+ struct nlist magicsymbol[] = { {"_ifnet"}, {""} }; -+ char name[32], tname[16]; -+ int match, net_layer; -+ struct sockaddr *sa; -+ unsigned long ifaddraddr, ifnetaddr, ifnetfound; -+ struct ifnet ifnet; -+ struct ifnethead ifnethead; -+ union { -+ struct ifaddr ifa; -+ struct in_ifaddr in; -+ } ifaddr; -+ - #endif - - if (device == NULL) { -@@ -151,6 +259,108 @@ - } - fclose(fp); - return ((match) ? (0) : (ENODEV)); -+#elif defined(__FreeBSD__) -+ -+ if((kd = kvm_open(NULL, NULL, NULL, O_RDONLY, NULL)) == NULL) -+ { -+ perror("kvm_open()"); -+ return ENOENT; -+ } -+ -+ if(kvm_nlist(kd, magicsymbol) == -1) -+ { -+ perror("kvm_nlist()"); -+ kvm_close(kd); -+ return ENOENT; -+ } -+ -+ if(kvm_read(kd, magicsymbol[0].n_value, &ifnethead, sizeof(ifnethead)) == -1) -+ { -+ perror("kread magic"); -+ kvm_close(kd); -+ return ENOENT; -+ } -+ -+ ifnetaddr = (unsigned long)TAILQ_FIRST(&ifnethead); -+ -+ if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1) -+ { -+ perror("kvm_read ifnet\n"); -+ kvm_close(kd); -+ return ENOENT; -+ } -+ -+ ifaddraddr = 0; -+ while(ifnetaddr || ifaddraddr) -+ { -+ if(ifaddraddr == 0) -+ { -+ ifnetfound = ifnetaddr; -+#if __FreeBSD_version < 501113 -+ if(kvm_read(kd, ifnetaddr, &ifnet, sizeof(ifnet)) == -1 || -+ kvm_read(kd, (long)ifnet.if_name, tname, 16) == -1) -+ { -+ perror("kread ifnet.if_name\n"); -+ kvm_close(kd); -+ return ENOENT; -+ } -+ -+ tname[15] = '\0'; -+ snprintf(name, 32, "%s%d", tname, ifnet.if_unit); -+#else -+ strlcpy(name, ifnet.if_xname, sizeof(name)); -+#endif -+ ifnetaddr = (unsigned long)TAILQ_NEXT(&ifnet, if_link); -+ -+ if(strncasecmp(name, device, 16) != 0) -+ continue; -+ -+ ifaddraddr = (unsigned long)TAILQ_FIRST(&ifnet.if_addrhead); -+ } -+ -+ *in_bytes = (double)ifnet.if_ibytes; -+ *out_bytes = (double)ifnet.if_obytes; -+ -+ if(kvm_read(kd, ifaddraddr, &ifaddr, sizeof(ifaddr)) == -1) -+ { -+ printf("kread ifaddr\n"); -+ ifaddraddr=0; -+ continue; -+ } -+ -+ match = 1; -+ -+ sa = (struct sockaddr *)((char *)ifaddr.ifa.ifa_addr - -+ (char *)ifaddraddr + (char *)&ifaddr); -+ -+ switch(sa->sa_family) -+ { -+ case AF_INET: -+ net_layer = 1; -+ break; -+#ifdef AF_INET6 -+ case AF_INET6: -+ net_layer = 1; -+ break; -+#endif -+ default: -+ net_layer = 0; -+ } -+ -+ if(net_layer) -+ { -+ *in_bytes = (double)ifaddr.in.ia_ifa.if_ibytes; -+ *out_bytes = (double)ifaddr.in.ia_ifa.if_obytes; -+ } -+ -+ break; -+ } -+ -+ kvm_close(kd); -+ -+ /* XXX: errno=ENODEV; return -1; ??? */ -+ return (match ? 0 : ENODEV); -+ - #else - /* Unsupported platform. */ - if (in_bytes != NULL) { |