diff --git a/ChangeLog b/ChangeLog index b1810d1..bcf0c3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-08-25 Bernhard Walle + * Changed all static variables to a structure which is given the function + as a parameter. This makes more than one instance of the plugin possible. + * Released 0.2.0pre2 which is the next test version for 0.2.0. + 2003-08-24 Bernhard Walle * Using the last four measures in history so it's easier to read. * Automatic maximum now really works. diff --git a/configure b/configure index e0777ff..9001e85 100755 --- a/configure +++ b/configure @@ -1748,7 +1748,7 @@ fi # Define the identity of the package. PACKAGE=xfce4-netload-plugin - VERSION=0.2.0pre1 + VERSION=0.2.0pre2 cat >>confdefs.h <<_ACEOF @@ -20703,67 +20703,6 @@ fi -echo "$as_me:$LINENO: checking for vanilla_coke in -lfridge" >&5 -echo $ECHO_N "checking for vanilla_coke in -lfridge... $ECHO_C" >&6 -if test "${ac_cv_lib_fridge_vanilla_coke+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lfridge $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char vanilla_coke (); -int -main () -{ -vanilla_coke (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_fridge_vanilla_coke=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_fridge_vanilla_coke=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_fridge_vanilla_coke" >&5 -echo "${ECHO_T}$ac_cv_lib_fridge_vanilla_coke" >&6 -if test $ac_cv_lib_fridge_vanilla_coke = yes; then - echo "WTF?!" -else - echo "Warning: No vanilla coke found in fridge.";echo "We highly suggest that you rectify this situation immediatly." -fi - - GETTEXT_PACKAGE=xfce4-netload diff --git a/configure.ac b/configure.ac index 043df3f..b38df41 100644 --- a/configure.ac +++ b/configure.ac @@ -9,7 +9,7 @@ AC_INIT([panel-plugin/netload.c]) AM_CONFIG_HEADER([config.h]) -AM_INIT_AUTOMAKE([xfce4-netload-plugin], [0.2.0pre1]) +AM_INIT_AUTOMAKE([xfce4-netload-plugin], [0.2.0pre2]) AM_MAINTAINER_MODE @@ -46,9 +46,6 @@ AC_TYPE_SIZE_T AC_CHECK_LIB(kstat, kstat_open, SOLLIBS="-lkstat -lsocket", SOLLIBS="") AC_SUBST(SOLLIBS) -AC_CHECK_LIB(fridge, vanilla_coke, echo "WTF?!", - echo "Warning: No vanilla coke found in fridge.";echo "We highly suggest that you rectify this situation immediatly.") - dnl Check for i18n support BM_I18N([xfce4-netload], [de lt ca]) diff --git a/panel-plugin/net.c b/panel-plugin/net.c index 04830b3..18aa665 100644 --- a/panel-plugin/net.c +++ b/panel-plugin/net.c @@ -1,7 +1,7 @@ /* XFce 4 - Netload Plugin * Copyright (c) 2003 Bernhard Walle * - * Id: $Id: net.c,v 1.1 2003/08/24 20:02:29 bwalle Exp $ + * Id: $Id: net.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +36,7 @@ #endif /* From Wormulon */ +#include "net.h" #include "os.h" #include "wormulon.h" #include "slurm.h" /* slurm structs */ @@ -65,39 +66,25 @@ -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif -static double backup_in, backup_out; -static double cur_in, cur_out; -static char dim_in[4], dim_out[4]; -static struct timeval prev_time; -int correct_interface; - - -void init_netload(const char* device) +void init_netload(netdata* data, const char* device) { - strncpy( ifdata.if_name, device, 9 ); - ifdata.if_name[9] = '\0'; + memset( data, 0, sizeof(netdata) ); + strncpy( data->ifdata.if_name, device, 9 ); + data->ifdata.if_name[9] = '\0'; - if (checkinterface() != TRUE) + if (checkinterface(data) != TRUE) { - correct_interface = FALSE; + data->correct_interface = FALSE; return; } /* init in a sane state */ - get_stat(); - backup_in = stats.rx_bytes; - backup_out = stats.tx_bytes; - memset(dim_in, 0, sizeof(dim_in)); - memset(dim_out, 0, sizeof(dim_out)); + get_stat(data); + data->backup_in = data->stats.rx_bytes; + data->backup_out = data->stats.tx_bytes; - correct_interface = TRUE; + data->correct_interface = TRUE; } @@ -107,12 +94,12 @@ void init_netload(const char* device) * @param out Will be filled with the "out"-load. * @param tot Will be filled with the "total"-load. */ -void get_current_netload(unsigned long *in, unsigned long *out, unsigned long *tot) +void get_current_netload(netdata* data, unsigned long *in, unsigned long *out, unsigned long *tot) { struct timeval curr_time; double delta_t; - if( !correct_interface ) + if( ! data->correct_interface ) { if( in != NULL && out != NULL && tot != NULL ) { @@ -122,46 +109,46 @@ void get_current_netload(unsigned long *in, unsigned long *out, unsigned long *t gettimeofday(&curr_time, NULL); - delta_t = (double) ((curr_time.tv_sec - prev_time.tv_sec) * 1000000L - + (curr_time.tv_usec - prev_time.tv_usec)) / 1000000.0; + delta_t = (double) ((curr_time.tv_sec - data->prev_time.tv_sec) * 1000000L + + (curr_time.tv_usec - data->prev_time.tv_usec)) / 1000000.0; /* update */ - get_stat(); - if (backup_in > stats.rx_bytes) + get_stat(data); + if (data->backup_in > data->stats.rx_bytes) { - cur_in = (int) stats.rx_bytes / delta_t; + data->cur_in = (int) data->stats.rx_bytes / delta_t; } else { - cur_in = (int) (stats.rx_bytes - backup_in) / delta_t; + data->cur_in = (int) (data->stats.rx_bytes - data->backup_in) / delta_t; } - if (backup_out > stats.tx_bytes) + if (data->backup_out > data->stats.tx_bytes) { - cur_out = (int) stats.tx_bytes / delta_t; + data->cur_out = (int) data->stats.tx_bytes / delta_t; } else { - cur_out = (int) (stats.tx_bytes - backup_out) / delta_t; + data->cur_out = (int) (data->stats.tx_bytes - data->backup_out) / delta_t; } if( in != NULL && out != NULL && tot != NULL ) { - *in = cur_in; - *out = cur_out; + *in = data->cur_in; + *out = data->cur_out; *tot = *in + *out; } /* save 'new old' values */ - backup_in = stats.rx_bytes; - backup_out = stats.tx_bytes; + data->backup_in = data->stats.rx_bytes; + data->backup_out = data->stats.tx_bytes; /* do the same with time */ - prev_time.tv_sec = curr_time.tv_sec; - prev_time.tv_usec = curr_time.tv_usec; + data->prev_time.tv_sec = curr_time.tv_sec; + data->prev_time.tv_usec = curr_time.tv_usec; } -void close_netload() +void close_netload(netdata* data) { /* We need not code here */ } diff --git a/panel-plugin/net.h b/panel-plugin/net.h index 7d384b8..e732a9a 100644 --- a/panel-plugin/net.h +++ b/panel-plugin/net.h @@ -1,7 +1,7 @@ /* XFce 4 - Netload Plugin * Copyright (c) 2003 Bernhard Walle * - * Id: $Id: net.h,v 1.3 2003/08/24 20:02:29 bwalle Exp $ + * Id: $Id: net.h,v 1.4 2003/08/25 21:08:58 bwalle Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,12 +22,70 @@ #ifndef NET_H #define NET_H +/* ----------------------- Some defines here ------------------------------- */ + +#if defined (__sun__) +#define __Solaris__ 1 +#endif + +#include "os.h" +#include "slurm.h" + + +/* + * We need this because we cannot use static variables. Using of static variables allows + * us not to use several instances of the plugin. + * I know that this change makes it a bit incompatible with wormulon, but that's the + * price to pay ... + */ + +typedef struct +{ + double backup_in; + double backup_out; + double cur_in; + double cur_out; + struct timeval prev_time; + int correct_interface; /* treated as boolean */ + IfData ifdata; + DataStats stats; +#ifdef __HPUX__ + int wait_pcks_counter; + nmapi_logstat* if_ptr; +#elif __FreeBSD__ + int watchif; + int dev_opened; +#elif __NetBSD__ + int mib_name1[6]; + int mib_name2[6]; + char* buf1; + char* buf2; + int alloc1; + int alloc2; +#elif __OpenBSD__ || __MicroBSD__ + int mib_name1[6]; + int mib_name2[6]; + char* buf1; + char* buf2; + int alloc1; + int alloc2; +#elif __linux__ + FILE* proc_net_dev; +#elif __Solaris__ +#else +#error "OS not supported" +#endif + +} netdata; + + + /** * Initializes the netload plugin. Used to set up inital values. This function must * be called after each change of the network interface. * @param device The network device, e.g. ippp0 for ISDN on Linux. */ -void init_netload(const char* device); +void init_netload(netdata* data, const char* device); /** * Gets the current netload. You must call init_netload() once before you use this function! @@ -35,11 +93,11 @@ void init_netload(const char* device); * @param out Output load in byte/s. * @param tot Total load in byte/s. */ -void get_current_netload(unsigned long *in, unsigned long *out, unsigned long *tot); +void get_current_netload(netdata* data, unsigned long *in, unsigned long *out, unsigned long *tot); /** * Should be called to do cleanup work. */ -void close_netload(); +void close_netload(netdata* data); #endif /* NET_H */ diff --git a/panel-plugin/netload.c b/panel-plugin/netload.c index 654d4dc..b49f8b5 100644 --- a/panel-plugin/netload.c +++ b/panel-plugin/netload.c @@ -1,7 +1,7 @@ /* XFce 4 - Netload Plugin * Copyright (c) 2003 Bernhard Walle * - * Id: $Id: netload.c,v 1.3 2003/08/24 20:05:10 bwalle Exp $ + * Id: $Id: netload.c,v 1.4 2003/08/25 21:08:58 bwalle Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +22,9 @@ #include #endif +#include "net.h" +#include "utils.h" + #include #include @@ -29,8 +32,6 @@ #include #include -#include "net.h" -#include "utils.h" /* for xml: */ #define MONITOR_ROOT "Netload" @@ -77,6 +78,9 @@ typedef struct gulong net_max[SUM]; t_monitor_options options; + + /* for the network part */ + netdata data; /* Displayed text */ GtkBox *opt_vbox; @@ -120,7 +124,7 @@ static gint update_monitors(t_global_monitor *global) double temp; gint i; - get_current_netload( &(net[IN]), &(net[OUT]), &(net[TOT]) ); + get_current_netload( &(global->monitor->data), &(net[IN]), &(net[OUT]), &(net[TOT]) ); for (i = 0; i < SUM; i++) @@ -397,7 +401,7 @@ static void monitor_free(Control *ctrl) } g_free(global); - close_netload(); + close_netload( &(global->monitor->data) ); } static void setup_monitor(t_global_monitor *global) @@ -443,7 +447,7 @@ static void setup_monitor(t_global_monitor *global) gtk_widget_show(global->monitor->label); } - init_netload(global->monitor->options.network_device); + init_netload( &(global->monitor->data), global->monitor->options.network_device); } diff --git a/panel-plugin/os.h b/panel-plugin/os.h index 2b5b6f7..b070ce1 100644 --- a/panel-plugin/os.h +++ b/panel-plugin/os.h @@ -9,6 +9,8 @@ *****************************************************************************/ #ifndef _OS_H +#define _OS_H + #if defined (__sun__) #define __Solaris__ 1 #endif diff --git a/panel-plugin/slurm.h b/panel-plugin/slurm.h index 4ae0b02..3e62084 100644 --- a/panel-plugin/slurm.h +++ b/panel-plugin/slurm.h @@ -7,6 +7,7 @@ *****************************************************************************/ #ifndef _SLURM_H_ +#define _SLURM_H_ typedef struct IfData{ char if_name[10]; /* The device name given as start parameter*/ @@ -17,7 +18,7 @@ typedef struct IfData{ int if_valid; /* 1 = selected interface exists * 0 = interfaces does not exists */ } IfData; -IfData ifdata; + /* This structure stays the INFO variables */ typedef struct DataStats { @@ -51,6 +52,5 @@ typedef struct DataStats { double rx_bytes_comp_off; double tx_bytes_comp_off; } DataStats; -DataStats stats; #endif diff --git a/panel-plugin/wormulon.h b/panel-plugin/wormulon.h index afe5c38..c4c6c35 100644 --- a/panel-plugin/wormulon.h +++ b/panel-plugin/wormulon.h @@ -5,7 +5,7 @@ * application specific defines. You should never need to tune anything here * ****************************************************************************** - * $Id: wormulon.h,v 1.1 2003/08/24 20:02:29 bwalle Exp $ + * $Id: wormulon.h,v 1.2 2003/08/25 21:08:58 bwalle Exp $ *****************************************************************************/ #ifndef _WORMULON_H @@ -17,11 +17,8 @@ #define FALSE 0 #endif -#define SAMPLE_TIME 1 /* one second default sample time */ - #ifdef __linux__ #define PATH_NET_DEV "/proc/net/dev" -static FILE *proc_net_dev; #endif /* define possible options */ diff --git a/panel-plugin/wormulon/freebsd.c b/panel-plugin/wormulon/freebsd.c index cc1a598..5dd71a0 100644 --- a/panel-plugin/wormulon/freebsd.c +++ b/panel-plugin/wormulon/freebsd.c @@ -1,4 +1,19 @@ -/* $Id: freebsd.c,v 1.1 2003/08/24 20:01:48 bwalle Exp $ */ +/* $Id: freebsd.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ */ + + +/***************************************************************************** + * + * init_osspecific() + * + * Init function + * + ****************************************************************************/ + +void init_osspecific(netdata* data) +{ + data->watchif = -1; +} + /***************************************************************************** * @@ -9,7 +24,7 @@ * ****************************************************************************/ -int checkinterface(void) +int checkinterface(netdata* data) { int validinterface = FALSE; @@ -31,7 +46,7 @@ int checkinterface(void) len = sizeof(ifmd); sysctl(name, 6, &ifmd, &len, NULL, 0); - if (strcmp(ifmd.ifmd_name, (char *)ifdata.if_name) == 0) + if (strcmp(ifmd.ifmd_name, (char *)data->ifdata.if_name) == 0) { /* * now we have an interface and just have to see if it's up @@ -56,22 +71,20 @@ int checkinterface(void) * ****************************************************************************/ -int get_stat(void) +int get_stat(netdata* data) { /* * use sysctl() to get the right interface number if !dev_opened * then read the data directly from the ifmd_data struct */ - static int watchif = -1; int i, num_iface; size_t len; int name[6]; struct ifmibdata ifmd; - static int dev_opened = 0; unsigned long rx_o, tx_o; - if (!dev_opened) + if (!data->dev_opened) { len = sizeof(num_iface); sysctlbyname("net.link.generic.system.ifcount", &num_iface, &len, @@ -87,11 +100,11 @@ int get_stat(void) len = sizeof(ifmd); sysctl(name, 6, &ifmd, &len, NULL, 0); - if (strcmp(ifmd.ifmd_name, (char *)ifdata.if_name) == 0) + if (strcmp(ifmd.ifmd_name, (char *)data->ifdata.if_name) == 0) { /* got the right interface */ - watchif = i; - dev_opened++; + data->watchif = i; + data->dev_opened++; } } } @@ -100,25 +113,25 @@ int get_stat(void) name[1] = PF_LINK; name[2] = NETLINK_GENERIC; name[3] = IFMIB_IFDATA; - name[4] = watchif; + name[4] = data->watchif; name[5] = IFDATA_GENERAL; len = sizeof(ifmd); sysctl(name, 6, &ifmd, &len, NULL, 0); - rx_o = stats.rx_bytes; tx_o = stats.tx_bytes; + rx_o = data->stats.rx_bytes; tx_o = data->stats.tx_bytes; - stats.tx_packets = ifmd.ifmd_data.ifi_opackets; - stats.rx_packets = ifmd.ifmd_data.ifi_ipackets; - stats.rx_bytes = ifmd.ifmd_data.ifi_ibytes; - stats.tx_bytes = ifmd.ifmd_data.ifi_obytes; - stats.rx_errors = ifmd.ifmd_data.ifi_ierrors; - stats.tx_errors = ifmd.ifmd_data.ifi_oerrors; + data->stats.tx_packets = ifmd.ifmd_data.ifi_opackets; + data->stats.rx_packets = ifmd.ifmd_data.ifi_ipackets; + data->stats.rx_bytes = ifmd.ifmd_data.ifi_ibytes; + data->stats.tx_bytes = ifmd.ifmd_data.ifi_obytes; + data->stats.rx_errors = ifmd.ifmd_data.ifi_ierrors; + data->stats.tx_errors = ifmd.ifmd_data.ifi_oerrors; - if (rx_o > stats.rx_bytes) - stats.rx_over++; - if (tx_o > stats.tx_bytes) - stats.tx_over++; + if (rx_o > data->stats.rx_bytes) + data->stats.rx_over++; + if (tx_o > data->stats.tx_bytes) + data->stats.tx_over++; return (0); } diff --git a/panel-plugin/wormulon/freebsd.h b/panel-plugin/wormulon/freebsd.h index 42aee76..38f5689 100644 --- a/panel-plugin/wormulon/freebsd.h +++ b/panel-plugin/wormulon/freebsd.h @@ -1,2 +1,6 @@ -int get_stat(void); -int checkinterface(void); + +#include "net.h" + +void init_osspecific(netdata* data); +int checkinterface(netdata* data); +int get_stat(netdata* data); diff --git a/panel-plugin/wormulon/hpux.c b/panel-plugin/wormulon/hpux.c index c78b24c..522ef95 100644 --- a/panel-plugin/wormulon/hpux.c +++ b/panel-plugin/wormulon/hpux.c @@ -1,7 +1,23 @@ #include #define WAIT_PCKS_COUNTER 15 -/* $Id: hpux.c,v 1.1 2003/08/24 20:01:48 bwalle Exp $ */ +/* $Id: hpux.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ */ + + +/***************************************************************************** + * + * init_osspecific() + * + * Init function + * + ****************************************************************************/ + +void init_osspecific(netdata* data) +{ + wait_pcks_counter = WAIT_PCKS_COUNTER+1; +} + + /***************************************************************************** * @@ -39,7 +55,7 @@ void _getifdata() { int buffer, fd, val, ret = -1; unsigned int len, i; - char tmpinterfacestring[sizeof(ifdata.if_name)+1],*strstrmatch; + char tmpinterfacestring[sizeof(data->ifdata.if_name)+1],*strstrmatch; struct nmparms params; mib_ifEntry * if_buf; @@ -48,10 +64,10 @@ void _getifdata() * The interface description is more then the pure devicename. * Let's do some formating to allow a propper pattern matching */ - strcpy(tmpinterfacestring,ifdata.if_name); + strcpy(tmpinterfacestring,data->ifdata.if_name); strcat(tmpinterfacestring," "); - for (i=0; i <= ifdata.if_amount; i++) + for (i=0; i <= data->ifdata.if_amount; i++) { if ((fd = open_mib("/dev/lan", O_RDWR, i, 0)) >= 0) { @@ -72,8 +88,8 @@ void _getifdata() strstrmatch = strstr(if_buf->ifDescr, (char *)tmpinterfacestring); if ( strstrmatch && (strcmp(strstrmatch,if_buf->ifDescr)== 0)) { - ifdata.if_valid = 1; - ifdata.if_id = i+1; + data->ifdata.if_valid = 1; + data->ifdata.if_id = i+1; break; } } @@ -93,12 +109,12 @@ void _getifdata() * function is a wrapper function for _countinterfaces && _getifdata.) * ****************************************************************************/ -int checkinterface(void) +int checkinterface(netdata* data) { /* == 0 no network interfaces, -1 sth. went wrong */ - if ((ifdata.if_amount =_countinterfaces()) > 0) + if ((data->ifdata.if_amount =_countinterfaces()) > 0) _getifdata(); - return ifdata.if_valid; + return data->ifdata.if_valid; } /****************************************************************************** @@ -109,38 +125,36 @@ int checkinterface(void) * *****************************************************************************/ -int get_stat(void) +int get_stat(netdata* data) { int i,fd, ret=-1; - static int wait_pcks_counter=WAIT_PCKS_COUNTER+1; unsigned int len; unsigned long rx_o, tx_o; struct nmparms params, params2; mib_ifEntry *if_buf; - static nmapi_logstat *if_ptr = (nmapi_logstat *) 0; - if (ifdata.if_valid == 1 && (fd = open_mib("/dev/lan", O_RDWR, 0, 0)) >= 0) + if (data->ifdata.if_valid == 1 && (fd = open_mib("/dev/lan", O_RDWR, 0, 0)) >= 0) { if ((if_buf = (mib_ifEntry *) malloc (sizeof(mib_ifEntry))) != 0) { - if_buf->ifIndex = ifdata.if_id; + if_buf->ifIndex = data->ifdata.if_id; params.objid = ID_ifEntry; params.buffer = if_buf; len = (unsigned int) sizeof(mib_ifEntry); params.len = &len; if ((ret = get_mib_info(fd, ¶ms)) == 0) { - rx_o = stats.rx_bytes; tx_o = stats.tx_bytes; + rx_o = data->stats.rx_bytes; tx_o = data->stats.tx_bytes; - stats.tx_bytes = if_buf->ifOutOctets; - stats.rx_bytes = if_buf->ifInOctets; - stats.tx_errors = if_buf->ifOutErrors; - stats.rx_errors = if_buf->ifInErrors; + data->stats.tx_bytes = if_buf->ifOutOctets; + data->stats.rx_bytes = if_buf->ifInOctets; + data->stats.tx_errors = if_buf->ifOutErrors; + data->stats.rx_errors = if_buf->ifInErrors; - if (rx_o > stats.rx_bytes) - stats.rx_over++; - if (tx_o > stats.tx_bytes) - stats.tx_over++; + if (rx_o > data->stats.rx_bytes) + data->stats.rx_over++; + if (tx_o > data->stats.tx_bytes) + data->stats.tx_over++; } } free(if_buf); @@ -150,29 +164,29 @@ int get_stat(void) * With WAIT_PCKS_COUNTER=15 i save on my system 43% cpu usage.instead of * WAIT_PCKS_COUNTER=0 */ - if( wait_pcks_counter > WAIT_PCKS_COUNTER ) + if( data->wait_pcks_counter > WAIT_PCKS_COUNTER ) { - if ((if_ptr = (nmapi_logstat *) malloc(sizeof(nmapi_logstat) * ifdata.if_amount)) != 0 ) + if ((if_ptr = (nmapi_logstat *) malloc(sizeof(nmapi_logstat) * data->ifdata.if_amount)) != 0 ) { - len = (unsigned int) ifdata.if_amount *sizeof(nmapi_logstat); + len = (unsigned int) data->ifdata.if_amount *sizeof(nmapi_logstat); if ((ret = get_logical_stat(if_ptr, &len)) == 0) { - for (i=0; i <= ifdata.if_amount; i++) + for (i=0; i <= data->ifdata.if_amount; i++) { - if(if_ptr[i].ifindex == ifdata.if_id) + if(if_ptr[i].ifindex == data->ifdata.if_id) { - stats.tx_packets = if_ptr[i].out_packets; - stats.rx_packets = if_ptr[i].in_packets; + data->stats.tx_packets = if_ptr[i].out_packets; + data->stats.rx_packets = if_ptr[i].in_packets; } } } } free(if_ptr); - wait_pcks_counter=0; + data->wait_pcks_counter = 0; } else { - wait_pcks_counter++; + data->wait_pcks_counter++; } } close_mib(fd); diff --git a/panel-plugin/wormulon/hpux.h b/panel-plugin/wormulon/hpux.h index 4947ad1..174904a 100644 --- a/panel-plugin/wormulon/hpux.h +++ b/panel-plugin/wormulon/hpux.h @@ -1,5 +1,6 @@ #ifndef _HPUX_H_ #define _HPUX_H_ -extern int checkinterface(void); -extern int get_stat(void); +void init_osspecific(netdata* data); +int checkinterface(netdata* data); +int get_stat(netdata* data); #endif diff --git a/panel-plugin/wormulon/if_media.c b/panel-plugin/wormulon/if_media.c index f3a1933..a1c1527 100644 --- a/panel-plugin/wormulon/if_media.c +++ b/panel-plugin/wormulon/if_media.c @@ -6,7 +6,7 @@ * operating systems. * ***************************************************************************** - * $Id: if_media.c,v 1.1 2003/08/24 20:01:48 bwalle Exp $ + * $Id: if_media.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ *****************************************************************************/ #if defined (__FreeBSD__) || (__OpenBSD__) || (__NetBSD__) || (__MicroBSD__) @@ -260,7 +260,7 @@ int get_if_speed(char *ifstring) struct nmparms params; mib_ifEntry * if_buf; - for (i=0; i <= ifdata.if_amount; i++) + for (i=0; i <= data->ifdata.if_amount; i++) { if ((fd = open_mib("/dev/lan", O_RDWR, i, 0)) >= 0) { @@ -273,7 +273,7 @@ int get_if_speed(char *ifstring) if_buf->ifIndex = i+1; if ((ret = get_mib_info(fd, ¶ms)) == 0) { - if ( i+1 == ifdata.if_id) + if ( i+1 == data->ifdata.if_id) if (if_buf->ifOper == 1) speed = if_buf->ifSpeed/1000; else diff --git a/panel-plugin/wormulon/linux.c b/panel-plugin/wormulon/linux.c index 6b39445..a8afff2 100644 --- a/panel-plugin/wormulon/linux.c +++ b/panel-plugin/wormulon/linux.c @@ -1,4 +1,20 @@ -/* $Id: linux.c,v 1.1 2003/08/24 20:01:48 bwalle Exp $ */ +/* $Id: linux.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ */ + + + +/***************************************************************************** + * + * init_osspecific() + * + * Init function + * + ****************************************************************************/ + +void init_osspecific(netdata* data) +{ + /* nothing */ +} + /***************************************************************************** * @@ -9,7 +25,7 @@ * ****************************************************************************/ -int checkinterface(void) +int checkinterface(netdata* data) { int interfacefound = FALSE; unsigned int i; @@ -20,7 +36,7 @@ int checkinterface(void) for (i = 0; ifs[i].if_index; i++) { - if (strcmp(ifs[i].if_name, ifdata.if_name) == 0) + if (strcmp(ifs[i].if_name, data->ifdata.if_name) == 0) { interfacefound = TRUE; break; @@ -42,29 +58,29 @@ int checkinterface(void) * *****************************************************************************/ -int get_stat(void) +int get_stat(netdata* data) { - static int opened = 0; + /* bwalle: Instead of the original code we open the file each time new. The + * performance difference is _very_ minimal. But I don't think that it's a good + * idea to keep the file open for a very long time for _each_ plugin instance. + */ char buffer[BUFSIZE]; char *ptr; char *devname; int dump; int interfacefound; + FILE* proc_net_dev; unsigned long rx_o, tx_o; - if (opened != 1) + if ((proc_net_dev = fopen(PATH_NET_DEV, "r")) == NULL) { - if ((proc_net_dev = fopen(PATH_NET_DEV, "r")) == NULL) - { - fprintf(stderr, "cannot open %s!\nnot running Linux?\n", - PATH_NET_DEV); - exit(1); - } - opened++; + fprintf(stderr, "cannot open %s!\nnot running Linux?\n", + PATH_NET_DEV); + return 1; } /* backup old rx/tx values */ - rx_o = stats.rx_bytes; tx_o = stats.tx_bytes; + rx_o = data->stats.rx_bytes; tx_o = data->stats.tx_bytes; /* do not parse the first two lines as they only contain static garbage */ fseek(proc_net_dev, 0, SEEK_SET); @@ -83,24 +99,25 @@ int get_stat(void) ptr++; *ptr = '\0'; ptr++; - if (!strcmp(devname, (char *) ifdata.if_name)) + if (!strcmp(devname, (char *) data->ifdata.if_name)) { /* read stats and fill struct */ sscanf(ptr, "%lg %lu %lu %d %d %d %d %d %lg %lu %lu %d %d %d %d %d", - &stats.rx_bytes, &stats.rx_packets, &stats.rx_errors, + &(data->stats.rx_bytes), &(data->stats.rx_packets), &(data->stats.rx_errors), &dump, &dump, &dump, &dump, &dump, - &stats.tx_bytes, &stats.tx_packets, &stats.tx_errors, + &(data->stats.tx_bytes), &(data->stats.tx_packets), &(data->stats.tx_errors), &dump, &dump, &dump, &dump, &dump); interfacefound = 1; continue; /* break, as we won't get any new information */ } } + fclose( proc_net_dev ); if (interfacefound) { - if (rx_o > stats.rx_bytes) - stats.rx_over++; - if (tx_o > stats.tx_bytes) - stats.tx_over++; + if (rx_o > data->stats.rx_bytes) + data->stats.rx_over++; + if (tx_o > data->stats.tx_bytes) + data->stats.tx_over++; } return (interfacefound == 1)? 0 : 1; } diff --git a/panel-plugin/wormulon/linux.h b/panel-plugin/wormulon/linux.h index f40045a..9b5e593 100644 --- a/panel-plugin/wormulon/linux.h +++ b/panel-plugin/wormulon/linux.h @@ -1,5 +1,10 @@ -int checkinterface(void); -int get_stat(void); + +#include "net.h" + +void init_osspecific(netdata* data); +int checkinterface(netdata* data); +int get_stat(netdata* data); + #ifdef __linux__ #define BUFSIZE 256 #endif diff --git a/panel-plugin/wormulon/netbsd.c b/panel-plugin/wormulon/netbsd.c index 29936ea..b11768f 100644 --- a/panel-plugin/wormulon/netbsd.c +++ b/panel-plugin/wormulon/netbsd.c @@ -1,4 +1,31 @@ -/* $Id: netbsd.c,v 1.1 2003/08/24 20:01:48 bwalle Exp $ */ +/* $Id: netbsd.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ */ + + +/***************************************************************************** + * + * init_osspecific() + * + * Init function + * + ****************************************************************************/ + +void init_osspecific(netdata* data) +{ + mib_name1[0] = CTL_NET; + mib_name1[1] = PF_ROUTE; + mib_name1[2] = 0; + mib_name1[3] = 0; + mib_name1[4] = NET_RT_IFLIST; + mib_name1[5] = 0; + + mib_name2[0] = CTL_NET; + mib_name2[1] = PF_ROUTE; + mib_name2[2] = 0; + mib_name2[3] = 0; + mib_name2[4] = NET_RT_IFLIST; + mib_name2[5] = 0; +} + /***************************************************************************** * @@ -7,34 +34,31 @@ * check if a given interface exists, return TRUE if it does and FALSE if not * ****************************************************************************/ -int checkinterface() +int checkinterface(netdata* data) { int validinterface = FALSE; - static int mib_name[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 }; - static char *buf; - static int alloc; char *lim, *next; struct if_msghdr *ifm, *nextifm; struct sockaddr_dl *sdl; size_t needed; char s[32]; - if (sysctl(mib_name, 6, NULL, &needed, NULL, 0) < 0) + if (sysctl(data->mib_name1, 6, NULL, &needed, NULL, 0) < 0) return FALSE; - if (alloc < (signed long) needed) + if (data->alloc1 < (signed long) needed) { - if (buf != NULL) - free (buf); - buf = malloc(needed); - if (buf == NULL) + if (data->buf1 != NULL) + free (data->buf1); + data->buf1 = malloc(needed); + if (data->buf1 == NULL) return FALSE; - alloc = needed; + data->alloc1 = needed; } - if (sysctl(mib_name, 6, buf, &needed, NULL, 0) < 0) + if (sysctl(data->mib_name1, 6, data->buf1, &needed, NULL, 0) < 0) return FALSE; - lim = buf + needed; - next = buf; + lim = data->buf1 + needed; + next = data->buf1; while ((next < lim) && (validinterface == 0)) { ifm = (struct if_msghdr *)next; @@ -58,7 +82,7 @@ int checkinterface() /* search for the right network interface */ if (sdl->sdl_family != AF_LINK) continue; - if (strcmp(s, ifdata.if_name) != 0) + if (strcmp(s, data->ifdata.if_name) != 0) continue; else { @@ -77,11 +101,8 @@ int checkinterface() * ****************************************************************************/ -int get_stat(void) +int get_stat(netdata* data) { - static int mib_name[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 }; - static char *buf; - static int alloc; char *lim, *next; struct if_msghdr *ifm, *nextifm; struct sockaddr_dl *sdl; @@ -89,22 +110,22 @@ int get_stat(void) size_t needed; unsigned long rx_o, tx_o; - if (sysctl(mib_name, 6, NULL, &needed, NULL, 0) < 0) + if (sysctl(data->mib_name2, 6, NULL, &needed, NULL, 0) < 0) return 1; - if (alloc < (signed long) needed) + if (data->alloc2 < (signed long) needed) { - if (buf != NULL) - free (buf); - buf = malloc(needed); - if (buf == NULL) + if (data->buf2 != NULL) + free (data->buf2); + data->buf2 = malloc(needed); + if (data->buf2 == NULL) return 1; - alloc = needed; + data->alloc2 = needed; } - if (sysctl(mib_name, 6, buf, &needed, NULL, 0) < 0) + if (sysctl(data->mib_name2, 6, data->buf2, &needed, NULL, 0) < 0) return 1; - lim = buf + needed; - next = buf; + lim = data->buf2 + needed; + next = data->buf2; while (next < lim) { ifm = (struct if_msghdr *)next; @@ -127,22 +148,22 @@ int get_stat(void) s[sdl->sdl_nlen] = '\0'; /* search for the right network interface */ - if (strcmp(s, ifdata.if_name) != 0) + if (strcmp(s, data->ifdata.if_name) != 0) continue; - rx_o = stats.rx_bytes; tx_o = stats.tx_bytes; + rx_o = data->stats.rx_bytes; tx_o = data->stats.tx_bytes; /* write stats */ - stats.tx_packets = ifm->ifm_data.ifi_opackets; - stats.rx_packets = ifm->ifm_data.ifi_ipackets; - stats.rx_bytes = ifm->ifm_data.ifi_ibytes; - stats.tx_bytes = ifm->ifm_data.ifi_obytes; - stats.rx_errors = ifm->ifm_data.ifi_ierrors; - stats.tx_errors = ifm->ifm_data.ifi_oerrors; + data->stats.tx_packets = ifm->ifm_data.ifi_opackets; + data->stats.rx_packets = ifm->ifm_data.ifi_ipackets; + data->stats.rx_bytes = ifm->ifm_data.ifi_ibytes; + data->stats.tx_bytes = ifm->ifm_data.ifi_obytes; + data->stats.rx_errors = ifm->ifm_data.ifi_ierrors; + data->stats.tx_errors = ifm->ifm_data.ifi_oerrors; - if (rx_o > stats.rx_bytes) - stats.rx_over++; - if (tx_o > stats.tx_bytes) - stats.tx_over++; + if (rx_o > data->stats.rx_bytes) + data->stats.rx_over++; + if (tx_o > data->stats.tx_bytes) + data->stats.tx_over++; } } return 0; diff --git a/panel-plugin/wormulon/netbsd.h b/panel-plugin/wormulon/netbsd.h index 42aee76..b25a63d 100644 --- a/panel-plugin/wormulon/netbsd.h +++ b/panel-plugin/wormulon/netbsd.h @@ -1,2 +1,4 @@ -int get_stat(void); -int checkinterface(void); +void init_osspecific(netdata* data); +int checkinterface(netdata* data); +int get_stat(netdata* data); + diff --git a/panel-plugin/wormulon/openbsd.c b/panel-plugin/wormulon/openbsd.c index 42781c7..d39ecbe 100644 --- a/panel-plugin/wormulon/openbsd.c +++ b/panel-plugin/wormulon/openbsd.c @@ -1,4 +1,30 @@ -/* $Id: openbsd.c,v 1.1 2003/08/24 20:01:48 bwalle Exp $ */ +/* $Id: openbsd.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ */ + + +/***************************************************************************** + * + * init_osspecific() + * + * Init function + * + ****************************************************************************/ + +void init_osspecific(netdata* data) +{ + mib_name1[0] = CTL_NET; + mib_name1[1] = PF_ROUTE; + mib_name1[2] = 0; + mib_name1[3] = 0; + mib_name1[4] = NET_RT_IFLIST; + mib_name1[5] = 0; + + mib_name2[0] = CTL_NET; + mib_name2[1] = PF_ROUTE; + mib_name2[2] = 0; + mib_name2[3] = 0; + mib_name2[4] = NET_RT_IFLIST; + mib_name2[5] = 0; +} /***************************************************************************** * @@ -7,35 +33,32 @@ * check if a given interface exists, return TRUE if it does and FALSE if not * ****************************************************************************/ -int checkinterface() +int checkinterface(netdata* data) { int validinterface = FALSE; - static int mib_name[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 }; - static char *buf; - static int alloc; char *lim, *next; struct if_msghdr *ifm, *nextifm; struct sockaddr_dl *sdl; size_t needed; char s[32]; - if (sysctl(mib_name, 6, NULL, &needed, NULL, 0) < 0) + if (sysctl(data->mib_name1, 6, NULL, &needed, NULL, 0) < 0) return FALSE; - if (alloc < (signed long) needed) + if (data->alloc1 < (signed long) needed) { - if (buf != NULL) - free (buf); - buf = malloc(needed); - if (buf == NULL) + if (data->buf1 != NULL) + free (data->buf1); + data->buf1 = malloc(needed); + if (data->buf1 == NULL) return FALSE; - alloc = needed; + data->alloc1 = needed; } - if (sysctl(mib_name, 6, buf, &needed, NULL, 0) < 0) + if (sysctl(data->mib_name1, 6, data->buf1, &needed, NULL, 0) < 0) return FALSE; - lim = buf + needed; - next = buf; + lim = data->buf1 + needed; + next = data->buf1; while ((next < lim) && (validinterface == 0)) { ifm = (struct if_msghdr *)next; @@ -59,7 +82,7 @@ int checkinterface() /* search for the right network interface */ if (sdl->sdl_family != AF_LINK) continue; - if (strcmp(s, ifdata.if_name) != 0) + if (strcmp(s, data->ifdata.if_name) != 0) continue; else { @@ -79,11 +102,8 @@ int checkinterface() * ****************************************************************************/ -int get_stat(void) +int get_stat(netdata* data) { - static int mib_name[] = { CTL_NET, PF_ROUTE, 0, 0, NET_RT_IFLIST, 0 }; - static char *buf; - static int alloc; char *lim, *next; struct if_msghdr *ifm, *nextifm; struct sockaddr_dl *sdl; @@ -91,22 +111,22 @@ int get_stat(void) size_t needed; unsigned long rx_o, tx_o; - if (sysctl(mib_name, 6, NULL, &needed, NULL, 0) < 0) + if (sysctl(data->mib_name2, 6, NULL, &needed, NULL, 0) < 0) return 1; - if (alloc < (signed long) needed) + if (data->alloc2 < (signed long) needed) { - if (buf != NULL) - free (buf); - buf = malloc(needed); - if (buf == NULL) + if (data->buf2 != NULL) + free (data->buf2); + data->buf2 = malloc(needed); + if (data->buf2 == NULL) return 1; - alloc = needed; + data->alloc2 = needed; } - if (sysctl(mib_name, 6, buf, &needed, NULL, 0) < 0) + if (sysctl(data->mib_name2, 6, data->buf2, &needed, NULL, 0) < 0) return 1; - lim = buf + needed; - next = buf; + lim = data->buf2 + needed; + next = data->buf2; while (next < lim) { ifm = (struct if_msghdr *)next; @@ -128,24 +148,24 @@ int get_stat(void) /* search for the right network interface */ if (sdl->sdl_family != AF_LINK) continue; - if (strcmp(sdl->sdl_data, ifdata.if_name) != 0) + if (strcmp(sdl->sdl_data, data->ifdata.if_name) != 0) continue; strncpy(s, sdl->sdl_data, sdl->sdl_nlen); s[sdl->sdl_nlen] = '\0'; - rx_o = stats.rx_bytes; tx_o = stats.tx_bytes; + rx_o = data->stats.rx_bytes; tx_o = data->stats.tx_bytes; /* write stats */ - stats.tx_packets = ifm->ifm_data.ifi_opackets; - stats.rx_packets = ifm->ifm_data.ifi_ipackets; - stats.rx_bytes = ifm->ifm_data.ifi_ibytes; - stats.tx_bytes = ifm->ifm_data.ifi_obytes; - stats.rx_errors = ifm->ifm_data.ifi_ierrors; - stats.tx_errors = ifm->ifm_data.ifi_oerrors; + data->stats.tx_packets = ifm->ifm_data.ifi_opackets; + data->stats.rx_packets = ifm->ifm_data.ifi_ipackets; + data->stats.rx_bytes = ifm->ifm_data.ifi_ibytes; + data->stats.tx_bytes = ifm->ifm_data.ifi_obytes; + data->stats.rx_errors = ifm->ifm_data.ifi_ierrors; + data->stats.tx_errors = ifm->ifm_data.ifi_oerrors; - if (rx_o > stats.rx_bytes) - stats.rx_over++; - if (tx_o > stats.tx_bytes) - stats.tx_over++; + if (rx_o > data->stats.rx_bytes) + data->stats.rx_over++; + if (tx_o > data->stats.tx_bytes) + data->stats.tx_over++; } } return 0; diff --git a/panel-plugin/wormulon/openbsd.h b/panel-plugin/wormulon/openbsd.h index 42aee76..33d7e95 100644 --- a/panel-plugin/wormulon/openbsd.h +++ b/panel-plugin/wormulon/openbsd.h @@ -1,2 +1,3 @@ -int get_stat(void); -int checkinterface(void); +void init_osspecific(netdata* data); +int checkinterface(netdata* data); +int get_stat(netdata* data); diff --git a/panel-plugin/wormulon/solaris.c b/panel-plugin/wormulon/solaris.c index b53c8b2..f655625 100644 --- a/panel-plugin/wormulon/solaris.c +++ b/panel-plugin/wormulon/solaris.c @@ -1,4 +1,18 @@ -/* $Id: solaris.c,v 1.1 2003/08/24 20:01:48 bwalle Exp $ */ +/* $Id: solaris.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ */ + + +/***************************************************************************** + * + * init_osspecific() + * + * Init function + * + ****************************************************************************/ + +void init_osspecific(netdata* data) +{ + /* nothing */ +} /***************************************************************************** * @@ -8,7 +22,7 @@ * ****************************************************************************/ -int checkinterface() +int checkinterface(netdata* data) { int validinterface = FALSE; int sockfd, i, numifs, numifreqs; @@ -64,7 +78,7 @@ int checkinterface() perror("SIOCGIFFLAGS"); continue; } - if (!strcmp(ifdata.if_name, ifr.ifr_name) && (ifr.ifr_flags & IFF_UP)) + if (!strcmp(data->ifdata.if_name, ifr.ifr_name) && (ifr.ifr_flags & IFF_UP)) { validinterface = TRUE; break; @@ -85,7 +99,7 @@ int checkinterface() * ****************************************************************************/ -int get_stat(void) +int get_stat(netdata* data) { kstat_t *ksp; kstat_named_t *knp; @@ -98,38 +112,38 @@ int get_stat(void) return 1; } - rx_o = stats.rx_bytes; tx_o = stats.tx_bytes; + rx_o = data->stats.rx_bytes; tx_o = data->stats.tx_bytes; - ksp = kstat_lookup(kc, NULL, -1, ifdata.if_name); + ksp = kstat_lookup(kc, NULL, -1, data->ifdata.if_name); if (ksp && kstat_read(kc, ksp, NULL) >= 0) { knp = (kstat_named_t *)kstat_data_lookup(ksp, "opackets"); if (knp) - stats.tx_packets = knp->value.ui32; + data->stats.tx_packets = knp->value.ui32; knp = (kstat_named_t *)kstat_data_lookup(ksp, "ipackets"); if (knp) - stats.rx_packets = knp->value.ui32; + data->stats.rx_packets = knp->value.ui32; knp = (kstat_named_t *)kstat_data_lookup(ksp, "obytes"); if (knp) - stats.tx_bytes = knp->value.ui32; + data->stats.tx_bytes = knp->value.ui32; knp = (kstat_named_t *)kstat_data_lookup(ksp, "rbytes"); if (knp) - stats.rx_bytes = knp->value.ui32; + data->stats.rx_bytes = knp->value.ui32; knp = (kstat_named_t *)kstat_data_lookup(ksp, "oerrors"); if (knp) - stats.tx_errors = knp->value.ui32; + data->stats.tx_errors = knp->value.ui32; knp = (kstat_named_t *)kstat_data_lookup(ksp, "ierrors"); if (knp) - stats.rx_errors = knp->value.ui32; + data->stats.rx_errors = knp->value.ui32; } kstat_close(kc); /* check for overflows */ - if (rx_o > stats.rx_bytes) - stats.rx_over++; - if (tx_o > stats.tx_bytes) - stats.tx_over++; + if (rx_o > data->stats.rx_bytes) + data->stats.rx_over++; + if (tx_o > data->stats.tx_bytes) + data->stats.tx_over++; return 0; } diff --git a/panel-plugin/wormulon/solaris.h b/panel-plugin/wormulon/solaris.h index 42aee76..cbf61dd 100644 --- a/panel-plugin/wormulon/solaris.h +++ b/panel-plugin/wormulon/solaris.h @@ -1,2 +1,4 @@ -int get_stat(void); -int checkinterface(void); + +void init_osspecific(netdata* data); +int checkinterface(netdata* data); +int get_stat(netdata* data); diff --git a/panel-plugin/wormulon/unsupported.c b/panel-plugin/wormulon/unsupported.c index ff220d9..0399de0 100644 --- a/panel-plugin/wormulon/unsupported.c +++ b/panel-plugin/wormulon/unsupported.c @@ -1,4 +1,4 @@ -/* $Id: unsupported.c,v 1.1 2003/08/24 20:01:48 bwalle Exp $ */ +/* $Id: unsupported.c,v 1.2 2003/08/25 21:08:58 bwalle Exp $ */ /****************************************************************************** * @@ -8,7 +8,18 @@ * *****************************************************************************/ -int get_stat(void) +int get_stat(netdata* data) +{ + return 0; +} + +void init_osspecific(netdata* data) +{ + /* do nothgin */ +} + + +int checkinterface(netdata* data) { return 0; } diff --git a/panel-plugin/wormulon/unsupported.h b/panel-plugin/wormulon/unsupported.h index 20f3547..33d7e95 100644 --- a/panel-plugin/wormulon/unsupported.h +++ b/panel-plugin/wormulon/unsupported.h @@ -1 +1,3 @@ -int get_stat(void); +void init_osspecific(netdata* data); +int checkinterface(netdata* data); +int get_stat(netdata* data); diff --git a/po/ca.po b/po/ca.po index c0e201f..9ac094c 100644 --- a/po/ca.po +++ b/po/ca.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: XFce 4\n" -"POT-Creation-Date: 2003-08-24 16:31+0200\n" +"POT-Creation-Date: 2003-08-25 22:58+0200\n" "PO-Revision-Date: 2003-08-15 15:38+0100\n" "Last-Translator: Carles Mu-oz Gorriz \n" "Language-Team: ca \n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" -#: panel-plugin/netload.c:166 +#: panel-plugin/netload.c:170 #, fuzzy, c-format msgid "" "Average of last 4 measures:\n" @@ -26,44 +26,44 @@ msgstr "" "Sortint: %lld bit/s\n" "Total: %lld bit/s" -#: panel-plugin/netload.c:748 +#: panel-plugin/netload.c:752 msgid "Select color" msgstr "Seleccioneu el color" -#: panel-plugin/netload.c:799 +#: panel-plugin/netload.c:803 msgid "Bar color (incoming):" msgstr "Color de la barra (sortint):" -#: panel-plugin/netload.c:800 +#: panel-plugin/netload.c:804 msgid "Bar color (outgoing):" msgstr "Color de la barra (entrant):" -#: panel-plugin/netload.c:803 +#: panel-plugin/netload.c:807 #, fuzzy msgid "Maximum (incoming):" msgstr "Color de la barra (sortint):" -#: panel-plugin/netload.c:804 +#: panel-plugin/netload.c:808 #, fuzzy msgid "Maximum (outgoing):" msgstr "Color de la barra (entrant):" -#: panel-plugin/netload.c:827 +#: panel-plugin/netload.c:831 msgid "Text to display:" msgstr "Text a mostrar:" -#: panel-plugin/netload.c:857 +#: panel-plugin/netload.c:861 msgid "Network device:" msgstr "Dispositiu de xarxa" -#: panel-plugin/netload.c:884 +#: panel-plugin/netload.c:888 msgid "Automatic maximum" msgstr "" -#: panel-plugin/netload.c:916 +#: panel-plugin/netload.c:920 msgid "kByte/s" msgstr "" -#: panel-plugin/netload.c:1006 +#: panel-plugin/netload.c:1010 msgid "Netload" msgstr "Càrrega de red" diff --git a/po/de.po b/po/de.po index fe5f3e5..5aafacd 100644 --- a/po/de.po +++ b/po/de.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: de\n" -"POT-Creation-Date: 2003-08-24 16:31+0200\n" +"POT-Creation-Date: 2003-08-25 22:58+0200\n" "PO-Revision-Date: 2003-08-10 19:35+0200\n" "Last-Translator: Bernhard Walle \n" "Language-Team: Deutsch \n" @@ -11,7 +11,7 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "X-Generator: KBabel 1.0.2\n" -#: panel-plugin/netload.c:166 +#: panel-plugin/netload.c:170 #, c-format msgid "" "Average of last 4 measures:\n" @@ -24,42 +24,42 @@ msgstr "" "Ausgehend: %s kByte/s\n" "Gesamt: %s kByte/s" -#: panel-plugin/netload.c:748 +#: panel-plugin/netload.c:752 msgid "Select color" msgstr "Farbe auswählen" -#: panel-plugin/netload.c:799 +#: panel-plugin/netload.c:803 msgid "Bar color (incoming):" msgstr "Balkenfarbe (eingehend):" -#: panel-plugin/netload.c:800 +#: panel-plugin/netload.c:804 msgid "Bar color (outgoing):" msgstr "Balkenfarbe (ausgehend):" -#: panel-plugin/netload.c:803 +#: panel-plugin/netload.c:807 msgid "Maximum (incoming):" msgstr "Maximum (eingehend):" -#: panel-plugin/netload.c:804 +#: panel-plugin/netload.c:808 msgid "Maximum (outgoing):" msgstr "Maximum (ausgehend):" -#: panel-plugin/netload.c:827 +#: panel-plugin/netload.c:831 msgid "Text to display:" msgstr "Angezeigter Text:" -#: panel-plugin/netload.c:857 +#: panel-plugin/netload.c:861 msgid "Network device:" msgstr "Netzwerkschnittstelle:" -#: panel-plugin/netload.c:884 +#: panel-plugin/netload.c:888 msgid "Automatic maximum" msgstr "Automatisches Maximum" -#: panel-plugin/netload.c:916 +#: panel-plugin/netload.c:920 msgid "kByte/s" msgstr "kByte/s" -#: panel-plugin/netload.c:1006 +#: panel-plugin/netload.c:1010 msgid "Netload" msgstr "Netzlast" diff --git a/po/lt.po b/po/lt.po index 9319f6d..4b0b6de 100644 --- a/po/lt.po +++ b/po/lt.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: xfce4-netload 1.0\n" -"POT-Creation-Date: 2003-08-24 16:31+0200\n" +"POT-Creation-Date: 2003-08-25 22:58+0200\n" "PO-Revision-Date: 2003-08-15 11:08+0300\n" "Last-Translator: Mantas \n" "Language-Team: \n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: panel-plugin/netload.c:166 +#: panel-plugin/netload.c:170 #, fuzzy, c-format msgid "" "Average of last 4 measures:\n" @@ -26,44 +26,44 @@ msgstr "" "Siunčiami: %lld bitų/s\n" "Viso: %lld bitų/s" -#: panel-plugin/netload.c:748 +#: panel-plugin/netload.c:752 msgid "Select color" msgstr "Pasirinkite spalvą" -#: panel-plugin/netload.c:799 +#: panel-plugin/netload.c:803 msgid "Bar color (incoming):" msgstr "Juostos spalva (gaunami duomenys)" -#: panel-plugin/netload.c:800 +#: panel-plugin/netload.c:804 msgid "Bar color (outgoing):" msgstr "Juostos spalva (siunčiami duomenys)" -#: panel-plugin/netload.c:803 +#: panel-plugin/netload.c:807 #, fuzzy msgid "Maximum (incoming):" msgstr "Juostos spalva (gaunami duomenys)" -#: panel-plugin/netload.c:804 +#: panel-plugin/netload.c:808 #, fuzzy msgid "Maximum (outgoing):" msgstr "Juostos spalva (siunčiami duomenys)" -#: panel-plugin/netload.c:827 +#: panel-plugin/netload.c:831 msgid "Text to display:" msgstr "Rodomas tekstas:" -#: panel-plugin/netload.c:857 +#: panel-plugin/netload.c:861 msgid "Network device:" msgstr "Tinklo įrenginys" -#: panel-plugin/netload.c:884 +#: panel-plugin/netload.c:888 msgid "Automatic maximum" msgstr "" -#: panel-plugin/netload.c:916 +#: panel-plugin/netload.c:920 msgid "kByte/s" msgstr "" -#: panel-plugin/netload.c:1006 +#: panel-plugin/netload.c:1010 msgid "Netload" msgstr "Tinklo apkrovimas" diff --git a/po/xfce4-netload.pot b/po/xfce4-netload.pot index 99ab5e1..5a333b3 100644 --- a/po/xfce4-netload.pot +++ b/po/xfce4-netload.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2003-08-24 16:31+0200\n" +"POT-Creation-Date: 2003-08-25 22:58+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -15,7 +15,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: panel-plugin/netload.c:166 +#: panel-plugin/netload.c:170 #, c-format msgid "" "Average of last 4 measures:\n" @@ -24,42 +24,42 @@ msgid "" "Total: %s kByte/s" msgstr "" -#: panel-plugin/netload.c:748 +#: panel-plugin/netload.c:752 msgid "Select color" msgstr "" -#: panel-plugin/netload.c:799 +#: panel-plugin/netload.c:803 msgid "Bar color (incoming):" msgstr "" -#: panel-plugin/netload.c:800 +#: panel-plugin/netload.c:804 msgid "Bar color (outgoing):" msgstr "" -#: panel-plugin/netload.c:803 +#: panel-plugin/netload.c:807 msgid "Maximum (incoming):" msgstr "" -#: panel-plugin/netload.c:804 +#: panel-plugin/netload.c:808 msgid "Maximum (outgoing):" msgstr "" -#: panel-plugin/netload.c:827 +#: panel-plugin/netload.c:831 msgid "Text to display:" msgstr "" -#: panel-plugin/netload.c:857 +#: panel-plugin/netload.c:861 msgid "Network device:" msgstr "" -#: panel-plugin/netload.c:884 +#: panel-plugin/netload.c:888 msgid "Automatic maximum" msgstr "" -#: panel-plugin/netload.c:916 +#: panel-plugin/netload.c:920 msgid "kByte/s" msgstr "" -#: panel-plugin/netload.c:1006 +#: panel-plugin/netload.c:1010 msgid "Netload" msgstr ""