author | dcarbery |
Tue, 05 Dec 2006 15:13:48 +0000 | |
changeset 8685 | befda20e9287 |
parent 8569 | bcdeb66705af |
child 9057 | 743c51acb0d3 |
permissions | -rw-r--r-- |
8569 | 1 |
diff -Nrup libgtop-2.14.4/include/glibtop/error.h libgtop-2.14.4.mod/include/glibtop/error.h |
2 |
--- libgtop-2.14.4/include/glibtop/error.h 2005-02-15 18:14:59.000000000 +0800 |
|
3 |
+++ libgtop-2.14.4.mod/include/glibtop/error.h 2006-11-13 20:28:00.229195000 +0800 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
4 |
@@ -33,20 +33,20 @@ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
5 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
6 |
G_BEGIN_DECLS |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
7 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
8 |
-void glibtop_error_vr (glibtop *server, const char *format, va_list args) G_GNUC_INTERNAL G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
9 |
-void glibtop_warn_vr (glibtop *server, const char *format, va_list args) G_GNUC_INTERNAL; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
10 |
-void glibtop_error_io_vr (glibtop *server, const char *format, int, va_list args) G_GNUC_INTERNAL G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
11 |
-void glibtop_warn_io_vr (glibtop *server, const char *format, int, va_list args) G_GNUC_INTERNAL; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
12 |
- |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
13 |
-void glibtop_error_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
14 |
-void glibtop_warn_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
15 |
-void glibtop_error_io_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
16 |
-void glibtop_warn_io_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
17 |
- |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
18 |
-void glibtop_error (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
19 |
-void glibtop_warn (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
20 |
-void glibtop_error_io (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
21 |
-void glibtop_warn_io (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
22 |
+G_GNUC_INTERNAL void glibtop_error_vr (glibtop *server, const char *format, va_list args) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
23 |
+G_GNUC_INTERNAL void glibtop_warn_vr (glibtop *server, const char *format, va_list args) ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
24 |
+G_GNUC_INTERNAL void glibtop_error_io_vr (glibtop *server, const char *format, int, va_list args) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
25 |
+G_GNUC_INTERNAL void glibtop_warn_io_vr (glibtop *server, const char *format, int, va_list args) ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
26 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
27 |
+G_GNUC_INTERNAL void glibtop_error_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
28 |
+G_GNUC_INTERNAL void glibtop_warn_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
29 |
+G_GNUC_INTERNAL void glibtop_error_io_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
30 |
+G_GNUC_INTERNAL void glibtop_warn_io_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
31 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
32 |
+G_GNUC_INTERNAL void glibtop_error (const char *format, ...) G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
33 |
+G_GNUC_INTERNAL void glibtop_warn (const char *format, ...) G_GNUC_PRINTF(1, 2); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
34 |
+G_GNUC_INTERNAL void glibtop_error_io (const char *format, ...) G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
35 |
+G_GNUC_INTERNAL void glibtop_warn_io (const char *format, ...) G_GNUC_PRINTF(1, 2); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
36 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
37 |
G_END_DECLS |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
38 |
|
8569 | 39 |
diff -Nrup libgtop-2.14.4/include/glibtop/procmem.h libgtop-2.14.4.mod/include/glibtop/procmem.h |
40 |
--- libgtop-2.14.4/include/glibtop/procmem.h 2006-04-23 02:16:53.000000000 +0800 |
|
41 |
+++ libgtop-2.14.4.mod/include/glibtop/procmem.h 2006-11-13 20:28:00.231664000 +0800 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
42 |
@@ -53,6 +53,7 @@ struct _glibtop_proc_mem |
8180 | 43 |
guint64 rss; /* resident set size */ |
44 |
guint64 rss_rlim; /* current limit (in bytes) of the rss |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
45 |
* of the process; usually 2,147,483,647 */ |
8180 | 46 |
+ guint load; /* cpu load for process */ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
47 |
}; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
48 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
49 |
void glibtop_get_proc_mem(glibtop_proc_mem *buf, pid_t pid); |
8569 | 50 |
diff -Nrup libgtop-2.14.4/src/daemon/daemon.h libgtop-2.14.4.mod/src/daemon/daemon.h |
51 |
--- libgtop-2.14.4/src/daemon/daemon.h 2006-04-02 17:10:00.000000000 +0800 |
|
52 |
+++ libgtop-2.14.4.mod/src/daemon/daemon.h 2006-11-13 20:28:00.073924000 +0800 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
53 |
@@ -59,17 +59,17 @@ G_BEGIN_DECLS |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
54 |
#define MSG_BUFSZ sizeof (struct _glibtop_ipc_message) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
55 |
#define MSG_MSGSZ (MSG_BUFSZ - sizeof (long)) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
56 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
57 |
-void handle_parent_connection (int s) G_GNUC_INTERNAL; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
58 |
-void handle_slave_connection (int input, int output) G_GNUC_INTERNAL; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
59 |
-void handle_slave_command (glibtop_command *cmnd, glibtop_response *resp, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
60 |
- const void *parameter) G_GNUC_INTERNAL ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
61 |
- |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
62 |
-void do_output (int s, glibtop_response *resp, off_t offset, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
63 |
- size_t data_size, const void *data) G_GNUC_INTERNAL; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
64 |
-int do_read (int s, void *ptr, size_t total_size) G_GNUC_INTERNAL; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
65 |
+G_GNUC_INTERNAL void handle_parent_connection (int s) ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
66 |
+G_GNUC_INTERNAL void handle_slave_connection (int input, int output) ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
67 |
+G_GNUC_INTERNAL void handle_slave_command (glibtop_command *cmnd, glibtop_response *resp, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
68 |
+ const void *parameter) ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
69 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
70 |
+G_GNUC_INTERNAL void do_output (int s, glibtop_response *resp, off_t offset, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
71 |
+ size_t data_size, const void *data) ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
72 |
+G_GNUC_INTERNAL int do_read (int s, void *ptr, size_t total_size) ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
73 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
74 |
-void syslog_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
75 |
-void syslog_io_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
76 |
+G_GNUC_INTERNAL void syslog_message (int priority, const char *format, ...) G_GNUC_PRINTF(2, 3); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
77 |
+G_GNUC_INTERNAL void syslog_io_message (int priority, const char *format, ...) G_GNUC_PRINTF(2, 3); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
78 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
79 |
extern int enable_debug; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
80 |
extern int verbose_output; |
8569 | 81 |
diff -Nrup libgtop-2.14.4/sysdeps/common/fsusage.c libgtop-2.14.4.mod/sysdeps/common/fsusage.c |
82 |
--- libgtop-2.14.4/sysdeps/common/fsusage.c 2005-02-28 16:11:15.000000000 +0800 |
|
83 |
+++ libgtop-2.14.4.mod/sysdeps/common/fsusage.c 2006-11-13 20:28:00.187415000 +0800 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
84 |
@@ -126,10 +126,10 @@ static const unsigned long _glibtop_sysd |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
85 |
*/ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
86 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
87 |
#ifdef linux |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
88 |
-void |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
89 |
+G_GNUC_INTERNAL void |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
90 |
_glibtop_linux_get_fsusage_read_write(glibtop *server, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
91 |
glibtop_fsusage *buf, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
92 |
- const char *path) G_GNUC_INTERNAL; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
93 |
+ const char *path) ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
94 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
95 |
static inline void |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
96 |
_glibtop_get_fsusage_read_write(glibtop *server, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
97 |
@@ -141,7 +141,7 @@ _glibtop_get_fsusage_read_write(glibtop |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
98 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
99 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
100 |
#elif defined(__FreeBSD__) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
101 |
-void G_GNUC_INTERNAL |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
102 |
+G_GNUC_INTERNAL void |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
103 |
_glibtop_freebsd_get_fsusage_read_write(glibtop *server, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
104 |
glibtop_fsusage *buf, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
105 |
const char *path); |
8180 | 106 |
@@ -149,8 +149,17 @@ _glibtop_freebsd_get_fsusage_read_write( |
107 |
#define _glibtop_get_fsusage_read_write(S, B, P) \ |
|
108 |
_glibtop_freebsd_get_fsusage_read_write(S, B, P) |
|
109 |
||
110 |
+#elif (defined(sun) || defined(__sun)) |
|
111 |
+G_GNUC_INTERNAL void |
|
112 |
+_glibtop_sun_get_fsusage_read_write(glibtop *server, |
|
113 |
+ glibtop_fsusage *buf, |
|
114 |
+ const char *path); |
|
115 |
+ |
|
116 |
+#define _glibtop_get_fsusage_read_write(S, B, P) \ |
|
117 |
+ _glibtop_sun_get_fsusage_read_write(S, B, P) |
|
118 |
+ |
|
119 |
#else /* default fallback */ |
|
120 |
-#warning glibtop_get_fsusage .read .write are not implemented. |
|
121 |
+/*#warning glibtop_get_fsusage .read .write are not implemented.*/ |
|
122 |
static inline void |
|
123 |
_glibtop_get_fsusage_read_write(glibtop *server, |
|
124 |
glibtop_fsusage *buf, |
|
8569 | 125 |
diff -Nrup libgtop-2.14.4/sysdeps/common/mountlist.c libgtop-2.14.4.mod/sysdeps/common/mountlist.c |
126 |
--- libgtop-2.14.4/sysdeps/common/mountlist.c 2006-06-25 01:24:27.000000000 +0800 |
|
127 |
+++ libgtop-2.14.4.mod/sysdeps/common/mountlist.c 2006-11-13 20:28:00.187183000 +0800 |
|
8180 | 128 |
@@ -477,8 +477,10 @@ read_filesystem_list (void) |
129 |
||
130 |
if (fclose (fp) == EOF) |
|
131 |
return NULL; |
|
132 |
- if (ret > 0) |
|
133 |
+ if (ret > 0) { |
|
134 |
+ fclose (fp); |
|
135 |
return NULL; |
|
136 |
+ } |
|
137 |
} |
|
138 |
#endif /* MOUNTED_GETMNTENT2. */ |
|
139 |
||
8569 | 140 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/Makefile.am libgtop-2.14.4.mod/sysdeps/solaris/Makefile.am |
141 |
--- libgtop-2.14.4/sysdeps/solaris/Makefile.am 2004-11-13 08:53:20.000000000 +0800 |
|
142 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/Makefile.am 2006-11-13 20:28:00.177639000 +0800 |
|
8685 | 143 |
@@ -8,7 +8,7 @@ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
144 |
proclist.c procstate.c procuid.c \ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
145 |
proctime.c procmem.c procsignal.c \ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
146 |
prockernel.c procsegment.c procargs.c \ |
8685 | 147 |
- procopenfiles.c \ |
148 |
+ procopenfiles.c sysinfo.c fsusage.c \ |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
149 |
procmap.c netload.c ppp.c procdata.c netlist.c |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
150 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
151 |
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO) |
8569 | 152 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/cpu.c libgtop-2.14.4.mod/sysdeps/solaris/cpu.c |
153 |
--- libgtop-2.14.4/sysdeps/solaris/cpu.c 2005-12-12 18:09:40.000000000 +0800 |
|
154 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/cpu.c 2006-11-13 20:28:00.175637000 +0800 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
155 |
@@ -36,6 +36,7 @@ static const unsigned long _glibtop_sysd |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
156 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
157 |
static const unsigned long _glibtop_sysdeps_cpu_all = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
158 |
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
159 |
+(1L << GLIBTOP_CPU_NICE) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
160 |
(1L << GLIBTOP_CPU_SYS) + (1L << GLIBTOP_CPU_IDLE) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
161 |
(1L << GLIBTOP_XCPU_TOTAL) + (1L << GLIBTOP_XCPU_USER) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
162 |
(1L << GLIBTOP_XCPU_SYS) + (1L << GLIBTOP_XCPU_IDLE) + |
8569 | 163 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/fsusage.c libgtop-2.14.4.mod/sysdeps/solaris/fsusage.c |
164 |
--- libgtop-2.14.4/sysdeps/solaris/fsusage.c 1970-01-01 08:00:00.000000000 +0800 |
|
165 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/fsusage.c 2006-11-13 20:28:00.181048000 +0800 |
|
8180 | 166 |
@@ -0,0 +1,99 @@ |
167 |
+#include <config.h> |
|
168 |
+#include <glibtop.h> |
|
169 |
+#include <glibtop/error.h> |
|
170 |
+#include <glibtop/fsusage.h> |
|
171 |
+#include <glibtop/union.h> |
|
172 |
+ |
|
173 |
+#include "glibtop_private.h" |
|
174 |
+ |
|
175 |
+#include <glib.h> |
|
176 |
+ |
|
177 |
+#include <unistd.h> |
|
178 |
+#include <kstat.h> |
|
179 |
+#include <sys/types.h> |
|
180 |
+#include <sys/stat.h> |
|
181 |
+#include <sys/statvfs.h> |
|
182 |
+ |
|
183 |
+#include <stdio.h> |
|
184 |
+#include <string.h> |
|
185 |
+#include <stdlib.h> |
|
186 |
+ |
|
187 |
+G_GNUC_INTERNAL void |
|
188 |
+_glibtop_sun_get_fsusage_read_write(glibtop *server, |
|
189 |
+ glibtop_fsusage *buf, |
|
190 |
+ const char *path) |
|
191 |
+{ |
|
192 |
+ struct statvfs64 statvfsbuf; |
|
193 |
+ char ksname[KSTAT_STRLEN + 1]; |
|
194 |
+ kstat_ctl_t * const kctl = server->machine.kc; |
|
195 |
+ kstat_t *ksp; |
|
196 |
+ kstat_io_t kio; |
|
197 |
+ kstat_named_t *kread, *kwrite; |
|
198 |
+ int i; |
|
199 |
+ |
|
200 |
+ /* |
|
201 |
+ * get a kstat handle and update the user's kstat chain |
|
202 |
+ */ |
|
203 |
+ if( kctl == NULL ){ |
|
204 |
+ glibtop_warn_io_r (server, "kstat_open ()"); |
|
205 |
+ return; |
|
206 |
+ } |
|
207 |
+ |
|
208 |
+ /* make sure we have current data */ |
|
209 |
+ while( kstat_chain_update( kctl ) != 0 ) |
|
210 |
+ ; |
|
211 |
+ |
|
212 |
+ for (ksp = kctl->kc_chain, i =0; ksp != NULL; ksp = ksp->ks_next, i++) { |
|
213 |
+ if (ksp->ks_type == KSTAT_TYPE_IO && strcmp(ksp->ks_class,"disk") == 0) { |
|
214 |
+ kstat_read(kctl, ksp, &kio); |
|
215 |
+ buf->read += kio.nread; |
|
216 |
+ buf->write += kio.nwritten; |
|
217 |
+ } |
|
218 |
+ } |
|
219 |
+#if 0 |
|
220 |
+ /* these codes keep here, because they are a good way to get the |
|
221 |
+ fsusage information, but at the moment, the interfaces used |
|
222 |
+ are not public or stable. so let's use them when public... |
|
223 |
+ */ |
|
224 |
+ /* |
|
225 |
+ * get a kstat handle and update the user's kstat chain |
|
226 |
+ */ |
|
227 |
+ if( kctl == NULL ){ |
|
228 |
+ glibtop_warn_io_r (server, "kstat_open ()"); |
|
229 |
+ return; |
|
230 |
+ } |
|
231 |
+ |
|
232 |
+ while( kstat_chain_update( kctl ) != 0 ) |
|
233 |
+ ; |
|
234 |
+ |
|
235 |
+ if (statvfs64(path, &statvfsbuf) != 0) { |
|
236 |
+ glibtop_warn_io_r (server, "kstat_open ()"); |
|
237 |
+ return; |
|
238 |
+ } |
|
239 |
+ snprintf(ksname, KSTAT_STRLEN, "%s%lx", VOPSTATS_STR, |
|
240 |
+ statvfsbuf.f_fsid); |
|
241 |
+ |
|
242 |
+ /* |
|
243 |
+ * traverse the kstat chain |
|
244 |
+ * to find the appropriate statistics |
|
245 |
+ */ |
|
246 |
+ if( (ksp = kstat_lookup( kctl, |
|
247 |
+ "unix", 0, ksname )) == NULL ) { |
|
248 |
+ return; |
|
249 |
+ } |
|
250 |
+ if( kstat_read( kctl, ksp, NULL ) == -1 ) { |
|
251 |
+ return; |
|
252 |
+ } |
|
253 |
+ |
|
254 |
+ kread = (kstat_named_t *)kstat_data_lookup(ksp,"read_bytes"); |
|
255 |
+ if( kread != NULL ) { |
|
256 |
+ buf->read = kread->value.ull; |
|
257 |
+ } |
|
258 |
+ |
|
259 |
+ kwrite = (kstat_named_t *)kstat_data_lookup(ksp,"write_bytes"); |
|
260 |
+ if( kwrite != NULL ) { |
|
261 |
+ buf->write = kwrite->value.ull; |
|
262 |
+ } |
|
263 |
+#endif |
|
264 |
+ buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE); |
|
265 |
+} |
|
8569 | 266 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/glibtop_machine.h libgtop-2.14.4.mod/sysdeps/solaris/glibtop_machine.h |
267 |
--- libgtop-2.14.4/sysdeps/solaris/glibtop_machine.h 2006-06-25 01:52:28.000000000 +0800 |
|
268 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/glibtop_machine.h 2006-11-13 20:28:00.176250000 +0800 |
|
8180 | 269 |
@@ -63,14 +63,7 @@ struct _glibtop_machine |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
270 |
int pagesize; /* in bits to shift, ie. 2^pagesize gives Kb */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
271 |
int ticks; /* clock ticks, as returned by sysconf() */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
272 |
unsigned long long boot; /* boot time, although it's ui32 in kstat */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
273 |
- void *libproc; /* libproc handle */ |
7833 | 274 |
-#if GLIBTOP_SOLARIS_RELEASE >= 50600 |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
275 |
- void (*objname)(void *, uintptr_t, const char *, size_t); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
276 |
- struct ps_prochandle *(*pgrab)(pid_t, int, int *); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
277 |
- void (*pfree)(void *); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
278 |
-#else |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
279 |
void *filler[3]; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
280 |
-#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
281 |
}; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
282 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
283 |
G_END_DECLS |
8569 | 284 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/glibtop_server.h libgtop-2.14.4.mod/sysdeps/solaris/glibtop_server.h |
285 |
--- libgtop-2.14.4/sysdeps/solaris/glibtop_server.h 2005-08-12 22:55:37.000000000 +0800 |
|
286 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/glibtop_server.h 2006-11-13 20:28:00.175760000 +0800 |
|
8180 | 287 |
@@ -31,9 +31,15 @@ G_BEGIN_DECLS |
288 |
#define GLIBTOP_SUID_SWAP 0 |
|
289 |
#define GLIBTOP_SUID_UPTIME 0 |
|
290 |
#define GLIBTOP_SUID_LOADAVG 0 |
|
291 |
+#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
292 |
#define GLIBTOP_SUID_SHM_LIMITS (1L << GLIBTOP_SYSDEPS_SHM_LIMITS) |
|
293 |
#define GLIBTOP_SUID_MSG_LIMITS (1L << GLIBTOP_SYSDEPS_MSG_LIMITS) |
|
294 |
#define GLIBTOP_SUID_SEM_LIMITS (1L << GLIBTOP_SYSDEPS_SEM_LIMITS) |
|
295 |
+#else |
|
296 |
+#define GLIBTOP_SUID_SHM_LIMITS 0 |
|
297 |
+#define GLIBTOP_SUID_MSG_LIMITS 0 |
|
298 |
+#define GLIBTOP_SUID_SEM_LIMITS 0 |
|
299 |
+#endif |
|
300 |
#define GLIBTOP_SUID_PROCLIST 0 |
|
301 |
#define GLIBTOP_SUID_PROC_STATE 0 |
|
302 |
#define GLIBTOP_SUID_PROC_UID 0 |
|
8569 | 303 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/msg_limits.c libgtop-2.14.4.mod/sysdeps/solaris/msg_limits.c |
304 |
--- libgtop-2.14.4/sysdeps/solaris/msg_limits.c 2006-06-25 01:16:53.000000000 +0800 |
|
305 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/msg_limits.c 2006-11-13 20:28:00.176742000 +0800 |
|
8180 | 306 |
@@ -39,14 +39,24 @@ static const unsigned long _glibtop_sysd |
307 |
(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGMNI) + |
|
308 |
(1L << GLIBTOP_IPC_MSGTQL); |
|
309 |
#else |
|
310 |
-static const unsigned long _glibtop_sysdeps_msg_limits = 0; |
|
311 |
+static const unsigned long _glibtop_sysdeps_msg_limits = |
|
312 |
+(1L << GLIBTOP_IPC_MSGMNB) + |
|
313 |
+(1L << GLIBTOP_IPC_MSGMNI) + |
|
314 |
+(1L << GLIBTOP_IPC_MSGMAX) + |
|
315 |
+(1L << GLIBTOP_IPC_MSGPOOL) + |
|
316 |
+(1L << GLIBTOP_IPC_MSGTQL); |
|
317 |
#endif |
|
318 |
||
319 |
||
320 |
/* Init function. */ |
|
321 |
||
322 |
+#if GLIBTOP_SUID_MSG_LIMITS |
|
323 |
void |
|
324 |
glibtop_init_msg_limits_p (glibtop *server) |
|
325 |
+#else |
|
326 |
+void |
|
327 |
+glibtop_init_msg_limits_s (glibtop *server) |
|
328 |
+#endif |
|
329 |
{ |
|
330 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
331 |
||
332 |
@@ -61,8 +71,13 @@ glibtop_init_msg_limits_p (glibtop *serv |
|
333 |
||
334 |
/* Provides information about sysv ipc limits. */ |
|
335 |
||
336 |
+#if GLIBTOP_SUID_MSG_LIMITS |
|
337 |
void |
|
338 |
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) |
|
339 |
+#else |
|
340 |
+void |
|
341 |
+glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf) |
|
342 |
+#endif |
|
343 |
{ |
|
344 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
345 |
||
8569 | 346 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/netlist.c libgtop-2.14.4.mod/sysdeps/solaris/netlist.c |
347 |
--- libgtop-2.14.4/sysdeps/solaris/netlist.c 2006-06-25 01:33:05.000000000 +0800 |
|
348 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/netlist.c 2006-11-13 20:28:00.176984000 +0800 |
|
349 |
@@ -41,7 +41,13 @@ glibtop_get_netlist_s (glibtop *server, |
|
8180 | 350 |
{ |
351 |
GPtrArray *devices; |
|
352 |
kstat_t *ksp; |
|
353 |
- kstat_ctl_t *kc; |
|
354 |
+ /* use the kc installed in server, don't need to create again, |
|
355 |
+ it will save some time and improve performance */ |
|
356 |
+ kstat_ctl_t * const kc = server->machine.kc; |
|
8569 | 357 |
+ /* use flags as a check condition, if it is 1, check, or not check... zhua */ |
8180 | 358 |
+ int check = buf->flags; |
8569 | 359 |
+ /* set flags back to 0 */ |
360 |
+ buf->flags = 0; |
|
8180 | 361 |
|
362 |
glibtop_init_s (&server, GLIBTOP_SYSDEPS_NETLIST, 0); |
|
363 |
||
8569 | 364 |
@@ -49,9 +55,9 @@ glibtop_get_netlist_s (glibtop *server, |
8180 | 365 |
|
366 |
devices = g_ptr_array_new(); |
|
367 |
||
368 |
- kc = kstat_open(); |
|
369 |
if (kc == NULL) { |
|
370 |
glibtop_warn_io_r(server, "kstat_open()"); |
|
371 |
+ buf->number = 0; |
|
372 |
return NULL; |
|
373 |
} |
|
374 |
||
8569 | 375 |
@@ -60,12 +66,27 @@ glibtop_get_netlist_s (glibtop *server, |
8180 | 376 |
if (strcmp(ksp->ks_class, "net") != 0) |
377 |
continue; |
|
378 |
||
379 |
- g_ptr_array_add(devices, g_strdup(ksp->ks_name)); |
|
380 |
- buf->number++; |
|
381 |
+ /* do some check to see if the first character is the same between |
|
382 |
+ name and module, if not, we don't return it, because |
|
383 |
+ glibtop_get_netload() only want the same ones.... |
|
384 |
+ */ |
|
385 |
+ if (check){ |
|
386 |
+ /* if the first character is not same, they should not |
|
387 |
+ the one we will use in glibtop_get_netload() */ |
|
388 |
+ if (ksp->ks_name[0] != ksp->ks_module[0]) |
|
389 |
+ continue; |
|
390 |
+ /* because in glibtop_get_netload(), name |
|
391 |
+ is at least 1 character longer than module */ |
|
392 |
+ if (strlen( ksp->ks_module ) >= strlen( ksp->ks_name)) |
|
393 |
+ continue; |
|
394 |
+ /* if it's not digital, continue directly */ |
|
395 |
+ if( !isdigit( (int) ksp->ks_name[strlen( ksp->ks_module )] )) |
|
396 |
+ continue; |
|
397 |
+ } |
|
398 |
+ g_ptr_array_add(devices, g_strdup(ksp->ks_name)); |
|
399 |
+ buf->number++; |
|
400 |
} |
|
401 |
||
402 |
- kstat_close(kc); |
|
403 |
- |
|
404 |
buf->flags = _glibtop_sysdeps_netlist; |
|
405 |
||
406 |
g_ptr_array_add(devices, NULL); |
|
8569 | 407 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/netload.c libgtop-2.14.4.mod/sysdeps/solaris/netload.c |
408 |
--- libgtop-2.14.4/sysdeps/solaris/netload.c 2005-12-12 18:09:40.000000000 +0800 |
|
409 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/netload.c 2006-11-13 20:28:00.177150000 +0800 |
|
8180 | 410 |
@@ -26,14 +26,247 @@ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
411 |
#include <glibtop/error.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
412 |
#include <glibtop/netload.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
413 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
414 |
-static const unsigned long _glibtop_sysdeps_netload = 0; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
415 |
+#include "glibtop_private.h" |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
416 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
417 |
+#include <errno.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
418 |
+#include <string.h> |
8180 | 419 |
+#include <kstat.h> |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
420 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
421 |
+#include <sys/types.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
422 |
+#include <sys/socket.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
423 |
+#include <sys/ioctl.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
424 |
+#include <sys/sockio.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
425 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
426 |
+//#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1 |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
427 |
+/* GNU LibC */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
428 |
+#include <net/if.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
429 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
430 |
+#ifdef HAVE_IFADDRS_H |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
431 |
+/* needed for IPV6 support */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
432 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
433 |
+#include <ifaddrs.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
434 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
435 |
+#ifndef IN6_IS_ADDR_GLOBAL |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
436 |
+#define IN6_IS_ADDR_GLOBAL(a) \ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
437 |
+ (((((__const uint8_t *) (a))[0] & 0xff) == 0x3f \ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
438 |
+ || (((__const uint8_t *) (a))[0] & 0xff) == 0x20)) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
439 |
+#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
440 |
+#endif /* HAVE_IFADDRS_H */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
441 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
442 |
+static const unsigned long _glibtop_sysdeps_netload = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
443 |
+(1L << GLIBTOP_NETLOAD_ERRORS_IN) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
444 |
+(1L << GLIBTOP_NETLOAD_ERRORS_OUT) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
445 |
+(1L << GLIBTOP_NETLOAD_COLLISIONS); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
446 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
447 |
+static const unsigned long _glibtop_sysdeps_netload_data = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
448 |
+(1L << GLIBTOP_NETLOAD_ADDRESS) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
449 |
+(1L << GLIBTOP_NETLOAD_SUBNET) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
450 |
+(1L << GLIBTOP_NETLOAD_MTU); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
451 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
452 |
+static const unsigned long _glibtop_sysdeps_netload_bytes = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
453 |
+(1L << GLIBTOP_NETLOAD_BYTES_IN) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
454 |
+(1L << GLIBTOP_NETLOAD_BYTES_OUT) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
455 |
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
456 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
457 |
+static const unsigned long _glibtop_sysdeps_netload_packets = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
458 |
+(1L << GLIBTOP_NETLOAD_PACKETS_IN) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
459 |
+(1L << GLIBTOP_NETLOAD_PACKETS_OUT) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
460 |
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
461 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
462 |
+static const unsigned long _glibtop_sysdeps_netload_total = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
463 |
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
464 |
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
465 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
466 |
+static const unsigned long _glibtop_sysdeps_netload_in = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
467 |
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
468 |
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
469 |
+(1L << GLIBTOP_NETLOAD_PACKETS_IN) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
470 |
+(1L << GLIBTOP_NETLOAD_BYTES_IN); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
471 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
472 |
+static const unsigned long _glibtop_sysdeps_netload_out = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
473 |
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
474 |
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
475 |
+(1L << GLIBTOP_NETLOAD_PACKETS_OUT) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
476 |
+(1L << GLIBTOP_NETLOAD_BYTES_OUT); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
477 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
478 |
+static const unsigned long _glibtop_sysdeps_netload_6 = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
479 |
+(1L << GLIBTOP_NETLOAD_ADDRESS6) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
480 |
+(1L << GLIBTOP_NETLOAD_PREFIX6) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
481 |
+(1L << GLIBTOP_NETLOAD_SCOPE6); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
482 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
483 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
484 |
/* Init function. */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
485 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
486 |
void |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
487 |
glibtop_init_netload_s (glibtop *server) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
488 |
{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
489 |
- server->sysdeps.netload = _glibtop_sysdeps_netload; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
490 |
+ server->sysdeps.netload = _glibtop_sysdeps_netload | |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
491 |
+ _glibtop_sysdeps_netload_bytes | |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
492 |
+ _glibtop_sysdeps_netload_packets; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
493 |
+} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
494 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
495 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
496 |
+#ifdef HAVE_IFADDRS_H |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
497 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
498 |
+static void get_ipv6(glibtop *server, glibtop_netload *buf, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
499 |
+ const char *interface) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
500 |
+{ |
8180 | 501 |
+/* |
502 |
+ * remove this code, because they are not available at Solaris, but keep them here for reference. |
|
503 |
+ * in fact, the function will not be called at Solaris, because HAVE_IFADDRS_H don't def. |
|
504 |
+ * |
|
505 |
+*/ |
|
506 |
+#if 0 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
507 |
+ struct ifaddrs *ifa0, *ifr6; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
508 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
509 |
+ if(getifaddrs (&ifa0) != 0) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
510 |
+ { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
511 |
+ glibtop_warn_r(server, "getifaddrs failed : %s", g_strerror(errno)); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
512 |
+ return; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
513 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
514 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
515 |
+ for (ifr6 = ifa0; ifr6; ifr6 = ifr6->ifa_next) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
516 |
+ if (strcmp (ifr6->ifa_name, interface) == 0 |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
517 |
+ && ifr6->ifa_addr != NULL |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
518 |
+ && ifr6->ifa_addr->sa_family == AF_INET6) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
519 |
+ break; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
520 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
521 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
522 |
+ if(!ifr6) goto free_ipv6; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
523 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
524 |
+ memcpy(buf->address6, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
525 |
+ &((struct sockaddr_in6 *) ifr6->ifa_addr)->sin6_addr, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
526 |
+ 16); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
527 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
528 |
+ memcpy(buf->prefix6, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
529 |
+ &((struct sockaddr_in6 *) ifr6->ifa_netmask)->sin6_addr, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
530 |
+ 16); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
531 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
532 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
533 |
+ if (IN6_IS_ADDR_LINKLOCAL (buf->address6)) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
534 |
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_LINK; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
535 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
536 |
+ else if (IN6_IS_ADDR_SITELOCAL (buf->address6)) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
537 |
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_SITE; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
538 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
539 |
+ else if (IN6_IS_ADDR_GLOBAL (buf->address6) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
540 |
+ || IN6_IS_ADDR_MC_ORGLOCAL (buf->address6) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
541 |
+ || IN6_IS_ADDR_V4COMPAT (buf->address6) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
542 |
+ || IN6_IS_ADDR_MULTICAST (buf->address6) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
543 |
+ || IN6_IS_ADDR_UNSPECIFIED (buf->address6) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
544 |
+ ) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
545 |
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_GLOBAL; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
546 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
547 |
+ else if (IN6_IS_ADDR_LOOPBACK (buf->address6)) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
548 |
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_HOST; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
549 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
550 |
+ else |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
551 |
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_UNKNOWN; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
552 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
553 |
+ buf->flags |= _glibtop_sysdeps_netload_6; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
554 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
555 |
+ free_ipv6: |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
556 |
+ freeifaddrs(ifa0); |
8180 | 557 |
+#endif |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
558 |
+} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
559 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
560 |
+#endif /* HAVE_IFADDRS_H */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
561 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
562 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
563 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
564 |
+static int |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
565 |
+solaris_stats(glibtop *server, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
566 |
+ glibtop_netload *buf, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
567 |
+ const char *interface) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
568 |
+{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
569 |
+ char *name = interface; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
570 |
+ char *module; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
571 |
+ char *ptr; |
8180 | 572 |
+ kstat_ctl_t * const kctl = server->machine.kc; |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
573 |
+ kstat_t *ksp; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
574 |
+ kstat_named_t *kdata; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
575 |
+ int have_bytes = 1; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
576 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
577 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
578 |
+ * chop off the trailing interface and |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
579 |
+ */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
580 |
+ module = strdup( name ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
581 |
+ ptr = module + strlen( module ) - 1; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
582 |
+ while( (ptr > module) && isdigit( (int) *ptr ) ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
583 |
+ *ptr = '\0'; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
584 |
+ ptr--; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
585 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
586 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
587 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
588 |
+ * get a kstat handle and update the user's kstat chain |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
589 |
+ */ |
8180 | 590 |
+ if( kctl == NULL ){ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
591 |
+ glibtop_warn_io_r (server, "kstat_open ()"); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
592 |
+ free( module ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
593 |
+ return( 0 ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
594 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
595 |
+ while( kstat_chain_update( kctl ) != 0 ) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
596 |
+ ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
597 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
598 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
599 |
+ * traverse the kstat chain |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
600 |
+ * to find the appropriate statistics |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
601 |
+ */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
602 |
+ if( (ksp = kstat_lookup( kctl, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
603 |
+ module, 0, name )) == NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
604 |
+ free( module ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
605 |
+ return( 0 ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
606 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
607 |
+ if( kstat_read( kctl, ksp, NULL ) == -1 ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
608 |
+ free( module ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
609 |
+ return( 0 ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
610 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
611 |
+ free( module ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
612 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
613 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
614 |
+ * lookup & store the data |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
615 |
+ */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
616 |
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "ipackets" ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
617 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
618 |
+ buf->packets_in= kdata->value.ul; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
619 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
620 |
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "opackets" ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
621 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
622 |
+ buf->packets_out = kdata->value.ul; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
623 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
624 |
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "rbytes" ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
625 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
626 |
+ buf->bytes_in =kdata->value.ul; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
627 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
628 |
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "obytes" ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
629 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
630 |
+ buf->bytes_out =kdata->value.ul; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
631 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
632 |
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "ierrors" ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
633 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
634 |
+ buf->errors_in = kdata->value.ul; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
635 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
636 |
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "oerrors" ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
637 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
638 |
+ buf->errors_out = kdata->value.ul; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
639 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
640 |
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "collisions" ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
641 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
642 |
+ buf->collisions = kdata->value.ul; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
643 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
644 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
645 |
+ /* Compute total valules. */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
646 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
647 |
+ buf->bytes_total = buf->bytes_in + buf->bytes_out; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
648 |
+ buf->packets_total = buf->packets_in + buf->packets_out; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
649 |
+ buf->errors_total = buf->errors_in + buf->errors_out; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
650 |
+ /* And now the flags. */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
651 |
+ buf->flags |= _glibtop_sysdeps_netload; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
652 |
+ buf->flags |= _glibtop_sysdeps_netload_bytes; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
653 |
+ buf->flags |= _glibtop_sysdeps_netload_packets; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
654 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
655 |
+ /* finished */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
656 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
657 |
} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
658 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
659 |
/* Provides network statistics. */ |
8180 | 660 |
@@ -42,5 +275,73 @@ void |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
661 |
glibtop_get_netload_s (glibtop *server, glibtop_netload *buf, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
662 |
const char *interface) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
663 |
{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
664 |
- memset (buf, 0, sizeof (glibtop_netload)); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
665 |
+ int skfd; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
666 |
+ memset (buf, 0, sizeof (glibtop_netload)); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
667 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
668 |
+ /* set flag */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
669 |
+ skfd = socket (PF_INET, SOCK_DGRAM, 0); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
670 |
+ if (skfd) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
671 |
+ struct ifreq ifr; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
672 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
673 |
+ g_strlcpy (ifr.ifr_name, interface, sizeof ifr.ifr_name); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
674 |
+ if (ioctl (skfd, SIOCGIFFLAGS, &ifr) >= 0) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
675 |
+ const unsigned long long flags = ifr.ifr_flags; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
676 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
677 |
+ buf->flags |= (1L << GLIBTOP_NETLOAD_IF_FLAGS); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
678 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
679 |
+ if (flags & IFF_UP) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
680 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_UP); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
681 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
682 |
+ if (flags & IFF_BROADCAST) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
683 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_BROADCAST); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
684 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
685 |
+ if (flags & IFF_DEBUG) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
686 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_DEBUG); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
687 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
688 |
+ if (flags & IFF_LOOPBACK) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
689 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
690 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
691 |
+ if (flags & IFF_POINTOPOINT) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
692 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
693 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
694 |
+ if (flags & IFF_RUNNING) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
695 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
696 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
697 |
+ if (flags & IFF_NOARP) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
698 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
699 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
700 |
+ if (flags & IFF_PROMISC) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
701 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
702 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
703 |
+ if (flags & IFF_ALLMULTI) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
704 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
705 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
706 |
+ if (flags & IFF_MULTICAST) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
707 |
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_MULTICAST); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
708 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
709 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
710 |
+ g_strlcpy (ifr.ifr_name, interface, sizeof ifr.ifr_name); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
711 |
+ if (!ioctl (skfd, SIOCGIFADDR, &ifr)) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
712 |
+ buf->address = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
713 |
+ buf->flags |= (1L << GLIBTOP_NETLOAD_ADDRESS); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
714 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
715 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
716 |
+ g_strlcpy (ifr.ifr_name, interface, sizeof ifr.ifr_name); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
717 |
+ if (!ioctl (skfd, SIOCGIFNETMASK, &ifr)) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
718 |
+ buf->subnet = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
719 |
+ buf->flags |= (1L << GLIBTOP_NETLOAD_SUBNET); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
720 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
721 |
+ close (skfd); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
722 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
723 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
724 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
725 |
+ * Statistics |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
726 |
+ */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
727 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
728 |
+ solaris_stats(server, buf, interface); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
729 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
730 |
+#ifdef HAVE_IFADDRS_H |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
731 |
+ get_ipv6(server, buf, interface); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
732 |
+#endif /* HAVE_IFADDRS_H */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
733 |
} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
734 |
+ |
8569 | 735 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/open.c libgtop-2.14.4.mod/sysdeps/solaris/open.c |
736 |
--- libgtop-2.14.4/sysdeps/solaris/open.c 2006-06-25 01:39:49.000000000 +0800 |
|
737 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/open.c 2006-11-13 20:28:00.178413000 +0800 |
|
8180 | 738 |
@@ -211,34 +211,5 @@ glibtop_open_s (glibtop *server, const c |
739 |
} |
|
740 |
} |
|
741 |
||
742 |
- /* Now let's have a bit of magic dust... */ |
|
743 |
- |
|
744 |
-#if GLIBTOP_SOLARIS_RELEASE >= 50600 |
|
745 |
- |
|
746 |
- dl = dlopen("/usr/lib/libproc.so", RTLD_LAZY); |
|
747 |
- if(server->machine.libproc) |
|
748 |
- dlclose(server->machine.libproc); |
|
749 |
- server->machine.libproc = dl; |
|
750 |
- if(dl) |
|
751 |
- { |
|
752 |
- void *func; |
|
753 |
- |
|
754 |
- func = dlsym(dl, "Pobjname"); /* Solaris 8 */ |
|
755 |
- if(!func) |
|
756 |
- func = dlsym(dl, "proc_objname"); /* Solaris 7 */ |
|
757 |
- server->machine.objname = (void (*) |
|
758 |
- (void *, uintptr_t, const char *, size_t))func; |
|
759 |
- server->machine.pgrab = (struct ps_prochandle *(*)(pid_t, int, int *)) |
|
760 |
- dlsym(dl, "Pgrab"); |
|
761 |
- server->machine.pfree = (void (*)(void *))dlsym(dl, "Pfree"); |
|
762 |
- |
|
763 |
- } |
|
764 |
- else |
|
765 |
- { |
|
766 |
- server->machine.objname = NULL; |
|
767 |
- server->machine.pgrab = NULL; |
|
768 |
- server->machine.pfree = NULL; |
|
769 |
- } |
|
770 |
-#endif |
|
771 |
server->machine.me = getpid(); |
|
772 |
} |
|
8569 | 773 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/procmap.c libgtop-2.14.4.mod/sysdeps/solaris/procmap.c |
774 |
--- libgtop-2.14.4/sysdeps/solaris/procmap.c 2006-06-25 01:45:29.000000000 +0800 |
|
775 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/procmap.c 2006-11-13 21:43:09.817707000 +0800 |
|
776 |
@@ -56,6 +56,12 @@ glibtop_map_entry * |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
777 |
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
778 |
{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
779 |
int fd, i, nmaps, pr_err, heap; |
8180 | 780 |
+ char filename [BUFSIZ]; |
8569 | 781 |
+ /* use flags as a check condition, if it is 1, check, or, not check... zhua */ |
782 |
+ int check = buf->flags; |
|
783 |
+ /* set flags back to 0 */ |
|
784 |
+ buf->flags = 0; |
|
785 |
+ |
|
7833 | 786 |
#if GLIBTOP_SOLARIS_RELEASE >= 50600 |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
787 |
prxmap_t *maps; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
788 |
struct ps_prochandle *Pr = NULL; |
8569 | 789 |
@@ -125,15 +131,29 @@ glibtop_get_proc_map_s (glibtop *server, |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
790 |
buf->total = nmaps * sizeof(glibtop_map_entry); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
791 |
entry = g_malloc0(buf->total); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
792 |
|
7833 | 793 |
-#if GLIBTOP_SOLARIS_RELEASE >= 50600 |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
794 |
- |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
795 |
- if(server->machine.objname && server->machine.pgrab && |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
796 |
- server->machine.pfree) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
797 |
- Pr = (server->machine.pgrab)(pid, 1, &pr_err); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
798 |
-#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
799 |
for(heap = 0,i = 0; i < nmaps; ++i) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
800 |
{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
801 |
- int len; |
8569 | 802 |
+ /* take a check to see if we need all information, if not, just get what we need.. |
803 |
+ Also please see comments in get_process_memory_writable() of gnome-system-monitor zhua */ |
|
804 |
+ if (check == 1) |
|
805 |
+ { |
|
806 |
+ if(maps[i].pr_mflags & MA_WRITE){ |
|
807 |
+ entry[i].perm |= GLIBTOP_MAP_PERM_WRITE; |
|
808 |
+ entry[i].size = maps[i].pr_size; |
|
809 |
+ } |
|
810 |
+ } |
|
811 |
+ else |
|
812 |
+ if (check == 2) |
|
813 |
+ { |
|
814 |
+ if(maps[i].pr_mflags & MA_SHARED){ |
|
815 |
+ entry[i].perm |= GLIBTOP_MAP_PERM_SHARED; |
|
816 |
+ /* here use shared_clean to store Shared Memory */ |
|
817 |
+ entry[i].shared_clean = maps[i].pr_size; |
|
818 |
+ } |
|
819 |
+ } |
|
820 |
+ else { |
|
821 |
+ |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
822 |
+ int len, rv; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
823 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
824 |
entry[i].start = maps[i].pr_vaddr; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
825 |
entry[i].end = maps[i].pr_vaddr + maps[i].pr_size; |
8569 | 826 |
@@ -156,8 +176,12 @@ glibtop_get_proc_map_s (glibtop *server, |
8180 | 827 |
} |
828 |
if(maps[i].pr_mflags & MA_EXEC) |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
829 |
entry[i].perm |= GLIBTOP_MAP_PERM_EXECUTE; |
8180 | 830 |
- if(maps[i].pr_mflags & MA_SHARED) |
831 |
- entry[i].perm |= GLIBTOP_MAP_PERM_SHARED; |
|
832 |
+ if(maps[i].pr_mflags & MA_SHARED){ |
|
833 |
+ entry[i].perm |= GLIBTOP_MAP_PERM_SHARED; |
|
834 |
+ /* here use shared_clean to store Shared Memory */ |
|
835 |
+ entry[i].shared_clean = maps[i].pr_size; |
|
836 |
+ } |
|
837 |
+ |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
838 |
else |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
839 |
entry[i].perm |= GLIBTOP_MAP_PERM_PRIVATE; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
840 |
entry[i].flags = _glibtop_sysdeps_map_entry; |
8569 | 841 |
@@ -179,25 +203,25 @@ glibtop_get_proc_map_s (glibtop *server, |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
842 |
entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
843 |
} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
844 |
else |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
845 |
- if(Pr) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
846 |
- { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
847 |
- server->machine.objname(Pr, maps[i].pr_vaddr, buffer, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
848 |
- BUFSIZ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
849 |
- if((len = resolvepath(buffer, entry[i].filename, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
850 |
- GLIBTOP_MAP_FILENAME_LEN)) > 0) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
851 |
- { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
852 |
- entry[i].filename[len] = 0; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
853 |
- entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
854 |
- } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
855 |
- } |
8180 | 856 |
+ { |
857 |
+ strcpy(buffer, maps[i].pr_mapname); |
|
858 |
+ /* from /path get file name */ |
|
859 |
+ g_snprintf(filename, sizeof filename, "/proc/%d/path/%s", |
|
860 |
+ pid, buffer); |
|
861 |
+ |
|
862 |
+ rv = readlink(filename, entry[i].filename, sizeof(entry[i].filename) - 1); |
|
863 |
+ /* read object, if have not, set it as NULL */ |
|
864 |
+ if(rv < 0) |
|
865 |
+ rv = 0; |
|
866 |
+ entry[i].filename[rv] = '\0'; |
|
867 |
+ /* now set the flags */ |
|
868 |
+ entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME); |
|
869 |
+ } |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
870 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
871 |
#endif |
8569 | 872 |
+ } /* end of else check */ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
873 |
} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
874 |
|
7833 | 875 |
-#if GLIBTOP_SOLARIS_RELEASE >= 50600 |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
876 |
- |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
877 |
- if(Pr) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
878 |
- server->machine.pfree(Pr); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
879 |
-#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
880 |
buf->flags = _glibtop_sysdeps_proc_map; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
881 |
s_close(fd); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
882 |
return entry; |
8569 | 883 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/procmem.c libgtop-2.14.4.mod/sysdeps/solaris/procmem.c |
884 |
--- libgtop-2.14.4/sysdeps/solaris/procmem.c 2005-12-12 18:09:40.000000000 +0800 |
|
885 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/procmem.c 2006-11-13 21:57:58.082161000 +0800 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
886 |
@@ -24,6 +24,7 @@ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
887 |
#include <config.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
888 |
#include <glibtop.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
889 |
#include <glibtop/procmem.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
890 |
+#include <glibtop/procmap.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
891 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
892 |
#include "glibtop_private.h" |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
893 |
|
8569 | 894 |
@@ -59,9 +60,38 @@ glibtop_get_proc_mem_s (glibtop *server, |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
895 |
#ifdef HAVE_PROCFS_H |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
896 |
buf->size = buf->vsize = psinfo.pr_size << 10; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
897 |
buf->resident = buf->rss = psinfo.pr_rssize << 10; |
8180 | 898 |
+ buf->load = (guint) psinfo.pr_lwp.pr_pctcpu * 100 / (guint) 0x8000; |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
899 |
#else |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
900 |
buf->size = buf->vsize = psinfo.pr_size << pagesize << 10; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
901 |
buf->resident = buf->rss = psinfo.pr_rssize << pagesize << 10; |
8180 | 902 |
+ buf->load = (guint) psinfo.pr_lwp.pr_pctcpu * 100 / (guint) 0x8000; |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
903 |
#endif |
8180 | 904 |
+ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
905 |
+/* get Shared Memory */ |
8180 | 906 |
+ glibtop_proc_map mapbuf; |
907 |
+ glibtop_map_entry *maps; |
|
908 |
+ unsigned i; |
|
909 |
+ buf->share = 0; |
|
8569 | 910 |
+ |
911 |
+ /* we have to optimize the performance of libgtop, because update the information will occupy too much cpu. |
|
912 |
+ |
|
913 |
+ here I would like to make a little update:set glibtop_proc_map.flags=1,so as to let glibtop_get_proc_map_s() |
|
914 |
+ only return the ones this function need: memwritable |
|
915 |
+ |
|
916 |
+ we do the check in glibtop_get_proc_map_s(), don't run the others part which don't need by this function, |
|
917 |
+ I think this will accelerate the transaction lots, |
|
918 |
+ Also this will not affect the existing codes, because when nobody set glibtop_proc_map.flags, |
|
919 |
+ glibtop_get_proc_map() will return all as before. zhua |
|
920 |
+ */ |
|
921 |
+ mapbuf.flags = 2; |
|
8180 | 922 |
+ |
923 |
+ maps = glibtop_get_proc_map_s(server, &mapbuf, pid); |
|
924 |
+ |
|
925 |
+ for (i = 0; i < mapbuf.number; ++i) { |
|
926 |
+ if (maps[i].perm & GLIBTOP_MAP_PERM_SHARED) |
|
927 |
+ buf->share += maps[i].shared_clean; |
|
928 |
+ } |
|
929 |
+ g_free(maps); |
|
930 |
+ |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
931 |
buf->flags = _glibtop_sysdeps_proc_mem; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
932 |
} |
8569 | 933 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/proctime.c libgtop-2.14.4.mod/sysdeps/solaris/proctime.c |
934 |
--- libgtop-2.14.4/sysdeps/solaris/proctime.c 2006-06-25 01:47:34.000000000 +0800 |
|
935 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/proctime.c 2006-11-13 20:28:00.179929000 +0800 |
|
8180 | 936 |
@@ -45,8 +45,12 @@ void |
937 |
glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, |
|
938 |
pid_t pid) |
|
939 |
{ |
|
940 |
+#ifdef HAVE_PROCFS_H |
|
941 |
+ struct psinfo pinfo; |
|
942 |
+#else |
|
943 |
+ struct prpsinfo pinfo; |
|
944 |
+#endif |
|
945 |
struct prusage prusage; |
|
946 |
- GTimeVal time; |
|
947 |
||
948 |
memset (buf, 0, sizeof (glibtop_proc_time)); |
|
949 |
||
950 |
@@ -54,19 +58,18 @@ glibtop_get_proc_time_s (glibtop *server |
|
951 |
||
952 |
if(pid) |
|
953 |
{ |
|
954 |
+ if (glibtop_get_proc_data_psinfo_s(server, &pinfo, pid)) |
|
955 |
+ return; |
|
956 |
+ buf->start_time = pinfo.pr_start.tv_sec; |
|
957 |
+ |
|
958 |
if (glibtop_get_proc_data_usage_s (server, &prusage, pid)) |
|
959 |
return; |
|
960 |
||
961 |
- g_get_current_time (&time); |
|
962 |
- /* prusage.pr_rtime.tv_sec is the during that the process existed */ |
|
963 |
- buf->start_time = time.tv_sec - prusage.pr_rtime.tv_sec; |
|
964 |
- |
|
965 |
- buf->rtime = prusage.pr_rtime.tv_sec * 1E+6 + |
|
966 |
- prusage.pr_rtime.tv_nsec / 1E+3; |
|
967 |
buf->utime = prusage.pr_utime.tv_sec * 1E+6 + |
|
968 |
prusage.pr_utime.tv_nsec / 1E+3; |
|
969 |
buf->stime = prusage.pr_stime.tv_sec * 1E+6 + |
|
970 |
prusage.pr_stime.tv_nsec / 1E+3; |
|
971 |
+ buf->rtime = (buf->utime + buf->stime) / 10000; |
|
972 |
} |
|
973 |
||
974 |
buf->flags = _glibtop_sysdeps_proc_time; |
|
8569 | 975 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/sem_limits.c libgtop-2.14.4.mod/sysdeps/solaris/sem_limits.c |
976 |
--- libgtop-2.14.4/sysdeps/solaris/sem_limits.c 2006-06-25 01:16:53.000000000 +0800 |
|
977 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/sem_limits.c 2006-11-13 20:28:00.179799000 +0800 |
|
8180 | 978 |
@@ -41,14 +41,22 @@ static const unsigned long _glibtop_sysd |
979 |
(1L << GLIBTOP_IPC_SEMUSZ) + (1L << GLIBTOP_IPC_SEMVMX) + |
|
980 |
(1L << GLIBTOP_IPC_SEMAEM); |
|
981 |
#else |
|
982 |
-static const unsigned long _glibtop_sysdeps_sem_limits = 0; |
|
983 |
+static const unsigned long _glibtop_sysdeps_sem_limits = |
|
984 |
+(1L << GLIBTOP_IPC_SEMMNI) + |
|
985 |
+(1L << GLIBTOP_IPC_SEMMSL) + |
|
986 |
+(1L << GLIBTOP_IPC_SEMOPM); |
|
987 |
#endif |
|
988 |
||
989 |
||
990 |
/* Init function. */ |
|
991 |
||
992 |
+#if GLIBTOP_SUID_SEM_LIMITS |
|
993 |
void |
|
994 |
glibtop_init_sem_limits_p (glibtop *server) |
|
995 |
+#else |
|
996 |
+void |
|
997 |
+glibtop_init_sem_limits_s (glibtop *server) |
|
998 |
+#endif |
|
999 |
{ |
|
1000 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
1001 |
||
1002 |
@@ -63,8 +71,13 @@ glibtop_init_sem_limits_p (glibtop *serv |
|
1003 |
||
1004 |
/* Provides information about sysv sem limits. */ |
|
1005 |
||
1006 |
+#if GLIBTOP_SUID_SEM_LIMITS |
|
1007 |
void |
|
1008 |
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) |
|
1009 |
+#else |
|
1010 |
+void |
|
1011 |
+glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) |
|
1012 |
+#endif |
|
1013 |
{ |
|
1014 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
1015 |
kvm_t *kd = server->machine.kd; |
|
8569 | 1016 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/shm_limits.c libgtop-2.14.4.mod/sysdeps/solaris/shm_limits.c |
1017 |
--- libgtop-2.14.4/sysdeps/solaris/shm_limits.c 2006-06-25 01:16:53.000000000 +0800 |
|
1018 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/shm_limits.c 2006-11-13 20:28:00.175514000 +0800 |
|
8180 | 1019 |
@@ -32,7 +32,9 @@ |
1020 |
static const struct nlist nlst[] = { {"glibtop_shm_limits"}, {NULL} }; |
|
1021 |
||
1022 |
#if GLIBTOP_SOLARIS_RELEASE >=51000 |
|
1023 |
-static const unsigned long _glibtop_sysdeps_shm_limits = 0; |
|
1024 |
+static const unsigned long _glibtop_sysdeps_shm_limits = |
|
1025 |
+(1L << GLIBTOP_IPC_SHMMAX) + |
|
1026 |
+(1L << GLIBTOP_IPC_SHMMIN); |
|
1027 |
#else |
|
1028 |
# if GLIBTOP_SOLARIS_RELEASE < 50900 |
|
1029 |
static const unsigned long _glibtop_sysdeps_shm_limits = |
|
1030 |
@@ -47,8 +49,13 @@ static const unsigned long _glibtop_sysd |
|
1031 |
||
1032 |
/* Init function. */ |
|
1033 |
||
1034 |
+#if GLIBTOP_SUID_SHM_LIMITS |
|
1035 |
void |
|
1036 |
glibtop_init_shm_limits_p (glibtop *server) |
|
1037 |
+#else |
|
1038 |
+void |
|
1039 |
+glibtop_init_shm_limits_s (glibtop *server) |
|
1040 |
+#endif |
|
1041 |
{ |
|
1042 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
1043 |
||
1044 |
@@ -63,8 +70,13 @@ glibtop_init_shm_limits_p (glibtop *serv |
|
1045 |
||
1046 |
/* Provides information about sysv ipc limits. */ |
|
1047 |
||
1048 |
+#if GLIBTOP_SUID_SHM_LIMITS |
|
1049 |
void |
|
1050 |
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) |
|
1051 |
+#else |
|
1052 |
+void |
|
1053 |
+glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf) |
|
1054 |
+#endif |
|
1055 |
{ |
|
1056 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
1057 |
||
8569 | 1058 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/siglist.c libgtop-2.14.4.mod/sysdeps/solaris/siglist.c |
1059 |
--- libgtop-2.14.4/sysdeps/solaris/siglist.c 2005-12-12 18:09:40.000000000 +0800 |
|
1060 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/siglist.c 2006-11-13 20:28:00.180643000 +0800 |
|
8180 | 1061 |
@@ -63,6 +63,7 @@ const glibtop_signame glibtop_sys_siglis |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1062 |
{ 35, "SIGTHAW", "Checkpoint Thaw" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1063 |
{ 36, "SIGCANCEL","Thread Cancelation" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1064 |
{ 37, "SIGLOST", "Resource Lost" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1065 |
+#if GLIBTOP_SOLARIS_RELEASE < 50900 /* S8 */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1066 |
{ 38, "SIGRTMIN","First Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1067 |
{ 39, "SIGRTMIN+1", "Second Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1068 |
{ 40, "SIGRTMIN+2", "Third Realtime Signal" }, |
8180 | 1069 |
@@ -71,5 +72,30 @@ const glibtop_signame glibtop_sys_siglis |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1070 |
{ 43, "SIGRTMAX-2", "Third Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1071 |
{ 44, "SIGRTMAX-1", "Second Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1072 |
{ 45, "SIGRTMAX", "Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1073 |
+#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1074 |
+#if GLIBTOP_SOLARIS_RELEASE >= 50900 |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1075 |
+ { 38, "SIGXRES","Resource Control Exceeded" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1076 |
+#if GLIBTOP_SOLARIS_RELEASE <51000 /* signal here existed in s9 */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1077 |
+ { 39, "SIGRTMIN","First Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1078 |
+ { 40, "SIGRTMIN+1", "Second Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1079 |
+ { 41, "SIGRTMIN+2", "Third Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1080 |
+ { 42, "SIGRTMIN+3", "Fourth Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1081 |
+ { 43, "SIGRTMAX-3", "Fourth Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1082 |
+ { 44, "SIGRTMAX-2", "Third Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1083 |
+ { 45, "SIGRTMAX-1", "Second Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1084 |
+ { 46, "SIGRTMAX", "Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1085 |
+#else /* signal here existed in s10 and s11 */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1086 |
+ { 39, "SIGJVM1","Reserved signal for Java Virtual Machine" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1087 |
+ { 40, "SIGJVM1","Reserved signal for Java Virtual Machine" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1088 |
+ { 41, "SIGRTMIN","First Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1089 |
+ { 42, "SIGRTMIN+1", "Second Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1090 |
+ { 43, "SIGRTMIN+2", "Third Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1091 |
+ { 44, "SIGRTMIN+3", "Fourth Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1092 |
+ { 45, "SIGRTMAX-3", "Fourth Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1093 |
+ { 46, "SIGRTMAX-2", "Third Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1094 |
+ { 47, "SIGRTMAX-1", "Second Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1095 |
+ { 48, "SIGRTMAX", "Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1096 |
+#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1097 |
+#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1098 |
{ 0, NULL, NULL } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1099 |
}; |
8569 | 1100 |
diff -Nrup libgtop-2.14.4/sysdeps/solaris/sysinfo.c libgtop-2.14.4.mod/sysdeps/solaris/sysinfo.c |
1101 |
--- libgtop-2.14.4/sysdeps/solaris/sysinfo.c 1970-01-01 08:00:00.000000000 +0800 |
|
1102 |
+++ libgtop-2.14.4.mod/sysdeps/solaris/sysinfo.c 2006-11-13 20:28:00.181313000 +0800 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1103 |
@@ -0,0 +1,48 @@ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1104 |
+/* $Id: sysinfo.c,v 1.22 2004/11/28 01:32:55 bdejean Exp $ */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1105 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1106 |
+/* Copyright (C) 1998-99 Martin Baulig |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1107 |
+ This file is part of LibGTop 1.0. |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1108 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1109 |
+ Contributed by Martin Baulig <[email protected]>, April 1998. |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1110 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1111 |
+ LibGTop is free software; you can redistribute it and/or modify it |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1112 |
+ under the terms of the GNU General Public License as published by |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1113 |
+ the Free Software Foundation; either version 2 of the License, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1114 |
+ or (at your option) any later version. |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1115 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1116 |
+ LibGTop is distributed in the hope that it will be useful, but WITHOUT |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1117 |
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1118 |
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1119 |
+ for more details. |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1120 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1121 |
+ You should have received a copy of the GNU General Public License |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1122 |
+ along with LibGTop; see the file COPYING. If not, write to the |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1123 |
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1124 |
+ Boston, MA 02111-1307, USA. |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1125 |
+*/ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1126 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1127 |
+#include <config.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1128 |
+#include <glibtop/error.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1129 |
+#include <glibtop/cpu.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1130 |
+#include <glibtop/sysinfo.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1131 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1132 |
+#include "glibtop_private.h" |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1133 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1134 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1135 |
+static const unsigned long _glibtop_sysdeps_sysinfo = |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1136 |
+(1L << GLIBTOP_SYSINFO_CPUINFO); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1137 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1138 |
+static glibtop_sysinfo sysinfo = { .flags = 0 }; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1139 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1140 |
+static void |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1141 |
+init_sysinfo (glibtop *server) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1142 |
+{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1143 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1144 |
+} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1145 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1146 |
+const glibtop_sysinfo * |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1147 |
+glibtop_get_sysinfo_s (glibtop *server) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1148 |
+{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1149 |
+ init_sysinfo (server); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1150 |
+ return &sysinfo; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1151 |
+} |