16660
|
1 |
--- gnome-netstatus-2.26.0/configure.in.orig 2009-03-08 05:44:58.000000000 +0000
|
|
2 |
+++ gnome-netstatus-2.26.0/configure.in 2009-03-18 10:17:17.098639534 +0000
|
|
3 |
@@ -79,6 +79,24 @@ else
|
|
4 |
fi
|
|
5 |
AC_SUBST(NETSTATUS_DEBUG_CFLAGS)
|
|
6 |
|
|
7 |
+case $host in
|
|
8 |
+*-*-solaris*)
|
|
9 |
+ ostype=solaris
|
|
10 |
+ AC_CHECK_LIB(kstat, kstat_open, [
|
|
11 |
+ AC_CHECK_HEADER(kstat.h, [
|
|
12 |
+ AC_DEFINE(HAVE_KSTAT, 1, [Define to 1 if you have the <kstat.h> header file.])
|
|
13 |
+ KSTAT_LIBS=-lkstat
|
|
14 |
+ AC_SUBST(KSTAT_LIBS)
|
|
15 |
+ ])
|
|
16 |
+ ], AC_MSG_ERROR([*** libkstat is required]))
|
|
17 |
+ AC_DEFINE_UNQUOTED(HAVE_SOLARIS, 1, Define to 1)
|
|
18 |
+ ;;
|
|
19 |
+*-*-linux*)
|
|
20 |
+ ostype=linux
|
|
21 |
+ AC_DEFINE_UNQUOTED(HAVE_LINUX, 1, Define to 1)
|
|
22 |
+ ;;
|
|
23 |
+esac
|
|
24 |
+
|
|
25 |
dnl
|
|
26 |
dnl whether or not to run glib-mkenums etc.
|
|
27 |
dnl
|
|
28 |
|
|
29 |
--- gnome-netstatus-2.7.1/src/Makefile.am 2004-07-22 17:02:37.778210000 +0600
|
|
30 |
+++ gnome-netstatus-2.7.1-new/src/Makefile.am 2004-07-22 17:01:38.429334000 +0600
|
|
31 |
@@ -14,7 +14,7 @@ INCLUDES = \
|
|
32 |
|
|
33 |
libexec_PROGRAMS = gnome-netstatus-applet
|
|
34 |
|
|
35 |
-gnome_netstatus_applet_LDADD = $(NETSTATUS_LIBS)
|
|
36 |
+gnome_netstatus_applet_LDADD = $(NETSTATUS_LIBS) $(KSTAT_LIBS)
|
|
37 |
|
|
38 |
gnome_netstatus_applet_SOURCES = \
|
|
39 |
netstatus-applet.c \
|
|
40 |
--- gnome-netstatus-2.26.0/src/netstatus-sysdeps.c.ori 2009-03-13 11:52:01.363555674 +0000
|
|
41 |
+++ gnome-netstatus-2.26.0/src/netstatus-sysdeps.c 2009-03-13 11:53:18.108631785 +0000
|
|
42 |
@@ -1,5 +1,5 @@
|
|
43 |
/*
|
|
44 |
- * Copyright (C) 2003 Sun Microsystems, Inc.
|
|
45 |
+ * Copyright (C) 2003-2009 Sun Microsystems, Inc.
|
|
46 |
* Copyright (C) 2004 Red Hat Inc.
|
|
47 |
*
|
|
48 |
* This program is free software; you can redistribute it and/or
|
|
49 |
@@ -35,6 +35,11 @@
|
|
50 |
#include <glib.h>
|
|
51 |
#include <glib/gi18n.h>
|
|
52 |
|
|
53 |
+#ifdef HAVE_SOLARIS
|
|
54 |
+#include <kstat.h>
|
|
55 |
+#include <stdlib.h>
|
|
56 |
+#endif
|
|
57 |
+
|
|
58 |
#ifdef __FreeBSD__
|
|
59 |
#include <sys/types.h>
|
|
60 |
#include <sys/socket.h>
|
|
61 |
@@ -78,7 +82,7 @@
|
|
62 |
return TRUE;
|
|
63 |
}
|
|
64 |
|
|
65 |
-#if !defined (__FreeBSD__)
|
|
66 |
+#if !defined (__FreeBSD__) && !defined (__sun)
|
|
67 |
|
|
68 |
static inline char *
|
|
69 |
parse_iface_name (const char *buf)
|
|
70 |
@@ -357,6 +361,103 @@
|
|
71 |
return error_message;
|
|
72 |
}
|
|
73 |
|
|
74 |
+#elif defined (__sun)
|
|
75 |
+
|
|
76 |
+char *
|
|
77 |
+netstatus_sysdeps_read_iface_statistics (const char *iface,
|
|
78 |
+ gulong *in_packets,
|
|
79 |
+ gulong *out_packets,
|
|
80 |
+ gulong *in_bytes,
|
|
81 |
+ gulong *out_bytes)
|
|
82 |
+{
|
|
83 |
+ char *error_message = NULL;
|
|
84 |
+ static kstat_ctl_t *kc = NULL;
|
|
85 |
+ kstat_t *ksp;
|
|
86 |
+ kstat_named_t *kn;
|
|
87 |
+
|
|
88 |
+ /*
|
|
89 |
+ * The linux-specific code uses -1 as the default value. But if we return -1
|
|
90 |
+ * (see comment below), then it gets interpreted as (unsigned long)-1, which
|
|
91 |
+ * looks stupid and is definitely more wrong than just showing 0.
|
|
92 |
+ */
|
|
93 |
+
|
|
94 |
+ *in_packets = 0;
|
|
95 |
+ *out_packets = 0;
|
|
96 |
+ *in_bytes = 0;
|
|
97 |
+ *out_bytes = 0;
|
|
98 |
+
|
|
99 |
+ if (kc == NULL)
|
|
100 |
+ {
|
|
101 |
+ if ((kc = kstat_open ()) == NULL)
|
|
102 |
+ return g_strdup_printf (_("Cannot open /dev/kstat: %s"),
|
|
103 |
+ g_strerror (errno));
|
|
104 |
+ }
|
|
105 |
+ else
|
|
106 |
+ {
|
|
107 |
+ if (kstat_chain_update (kc) < 0)
|
|
108 |
+ {
|
|
109 |
+ int e = errno;
|
|
110 |
+ kstat_close (kc);
|
|
111 |
+ kc = NULL;
|
|
112 |
+ return g_strdup_printf (_("Cannot update kstats: %s"),
|
|
113 |
+ g_strerror (e));
|
|
114 |
+ }
|
|
115 |
+ }
|
|
116 |
+
|
|
117 |
+ if ((ksp = kstat_lookup (kc, NULL, -1, iface)) == NULL)
|
|
118 |
+ {
|
|
119 |
+ kstat_close (kc);
|
|
120 |
+ kc = NULL;
|
|
121 |
+ return g_strdup_printf (_("Cannot find information on interface '%s'"),
|
|
122 |
+ iface);
|
|
123 |
+ }
|
|
124 |
+
|
|
125 |
+ if (kstat_read (kc, ksp, NULL) < 0)
|
|
126 |
+ {
|
|
127 |
+ kstat_close (kc);
|
|
128 |
+ kc = NULL;
|
|
129 |
+ return g_strdup_printf (_("Cannot read kstat"));
|
|
130 |
+ }
|
|
131 |
+
|
|
132 |
+ if ((kn = kstat_data_lookup (ksp, "ipackets")) != NULL)
|
|
133 |
+ *in_packets = kn->value.ui32;
|
|
134 |
+
|
|
135 |
+ if ((kn = kstat_data_lookup (ksp, "opackets")) != NULL)
|
|
136 |
+ *out_packets = kn->value.ui32;
|
|
137 |
+
|
|
138 |
+ if ((kn = kstat_data_lookup (ksp, "rbytes")) != NULL)
|
|
139 |
+ *in_bytes = kn->value.ui32;
|
|
140 |
+
|
|
141 |
+ if ((kn = kstat_data_lookup (ksp, "obytes")) != NULL)
|
|
142 |
+ *out_bytes = kn->value.ui32;
|
|
143 |
+
|
|
144 |
+ /*
|
|
145 |
+ * On Solaris, loopback doesn't report bytes, just packets. The behavior of
|
|
146 |
+ * the linux-specific code reports an error if all the data is not present,
|
|
147 |
+ * and that shuts the applet down. So perhaps it's best to simply return
|
|
148 |
+ * success if we can access the data at all.
|
|
149 |
+ */
|
|
150 |
+
|
|
151 |
+ return NULL;
|
|
152 |
+}
|
|
153 |
+
|
|
154 |
+char *
|
|
155 |
+netstatus_sysdeps_read_iface_wireless_details (const char *iface,
|
|
156 |
+ gboolean *is_wireless,
|
|
157 |
+ int *signal_strength)
|
|
158 |
+{
|
|
159 |
+ g_return_val_if_fail (iface != NULL, NULL);
|
|
160 |
+ g_return_val_if_fail (is_wireless != NULL, NULL);
|
|
161 |
+ g_return_val_if_fail (signal_strength != NULL, NULL);
|
|
162 |
+
|
|
163 |
+ if (is_wireless)
|
|
164 |
+ *is_wireless = FALSE;
|
|
165 |
+ if (signal_strength)
|
|
166 |
+ *signal_strength = 0;
|
|
167 |
+
|
|
168 |
+ return NULL;
|
|
169 |
+}
|
|
170 |
+
|
|
171 |
#else /* defined(__FreeBSD__) */
|
|
172 |
|
|
173 |
static inline void
|