76 lines
2.9 KiB
Plaintext
76 lines
2.9 KiB
Plaintext
$OpenBSD: patch-panel-plugin_main_c,v 1.2 2007/05/11 14:02:02 steven Exp $
|
|
--- panel-plugin/main.c.orig Thu Jan 18 18:12:07 2007
|
|
+++ panel-plugin/main.c Fri May 11 15:52:04 2007
|
|
@@ -80,7 +80,7 @@ typedef enum monitor_bar_order_t {
|
|
typedef struct param_t {
|
|
/* Configurable parameters */
|
|
char acDevice[64];
|
|
-#if !defined(__NetBSD__)
|
|
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
|
|
dev_t st_rdev;
|
|
#endif
|
|
int fTitleDisplayed;
|
|
@@ -151,7 +151,7 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin)
|
|
const double K = 1.0 * 1000 * 1000 * 1000 / 1024 / 1024;
|
|
/* bytes/ns --> MB/s */
|
|
double arPerf[NMONITORS], arBusy[NMONITORS], *prData, *pr;
|
|
- char acToolTips[128];
|
|
+ char acToolTips[256];
|
|
int status, i;
|
|
|
|
if (!s_poToolTips)
|
|
@@ -159,7 +159,7 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin)
|
|
|
|
memset (&oPerf, 0, sizeof (oPerf));
|
|
oPerf.qlen = -1;
|
|
-#if defined (__NetBSD__)
|
|
+#if defined (__NetBSD__) || defined(__OpenBSD__)
|
|
status = DevGetPerfData (poConf->acDevice, &oPerf);
|
|
#else
|
|
status = DevGetPerfData (&(poConf->st_rdev), &oPerf);
|
|
@@ -199,7 +199,7 @@ static int DisplayPerf (struct diskperf_t *p_poPlugin)
|
|
}
|
|
}
|
|
|
|
- sprintf (acToolTips, "%s\n"
|
|
+ snprintf (acToolTips, sizeof(acToolTips), "%s\n"
|
|
"----------------\n"
|
|
"I/O (MB/s)\n"
|
|
" Read :%3u\n"
|
|
@@ -400,7 +400,7 @@ static diskperf_t *diskperf_create_control (XfcePanelP
|
|
struct diskperf_t *poPlugin;
|
|
struct param_t *poConf;
|
|
struct monitor_t *poMonitor;
|
|
-#if !defined(__NetBSD__)
|
|
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
|
|
struct stat oStat;
|
|
int status;
|
|
#endif
|
|
@@ -412,7 +412,7 @@ static diskperf_t *diskperf_create_control (XfcePanelP
|
|
|
|
poPlugin->plugin = plugin;
|
|
|
|
-#if defined(__NetBSD__)
|
|
+#if defined(__NetBSD__) || defined(__OpenBSD__)
|
|
strcpy (poConf->acDevice, "wd0");
|
|
strcpy (poConf->acTitle, "wd0");
|
|
#else
|
|
@@ -500,7 +500,7 @@ static void diskperf_read_config (XfcePanelPlugin *plu
|
|
if ((value = xfce_rc_read_entry (rc, (CONF_DEVICE), NULL))) {
|
|
memset (poConf->acDevice, 0, sizeof (poConf->acDevice));
|
|
strncpy (poConf->acDevice, value, sizeof (poConf->acDevice) - 1);
|
|
-#if !defined(__NetBSD__)
|
|
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
|
|
status = stat (poConf->acDevice, &oStat);
|
|
poConf->st_rdev = (status == -1 ? 0 : oStat.st_rdev);
|
|
#endif
|
|
@@ -623,7 +623,7 @@ static void SetDevice (Widget_t p_wTF, void *p_pvPlugi
|
|
struct diskperf_t *poPlugin = (diskperf_t *) p_pvPlugin;
|
|
struct param_t *poConf = &(poPlugin->oConf.oParam);
|
|
const char *pcDevice = gtk_entry_get_text (GTK_ENTRY (p_wTF));
|
|
-#if !defined(__NetBSD__)
|
|
+#if !defined(__NetBSD__) && !defined(__OpenBSD__)
|
|
struct stat oStat;
|
|
int status;
|
|
|