author | henryz |
Mon, 21 May 2007 05:08:54 +0000 | |
changeset 9929 | 8c01771021fc |
parent 9127 | f7a20a7df8f1 |
child 9988 | a349549365dc |
permissions | -rw-r--r-- |
9929 | 1 |
diff -Nrup libgtop-2.19.2/include/glibtop/error.h libgtop-2.19.2.mod/include/glibtop/error.h |
2 |
--- libgtop-2.19.2/include/glibtop/error.h 2007-04-27 06:27:30.000000000 +0800 |
|
3 |
+++ libgtop-2.19.2.mod/include/glibtop/error.h 2007-05-18 15:42:44.742763000 +0800 |
|
4 |
@@ -31,20 +31,20 @@ |
|
7660
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 |
|
9929 | 39 |
diff -Nrup libgtop-2.19.2/include/glibtop/procstate.h libgtop-2.19.2.mod/include/glibtop/procstate.h |
40 |
--- libgtop-2.19.2/include/glibtop/procstate.h 2007-04-27 06:27:30.000000000 +0800 |
|
41 |
+++ libgtop-2.19.2.mod/include/glibtop/procstate.h 2007-05-18 15:45:06.525673000 +0800 |
|
42 |
@@ -64,11 +64,19 @@ struct _glibtop_proc_state |
|
9057 | 43 |
* fields if their values are corrent ! */ |
44 |
int uid; /* UID of process */ |
|
45 |
int gid; /* GID of process */ |
|
46 |
- int ruid; |
|
47 |
- int rgid; |
|
48 |
- int has_cpu; |
|
49 |
- int processor; |
|
50 |
- int last_processor; |
|
9929 | 51 |
+ int ruid; |
52 |
+ int rgid; |
|
53 |
+ int has_cpu; |
|
54 |
+ int processor; |
|
55 |
+ int last_processor; |
|
56 |
+ |
|
9057 | 57 |
+ gint32 nice; /*zhua: used to store nice */ |
58 |
+ guint64 start_time; /* start time of process -- */ |
|
59 |
+ guint64 vsize; /* number of pages of virtual memory ... */ |
|
60 |
+ guint64 resident; /* number of resident set */ |
|
61 |
+ guint load; /* cpu load for process */ |
|
62 |
+ gint32 ppid; /* pid of parent process */ |
|
63 |
+ |
|
64 |
}; |
|
65 |
||
66 |
void glibtop_get_proc_state(glibtop_proc_state *buf, pid_t pid); |
|
9929 | 67 |
diff -Nrup libgtop-2.19.2/lib/libgtop.sym libgtop-2.19.2.mod/lib/libgtop.sym |
68 |
--- libgtop-2.19.2/lib/libgtop.sym 2007-05-13 05:54:57.000000000 +0800 |
|
69 |
+++ libgtop-2.19.2.mod/lib/libgtop.sym 2007-05-19 00:09:27.355595000 +0800 |
|
70 |
@@ -1,118 +1,89 @@ |
|
71 |
glibtop_call_l |
|
72 |
-glibtop_call_p |
|
73 |
glibtop_close |
|
74 |
glibtop_close_p |
|
75 |
glibtop_close_r |
|
76 |
glibtop_close_s |
|
77 |
glibtop_get_cpu |
|
78 |
glibtop_get_cpu_l |
|
79 |
-glibtop_get_cpu_p |
|
80 |
glibtop_get_cpu_s |
|
81 |
glibtop_get_fsusage |
|
82 |
glibtop_get_fsusage_l |
|
83 |
-glibtop_get_fsusage_p |
|
84 |
glibtop_get_fsusage_s |
|
85 |
glibtop_get_loadavg |
|
86 |
glibtop_get_loadavg_l |
|
87 |
-glibtop_get_loadavg_p |
|
88 |
glibtop_get_loadavg_s |
|
89 |
glibtop_get_mem |
|
90 |
glibtop_get_mem_l |
|
91 |
-glibtop_get_mem_p |
|
92 |
glibtop_get_mem_s |
|
93 |
glibtop_get_mountlist |
|
94 |
glibtop_get_mountlist_l |
|
95 |
-glibtop_get_mountlist_p |
|
96 |
glibtop_get_mountlist_s |
|
97 |
glibtop_get_msg_limits |
|
98 |
glibtop_get_msg_limits_l |
|
99 |
-glibtop_get_msg_limits_p |
|
100 |
glibtop_get_msg_limits_s |
|
101 |
glibtop_get_netlist |
|
102 |
glibtop_get_netlist_l |
|
103 |
-glibtop_get_netlist_p |
|
104 |
glibtop_get_netlist_s |
|
105 |
glibtop_get_netload |
|
106 |
glibtop_get_netload_l |
|
107 |
-glibtop_get_netload_p |
|
108 |
glibtop_get_netload_s |
|
109 |
glibtop_get_parameter_l |
|
110 |
-glibtop_get_parameter_p |
|
111 |
glibtop_get_ppp |
|
112 |
glibtop_get_ppp_l |
|
113 |
-glibtop_get_ppp_p |
|
114 |
glibtop_get_ppp_s |
|
115 |
glibtop_get_proc_args |
|
116 |
glibtop_get_proc_args_l |
|
117 |
-glibtop_get_proc_args_p |
|
118 |
glibtop_get_proc_args_s |
|
119 |
glibtop_get_proc_argv |
|
120 |
glibtop_get_proc_argv_l |
|
121 |
-glibtop_get_proc_argv_p |
|
122 |
glibtop_get_proc_kernel |
|
123 |
glibtop_get_proc_kernel_l |
|
124 |
-glibtop_get_proc_kernel_p |
|
125 |
glibtop_get_proc_kernel_s |
|
126 |
glibtop_get_proclist |
|
127 |
glibtop_get_proclist_l |
|
128 |
-glibtop_get_proclist_p |
|
129 |
glibtop_get_proclist_s |
|
130 |
glibtop_get_proc_map |
|
131 |
glibtop_get_proc_map_l |
|
132 |
-glibtop_get_proc_map_p |
|
133 |
glibtop_get_proc_map_s |
|
134 |
glibtop_get_proc_mem |
|
135 |
glibtop_get_proc_mem_l |
|
136 |
-glibtop_get_proc_mem_p |
|
137 |
glibtop_get_proc_mem_s |
|
138 |
glibtop_get_proc_open_files |
|
139 |
glibtop_get_proc_open_files_l |
|
140 |
-glibtop_get_proc_open_files_p |
|
141 |
glibtop_get_proc_open_files_s |
|
142 |
glibtop_get_proc_segment |
|
143 |
glibtop_get_proc_segment_l |
|
144 |
-glibtop_get_proc_segment_p |
|
145 |
glibtop_get_proc_segment_s |
|
146 |
glibtop_get_proc_signal |
|
147 |
glibtop_get_proc_signal_l |
|
148 |
-glibtop_get_proc_signal_p |
|
149 |
glibtop_get_proc_signal_s |
|
150 |
glibtop_get_proc_state |
|
151 |
glibtop_get_proc_state_l |
|
152 |
-glibtop_get_proc_state_p |
|
153 |
glibtop_get_proc_state_s |
|
154 |
glibtop_get_proc_time |
|
155 |
glibtop_get_proc_time_l |
|
156 |
-glibtop_get_proc_time_p |
|
157 |
glibtop_get_proc_time_s |
|
158 |
glibtop_get_proc_uid |
|
159 |
glibtop_get_proc_uid_l |
|
160 |
-glibtop_get_proc_uid_p |
|
161 |
glibtop_get_proc_uid_s |
|
162 |
glibtop_get_proc_wd |
|
163 |
glibtop_get_proc_wd_l |
|
164 |
-glibtop_get_proc_wd_p |
|
165 |
glibtop_get_proc_wd_s |
|
166 |
glibtop_get_sem_limits |
|
167 |
glibtop_get_sem_limits_l |
|
168 |
-glibtop_get_sem_limits_p |
|
169 |
glibtop_get_sem_limits_s |
|
170 |
glibtop_get_shm_limits |
|
171 |
glibtop_get_shm_limits_l |
|
172 |
-glibtop_get_shm_limits_p |
|
173 |
glibtop_get_shm_limits_s |
|
174 |
glibtop_get_swap |
|
175 |
glibtop_get_swap_l |
|
176 |
-glibtop_get_swap_p |
|
177 |
glibtop_get_swap_s |
|
178 |
glibtop_get_sysdeps |
|
179 |
glibtop_get_sysdeps_r |
|
180 |
glibtop_get_sysinfo |
|
181 |
-glibtop_get_sysinfo_p |
|
182 |
glibtop_get_sysinfo_s |
|
183 |
glibtop_get_uptime |
|
184 |
glibtop_get_uptime_l |
|
185 |
-glibtop_get_uptime_p |
|
186 |
glibtop_get_uptime_s |
|
187 |
glibtop_global_server |
|
188 |
glibtop_init |
|
189 |
@@ -126,5 +97,4 @@ glibtop_open_p |
|
190 |
glibtop_open_s |
|
191 |
glibtop_server_features |
|
192 |
glibtop_set_parameter_l |
|
193 |
-glibtop_set_parameter_p |
|
194 |
glibtop_sys_siglist |
|
195 |
diff -Nrup libgtop-2.19.2/src/daemon/daemon.h libgtop-2.19.2.mod/src/daemon/daemon.h |
|
196 |
--- libgtop-2.19.2/src/daemon/daemon.h 2007-05-13 05:54:57.000000000 +0800 |
|
197 |
+++ libgtop-2.19.2.mod/src/daemon/daemon.h 2007-05-18 15:46:48.775528000 +0800 |
|
198 |
@@ -57,17 +57,17 @@ G_BEGIN_DECLS |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
199 |
#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
|
200 |
#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
|
201 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
202 |
-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
|
203 |
-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
|
204 |
-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
|
205 |
- 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
|
206 |
- |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
207 |
-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
|
208 |
- 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
|
209 |
-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
|
210 |
+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
|
211 |
+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
|
212 |
+G_GNUC_INTERNAL void handle_slave_command (glibtop_command *cmnd, glibtop_response *resp, |
9929 | 213 |
+ const void *parameter) ; |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
214 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
215 |
+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
|
216 |
+ 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
|
217 |
+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
|
218 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
219 |
-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
|
220 |
-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
|
221 |
+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
|
222 |
+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
|
223 |
|
9929 | 224 |
extern gboolean enable_debug; |
225 |
extern gboolean verbose_output; |
|
226 |
diff -Nrup libgtop-2.19.2/sysdeps/common/fsusage.c libgtop-2.19.2.mod/sysdeps/common/fsusage.c |
|
227 |
--- libgtop-2.19.2/sysdeps/common/fsusage.c 2007-04-27 06:27:34.000000000 +0800 |
|
228 |
+++ libgtop-2.19.2.mod/sysdeps/common/fsusage.c 2007-05-18 15:49:16.128329000 +0800 |
|
229 |
@@ -148,6 +148,15 @@ _glibtop_freebsd_get_fsusage_read_write( |
|
230 |
||
8180 | 231 |
#define _glibtop_get_fsusage_read_write(S, B, P) \ |
232 |
_glibtop_freebsd_get_fsusage_read_write(S, B, P) |
|
9929 | 233 |
+ |
8180 | 234 |
+#elif (defined(sun) || defined(__sun)) |
235 |
+G_GNUC_INTERNAL void |
|
236 |
+_glibtop_sun_get_fsusage_read_write(glibtop *server, |
|
237 |
+ glibtop_fsusage *buf, |
|
238 |
+ const char *path); |
|
239 |
+ |
|
240 |
+#define _glibtop_get_fsusage_read_write(S, B, P) \ |
|
241 |
+ _glibtop_sun_get_fsusage_read_write(S, B, P) |
|
9929 | 242 |
|
8180 | 243 |
#else /* default fallback */ |
9127 | 244 |
#warning glibtop_get_fsusage .read .write are not implemented. |
9929 | 245 |
diff -Nrup libgtop-2.19.2/sysdeps/common/mountlist.c libgtop-2.19.2.mod/sysdeps/common/mountlist.c |
246 |
--- libgtop-2.19.2/sysdeps/common/mountlist.c 2007-04-27 06:27:34.000000000 +0800 |
|
247 |
+++ libgtop-2.19.2.mod/sysdeps/common/mountlist.c 2007-05-18 15:53:42.191233000 +0800 |
|
248 |
@@ -590,6 +590,17 @@ glibtop_get_mountlist_s (glibtop *server |
|
9057 | 249 |
|
250 |
for (cur = &entries[0]; cur != NULL; cur = next) { |
|
251 |
||
252 |
+ /*zhua: delete these 2 type of fs: objfs,ctfs */ |
|
253 |
+ if (!strcmp(cur->me_type, "objfs") || !strcmp(cur->me_type,"ctfs")){ |
|
254 |
+ /* free current mount_entry and move to the next */ |
|
255 |
+ next = cur->me_next; |
|
256 |
+ g_free(cur->me_devname); |
|
257 |
+ g_free(cur->me_mountdir); |
|
258 |
+ g_free(cur->me_type); |
|
259 |
+ g_free(cur); |
|
260 |
+ continue; |
|
261 |
+ } |
|
9929 | 262 |
+ |
9057 | 263 |
if(all_fs || !ignore_mount_entry(cur)) { |
264 |
/* add a new glibtop_mountentry */ |
|
265 |
glibtop_mountentry e; |
|
9929 | 266 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/Makefile.am libgtop-2.19.2.mod/sysdeps/solaris/Makefile.am |
267 |
--- libgtop-2.19.2/sysdeps/solaris/Makefile.am 2007-04-27 06:27:38.000000000 +0800 |
|
268 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/Makefile.am 2007-05-19 00:44:12.362476000 +0800 |
|
9057 | 269 |
@@ -8,7 +8,7 @@ libgtop_sysdeps_2_0_la_SOURCES = open.c |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
270 |
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
|
271 |
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
|
272 |
prockernel.c procsegment.c procargs.c \ |
8685 | 273 |
- procopenfiles.c \ |
9929 | 274 |
+ procopenfiles.c sysinfo.c fsusage.c procwd.c glibtop_private.c \ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
275 |
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
|
276 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
277 |
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO) |
9929 | 278 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/cpu.c libgtop-2.19.2.mod/sysdeps/solaris/cpu.c |
279 |
--- libgtop-2.19.2/sysdeps/solaris/cpu.c 2007-04-27 06:27:38.000000000 +0800 |
|
280 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/cpu.c 2007-05-18 23:10:50.519504000 +0800 |
|
281 |
@@ -34,6 +34,7 @@ static const unsigned long _glibtop_sysd |
|
7660
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 |
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
|
284 |
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) + |
9929 | 285 |
++(1L << GLIBTOP_CPU_NICE) + /* this value is needed by multiload */ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
286 |
(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
|
287 |
(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
|
288 |
(1L << GLIBTOP_XCPU_SYS) + (1L << GLIBTOP_XCPU_IDLE) + |
9929 | 289 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/fsusage.c libgtop-2.19.2.mod/sysdeps/solaris/fsusage.c |
290 |
--- libgtop-2.19.2/sysdeps/solaris/fsusage.c 1970-01-01 08:00:00.000000000 +0800 |
|
291 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/fsusage.c 2007-05-18 23:27:13.387170000 +0800 |
|
8180 | 292 |
@@ -0,0 +1,99 @@ |
293 |
+#include <config.h> |
|
294 |
+#include <glibtop.h> |
|
295 |
+#include <glibtop/error.h> |
|
296 |
+#include <glibtop/fsusage.h> |
|
297 |
+#include <glibtop/union.h> |
|
298 |
+ |
|
299 |
+#include "glibtop_private.h" |
|
300 |
+ |
|
301 |
+#include <glib.h> |
|
302 |
+ |
|
303 |
+#include <unistd.h> |
|
304 |
+#include <kstat.h> |
|
305 |
+#include <sys/types.h> |
|
306 |
+#include <sys/stat.h> |
|
307 |
+#include <sys/statvfs.h> |
|
308 |
+ |
|
309 |
+#include <stdio.h> |
|
310 |
+#include <string.h> |
|
311 |
+#include <stdlib.h> |
|
312 |
+ |
|
313 |
+G_GNUC_INTERNAL void |
|
314 |
+_glibtop_sun_get_fsusage_read_write(glibtop *server, |
|
315 |
+ glibtop_fsusage *buf, |
|
316 |
+ const char *path) |
|
317 |
+{ |
|
318 |
+ struct statvfs64 statvfsbuf; |
|
319 |
+ char ksname[KSTAT_STRLEN + 1]; |
|
320 |
+ kstat_ctl_t * const kctl = server->machine.kc; |
|
321 |
+ kstat_t *ksp; |
|
322 |
+ kstat_io_t kio; |
|
323 |
+ kstat_named_t *kread, *kwrite; |
|
324 |
+ int i; |
|
325 |
+ |
|
326 |
+ /* |
|
327 |
+ * get a kstat handle and update the user's kstat chain |
|
328 |
+ */ |
|
329 |
+ if( kctl == NULL ){ |
|
330 |
+ glibtop_warn_io_r (server, "kstat_open ()"); |
|
331 |
+ return; |
|
332 |
+ } |
|
333 |
+ |
|
334 |
+ /* make sure we have current data */ |
|
335 |
+ while( kstat_chain_update( kctl ) != 0 ) |
|
336 |
+ ; |
|
337 |
+ |
|
338 |
+ for (ksp = kctl->kc_chain, i =0; ksp != NULL; ksp = ksp->ks_next, i++) { |
|
339 |
+ if (ksp->ks_type == KSTAT_TYPE_IO && strcmp(ksp->ks_class,"disk") == 0) { |
|
340 |
+ kstat_read(kctl, ksp, &kio); |
|
341 |
+ buf->read += kio.nread; |
|
342 |
+ buf->write += kio.nwritten; |
|
343 |
+ } |
|
344 |
+ } |
|
345 |
+#if 0 |
|
346 |
+ /* these codes keep here, because they are a good way to get the |
|
347 |
+ fsusage information, but at the moment, the interfaces used |
|
348 |
+ are not public or stable. so let's use them when public... |
|
349 |
+ */ |
|
350 |
+ /* |
|
351 |
+ * get a kstat handle and update the user's kstat chain |
|
352 |
+ */ |
|
353 |
+ if( kctl == NULL ){ |
|
354 |
+ glibtop_warn_io_r (server, "kstat_open ()"); |
|
355 |
+ return; |
|
356 |
+ } |
|
357 |
+ |
|
358 |
+ while( kstat_chain_update( kctl ) != 0 ) |
|
359 |
+ ; |
|
360 |
+ |
|
361 |
+ if (statvfs64(path, &statvfsbuf) != 0) { |
|
362 |
+ glibtop_warn_io_r (server, "kstat_open ()"); |
|
363 |
+ return; |
|
364 |
+ } |
|
365 |
+ snprintf(ksname, KSTAT_STRLEN, "%s%lx", VOPSTATS_STR, |
|
366 |
+ statvfsbuf.f_fsid); |
|
367 |
+ |
|
368 |
+ /* |
|
369 |
+ * traverse the kstat chain |
|
370 |
+ * to find the appropriate statistics |
|
371 |
+ */ |
|
372 |
+ if( (ksp = kstat_lookup( kctl, |
|
373 |
+ "unix", 0, ksname )) == NULL ) { |
|
374 |
+ return; |
|
375 |
+ } |
|
376 |
+ if( kstat_read( kctl, ksp, NULL ) == -1 ) { |
|
377 |
+ return; |
|
378 |
+ } |
|
379 |
+ |
|
380 |
+ kread = (kstat_named_t *)kstat_data_lookup(ksp,"read_bytes"); |
|
381 |
+ if( kread != NULL ) { |
|
382 |
+ buf->read = kread->value.ull; |
|
383 |
+ } |
|
384 |
+ |
|
385 |
+ kwrite = (kstat_named_t *)kstat_data_lookup(ksp,"write_bytes"); |
|
386 |
+ if( kwrite != NULL ) { |
|
387 |
+ buf->write = kwrite->value.ull; |
|
388 |
+ } |
|
389 |
+#endif |
|
390 |
+ buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE); |
|
391 |
+} |
|
9929 | 392 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/glibtop_machine.h libgtop-2.19.2.mod/sysdeps/solaris/glibtop_machine.h |
393 |
--- libgtop-2.19.2/sysdeps/solaris/glibtop_machine.h 2007-04-27 06:27:38.000000000 +0800 |
|
394 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/glibtop_machine.h 2007-05-18 16:05:20.322950000 +0800 |
|
395 |
@@ -61,14 +61,7 @@ struct _glibtop_machine |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
396 |
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
|
397 |
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
|
398 |
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
|
399 |
- void *libproc; /* libproc handle */ |
7833 | 400 |
-#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
|
401 |
- 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
|
402 |
- 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
|
403 |
- void (*pfree)(void *); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
404 |
-#else |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
405 |
void *filler[3]; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
406 |
-#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
407 |
}; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
408 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
409 |
G_END_DECLS |
9929 | 410 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/glibtop_private.c libgtop-2.19.2.mod/sysdeps/solaris/glibtop_private.c |
411 |
--- libgtop-2.19.2/sysdeps/solaris/glibtop_private.c 1970-01-01 08:00:00.000000000 +0800 |
|
412 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/glibtop_private.c 2007-05-19 00:39:20.309851000 +0800 |
|
413 |
@@ -0,0 +1,203 @@ |
|
414 |
+#include <config.h> |
|
415 |
+#include <glibtop.h> |
|
416 |
+#include <glibtop/error.h> |
|
417 |
+ |
|
418 |
+#include "glibtop_private.h" |
|
419 |
+ |
|
420 |
+#include <glib.h> |
|
421 |
+ |
|
422 |
+#include <string.h> |
|
423 |
+#include <stdlib.h> |
|
424 |
+#include <stdarg.h> |
|
425 |
+ |
|
426 |
+#include <fcntl.h> |
|
427 |
+#include <unistd.h> |
|
428 |
+ |
|
429 |
+#if 0 |
|
430 |
+unsigned long long |
|
431 |
+get_scaled(const char *buffer, const char *key) |
|
432 |
+{ |
|
433 |
+ const char *ptr; |
|
434 |
+ char *next; |
|
435 |
+ unsigned long long value = 0; |
|
436 |
+ |
|
437 |
+ if (G_LIKELY((ptr = strstr(buffer, key)))) |
|
438 |
+ { |
|
439 |
+ ptr += strlen(key); |
|
440 |
+ value = strtoull(ptr, &next, 0); |
|
441 |
+ |
|
442 |
+ for ( ; *next; ++next) { |
|
443 |
+ if (*next == 'k') { |
|
444 |
+ value *= 1024; |
|
445 |
+ break; |
|
446 |
+ } else if (*next == 'M') { |
|
447 |
+ value *= 1024 * 1024; |
|
448 |
+ break; |
|
449 |
+ } |
|
450 |
+ } |
|
451 |
+ } else |
|
452 |
+ g_warning("Could not read key '%s' in buffer '%s'", |
|
453 |
+ key, buffer); |
|
454 |
+ |
|
455 |
+ return value; |
|
456 |
+} |
|
457 |
+ |
|
458 |
+ |
|
459 |
+char * |
|
460 |
+skip_token (const char *p) |
|
461 |
+{ |
|
462 |
+ p = next_token(p); |
|
463 |
+ while (*p && !isspace(*p)) p++; |
|
464 |
+ p = next_token(p); |
|
465 |
+ return (char *)p; |
|
466 |
+} |
|
467 |
+ |
|
468 |
+ |
|
469 |
+/* |
|
470 |
+ * Read functions |
|
471 |
+ */ |
|
472 |
+enum TRY_FILE_TO_BUFFER |
|
473 |
+{ |
|
474 |
+ TRY_FILE_TO_BUFFER_OK = 0, |
|
475 |
+ TRY_FILE_TO_BUFFER_OPEN = -1, |
|
476 |
+ TRY_FILE_TO_BUFFER_READ = -2 |
|
477 |
+}; |
|
478 |
+ |
|
479 |
+int try_file_to_buffer(char *buffer, const char *format, ...) |
|
480 |
+{ |
|
481 |
+ char path[4096]; |
|
482 |
+ int fd; |
|
483 |
+ ssize_t len; |
|
484 |
+ va_list pa; |
|
485 |
+ |
|
486 |
+ va_start(pa, format); |
|
487 |
+ |
|
488 |
+ /* C99 also provides vsnprintf */ |
|
489 |
+ g_vsnprintf(path, sizeof path, format, pa); |
|
490 |
+ |
|
491 |
+ va_end(pa); |
|
492 |
+ |
|
493 |
+ buffer [0] = '\0'; |
|
494 |
+ |
|
495 |
+ if((fd = open (path, O_RDONLY)) < 0) |
|
496 |
+ return TRY_FILE_TO_BUFFER_OPEN; |
|
497 |
+ |
|
498 |
+ len = read (fd, buffer, BUFSIZ-1); |
|
499 |
+ close (fd); |
|
500 |
+ |
|
501 |
+ if (len < 0) |
|
502 |
+ return TRY_FILE_TO_BUFFER_READ; |
|
503 |
+ |
|
504 |
+ buffer [len] = '\0'; |
|
505 |
+ |
|
506 |
+ return TRY_FILE_TO_BUFFER_OK; |
|
507 |
+} |
|
508 |
+ |
|
509 |
+ |
|
510 |
+void |
|
511 |
+file_to_buffer(glibtop *server, char *buffer, const char *filename) |
|
512 |
+{ |
|
513 |
+ switch(try_file_to_buffer(buffer, filename)) |
|
514 |
+ { |
|
515 |
+ case TRY_FILE_TO_BUFFER_OPEN: |
|
516 |
+ glibtop_error_io_r (server, "open (%s)", filename); |
|
517 |
+ case TRY_FILE_TO_BUFFER_READ: |
|
518 |
+ glibtop_error_io_r (server, "read (%s)", filename); |
|
519 |
+ } |
|
520 |
+} |
|
521 |
+ |
|
522 |
+ |
|
523 |
+ |
|
524 |
+ |
|
525 |
+static unsigned long |
|
526 |
+read_boot_time(glibtop *server) |
|
527 |
+{ |
|
528 |
+ char buffer[BUFSIZ]; |
|
529 |
+ char *btime; |
|
530 |
+ |
|
531 |
+ file_to_buffer(server, buffer, "/proc/stat"); |
|
532 |
+ |
|
533 |
+ btime = strstr(buffer, "btime"); |
|
534 |
+ |
|
535 |
+ if (!btime) { |
|
536 |
+ glibtop_warn_io_r(server, "cannot find btime in /proc/stat"); |
|
537 |
+ return 0UL; |
|
538 |
+ } |
|
539 |
+ |
|
540 |
+ btime = skip_token(btime); |
|
541 |
+ return strtoul(btime, NULL, 10); |
|
542 |
+} |
|
543 |
+ |
|
544 |
+ |
|
545 |
+ |
|
546 |
+unsigned long |
|
547 |
+get_boot_time(glibtop *server) |
|
548 |
+{ |
|
549 |
+ static unsigned long boot_time = 0UL; |
|
550 |
+ |
|
551 |
+ if(G_UNLIKELY(!boot_time)) |
|
552 |
+ { |
|
553 |
+ boot_time = read_boot_time(server); |
|
554 |
+ } |
|
555 |
+ |
|
556 |
+ return boot_time; |
|
557 |
+} |
|
558 |
+ |
|
559 |
+ |
|
560 |
+size_t |
|
561 |
+get_page_size(void) |
|
562 |
+{ |
|
563 |
+ static size_t pagesize = 0; |
|
564 |
+ |
|
565 |
+ if(G_UNLIKELY(!pagesize)) |
|
566 |
+ { |
|
567 |
+ pagesize = getpagesize(); |
|
568 |
+ } |
|
569 |
+ |
|
570 |
+ return pagesize; |
|
571 |
+} |
|
572 |
+ |
|
573 |
+ |
|
574 |
+ |
|
575 |
+gboolean |
|
576 |
+check_cpu_line(glibtop *server, const char *line, unsigned i) |
|
577 |
+{ |
|
578 |
+ char start[10]; |
|
579 |
+ |
|
580 |
+ g_snprintf(start, sizeof start, "cpu%u", i); |
|
581 |
+ |
|
582 |
+ return g_str_has_prefix(line, start); |
|
583 |
+} |
|
584 |
+ |
|
585 |
+ |
|
586 |
+ |
|
587 |
+gboolean |
|
588 |
+has_sysfs(void) |
|
589 |
+{ |
|
590 |
+ static gboolean init; |
|
591 |
+ static gboolean sysfs; |
|
592 |
+ |
|
593 |
+ if (G_UNLIKELY(!init)) { |
|
594 |
+ sysfs = g_file_test("/sys", G_FILE_TEST_IS_DIR); |
|
595 |
+ init = TRUE; |
|
596 |
+ } |
|
597 |
+ |
|
598 |
+ return sysfs; |
|
599 |
+} |
|
600 |
+#endif |
|
601 |
+ |
|
602 |
+ |
|
603 |
+gboolean safe_readlink(const char *path, char *buf, size_t bufsiz) |
|
604 |
+{ |
|
605 |
+ ssize_t ret; |
|
606 |
+ |
|
607 |
+ ret = readlink(path, buf, bufsiz - 1); |
|
608 |
+ |
|
609 |
+ if (ret == -1) { |
|
610 |
+ g_warning("Could not read link %s : %s", path, strerror(errno)); |
|
611 |
+ return FALSE; |
|
612 |
+ } |
|
613 |
+ |
|
614 |
+ buf[ret] = '\0'; |
|
615 |
+ return TRUE; |
|
616 |
+} |
|
617 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/glibtop_private.h libgtop-2.19.2.mod/sysdeps/solaris/glibtop_private.h |
|
618 |
--- libgtop-2.19.2/sysdeps/solaris/glibtop_private.h 2007-04-27 06:27:38.000000000 +0800 |
|
619 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/glibtop_private.h 2007-05-19 00:34:12.544055000 +0800 |
|
620 |
@@ -60,6 +60,8 @@ int glibtop_get_proc_credentials_s(glibt |
|
621 |
/* Reread kstat chains */ |
|
622 |
void glibtop_get_kstats(glibtop *); |
|
623 |
||
624 |
+gboolean safe_readlink(const char *path, char *buf, size_t bufsiz); |
|
625 |
+ |
|
626 |
G_END_DECLS |
|
627 |
||
628 |
#endif /* __GLIBTOP_PRIVATE_H__ */ |
|
629 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/glibtop_server.h libgtop-2.19.2.mod/sysdeps/solaris/glibtop_server.h |
|
630 |
--- libgtop-2.19.2/sysdeps/solaris/glibtop_server.h 2007-04-27 06:27:38.000000000 +0800 |
|
631 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/glibtop_server.h 2007-05-18 18:37:08.382200000 +0800 |
|
632 |
@@ -29,9 +29,15 @@ G_BEGIN_DECLS |
|
8180 | 633 |
#define GLIBTOP_SUID_SWAP 0 |
634 |
#define GLIBTOP_SUID_UPTIME 0 |
|
635 |
#define GLIBTOP_SUID_LOADAVG 0 |
|
636 |
+#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
637 |
#define GLIBTOP_SUID_SHM_LIMITS (1L << GLIBTOP_SYSDEPS_SHM_LIMITS) |
|
638 |
#define GLIBTOP_SUID_MSG_LIMITS (1L << GLIBTOP_SYSDEPS_MSG_LIMITS) |
|
639 |
#define GLIBTOP_SUID_SEM_LIMITS (1L << GLIBTOP_SYSDEPS_SEM_LIMITS) |
|
640 |
+#else |
|
641 |
+#define GLIBTOP_SUID_SHM_LIMITS 0 |
|
642 |
+#define GLIBTOP_SUID_MSG_LIMITS 0 |
|
643 |
+#define GLIBTOP_SUID_SEM_LIMITS 0 |
|
644 |
+#endif |
|
645 |
#define GLIBTOP_SUID_PROCLIST 0 |
|
646 |
#define GLIBTOP_SUID_PROC_STATE 0 |
|
647 |
#define GLIBTOP_SUID_PROC_UID 0 |
|
9929 | 648 |
@@ -44,6 +50,7 @@ G_BEGIN_DECLS |
649 |
#define GLIBTOP_SUID_PROC_MAP 0 |
|
650 |
#define GLIBTOP_SUID_NETLOAD 0 |
|
651 |
#define GLIBTOP_SUID_NETLIST 0 |
|
652 |
+#define GLIBTOP_SUID_PROC_WD 0 |
|
653 |
#define GLIBTOP_SUID_PPP 0 |
|
654 |
||
655 |
G_END_DECLS |
|
656 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/msg_limits.c libgtop-2.19.2.mod/sysdeps/solaris/msg_limits.c |
|
657 |
--- libgtop-2.19.2/sysdeps/solaris/msg_limits.c 2007-04-27 06:27:38.000000000 +0800 |
|
658 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/msg_limits.c 2007-05-18 18:26:18.794307000 +0800 |
|
659 |
@@ -37,14 +37,24 @@ static const unsigned long _glibtop_sysd |
|
8180 | 660 |
(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGMNI) + |
661 |
(1L << GLIBTOP_IPC_MSGTQL); |
|
662 |
#else |
|
663 |
-static const unsigned long _glibtop_sysdeps_msg_limits = 0; |
|
664 |
+static const unsigned long _glibtop_sysdeps_msg_limits = |
|
665 |
+(1L << GLIBTOP_IPC_MSGMNB) + |
|
666 |
+(1L << GLIBTOP_IPC_MSGMNI) + |
|
667 |
+(1L << GLIBTOP_IPC_MSGMAX) + |
|
668 |
+(1L << GLIBTOP_IPC_MSGPOOL) + |
|
669 |
+(1L << GLIBTOP_IPC_MSGTQL); |
|
670 |
#endif |
|
671 |
||
672 |
||
673 |
/* Init function. */ |
|
674 |
||
675 |
+#if GLIBTOP_SUID_MSG_LIMITS |
|
676 |
void |
|
9929 | 677 |
_glibtop_init_msg_limits_p (glibtop *server) |
8180 | 678 |
+#else |
679 |
+void |
|
9929 | 680 |
+_glibtop_init_msg_limits_s (glibtop *server) |
8180 | 681 |
+#endif |
682 |
{ |
|
683 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
684 |
||
9929 | 685 |
@@ -59,8 +69,13 @@ _glibtop_init_msg_limits_p (glibtop *ser |
8180 | 686 |
|
687 |
/* Provides information about sysv ipc limits. */ |
|
688 |
||
689 |
+#if GLIBTOP_SUID_MSG_LIMITS |
|
690 |
void |
|
691 |
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf) |
|
692 |
+#else |
|
693 |
+void |
|
694 |
+glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf) |
|
695 |
+#endif |
|
696 |
{ |
|
697 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
698 |
||
9929 | 699 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/netlist.c libgtop-2.19.2.mod/sysdeps/solaris/netlist.c |
700 |
--- libgtop-2.19.2/sysdeps/solaris/netlist.c 2007-04-27 06:27:38.000000000 +0800 |
|
701 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/netlist.c 2007-05-18 16:11:55.054558000 +0800 |
|
8569 | 702 |
@@ -41,7 +41,13 @@ glibtop_get_netlist_s (glibtop *server, |
8180 | 703 |
{ |
704 |
GPtrArray *devices; |
|
705 |
kstat_t *ksp; |
|
706 |
- kstat_ctl_t *kc; |
|
707 |
+ /* use the kc installed in server, don't need to create again, |
|
708 |
+ it will save some time and improve performance */ |
|
709 |
+ kstat_ctl_t * const kc = server->machine.kc; |
|
8569 | 710 |
+ /* use flags as a check condition, if it is 1, check, or not check... zhua */ |
8180 | 711 |
+ int check = buf->flags; |
8569 | 712 |
+ /* set flags back to 0 */ |
713 |
+ buf->flags = 0; |
|
8180 | 714 |
|
715 |
glibtop_init_s (&server, GLIBTOP_SYSDEPS_NETLIST, 0); |
|
716 |
||
9127 | 717 |
@@ -49,7 +55,6 @@ glibtop_get_netlist_s (glibtop *server, |
8180 | 718 |
|
719 |
devices = g_ptr_array_new(); |
|
720 |
||
721 |
- kc = kstat_open(); |
|
722 |
if (kc == NULL) { |
|
723 |
glibtop_warn_io_r(server, "kstat_open()"); |
|
724 |
return NULL; |
|
9929 | 725 |
@@ -60,11 +65,26 @@ glibtop_get_netlist_s (glibtop *server, |
8180 | 726 |
if (strcmp(ksp->ks_class, "net") != 0) |
727 |
continue; |
|
728 |
||
729 |
- g_ptr_array_add(devices, g_strdup(ksp->ks_name)); |
|
730 |
- buf->number++; |
|
9929 | 731 |
- } |
8180 | 732 |
+ /* do some check to see if the first character is the same between |
733 |
+ name and module, if not, we don't return it, because |
|
734 |
+ glibtop_get_netload() only want the same ones.... |
|
735 |
+ */ |
|
736 |
+ if (check){ |
|
737 |
+ /* if the first character is not same, they should not |
|
738 |
+ the one we will use in glibtop_get_netload() */ |
|
739 |
+ if (ksp->ks_name[0] != ksp->ks_module[0]) |
|
740 |
+ continue; |
|
741 |
+ /* because in glibtop_get_netload(), name |
|
742 |
+ is at least 1 character longer than module */ |
|
743 |
+ if (strlen( ksp->ks_module ) >= strlen( ksp->ks_name)) |
|
744 |
+ continue; |
|
745 |
+ /* if it's not digital, continue directly */ |
|
746 |
+ if( !isdigit( (int) ksp->ks_name[strlen( ksp->ks_module )] )) |
|
747 |
+ continue; |
|
748 |
+ } |
|
9929 | 749 |
+ g_ptr_array_add(devices, g_strdup(ksp->ks_name)); |
750 |
+ buf->number++; } |
|
8180 | 751 |
|
752 |
- kstat_close(kc); |
|
9929 | 753 |
|
8180 | 754 |
buf->flags = _glibtop_sysdeps_netlist; |
755 |
||
9929 | 756 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/netload.c libgtop-2.19.2.mod/sysdeps/solaris/netload.c |
757 |
--- libgtop-2.19.2/sysdeps/solaris/netload.c 2007-04-27 06:27:38.000000000 +0800 |
|
758 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/netload.c 2007-05-18 18:03:14.142003000 +0800 |
|
759 |
@@ -24,14 +24,245 @@ |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
760 |
#include <glibtop/error.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
761 |
#include <glibtop/netload.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
762 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
763 |
-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
|
764 |
+#include "glibtop_private.h" |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
765 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
766 |
+#include <errno.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
767 |
+#include <string.h> |
8180 | 768 |
+#include <kstat.h> |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
769 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
770 |
+#include <sys/types.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
771 |
+#include <sys/socket.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
772 |
+#include <sys/ioctl.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
773 |
+#include <sys/sockio.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
774 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
775 |
+//#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
|
776 |
+/* GNU LibC */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
777 |
+#include <net/if.h> |
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 |
+#ifdef HAVE_IFADDRS_H |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
780 |
+/* needed for IPV6 support */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
781 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
782 |
+#include <ifaddrs.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
783 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
784 |
+#ifndef IN6_IS_ADDR_GLOBAL |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
785 |
+#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
|
786 |
+ (((((__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
|
787 |
+ || (((__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
|
788 |
+#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
789 |
+#endif /* HAVE_IFADDRS_H */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
790 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
791 |
+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
|
792 |
+(1L << GLIBTOP_NETLOAD_ERRORS_IN) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
793 |
+(1L << GLIBTOP_NETLOAD_ERRORS_OUT) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
794 |
+(1L << GLIBTOP_NETLOAD_COLLISIONS); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
795 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
796 |
+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
|
797 |
+(1L << GLIBTOP_NETLOAD_ADDRESS) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
798 |
+(1L << GLIBTOP_NETLOAD_SUBNET) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
799 |
+(1L << GLIBTOP_NETLOAD_MTU); |
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 |
+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
|
802 |
+(1L << GLIBTOP_NETLOAD_BYTES_IN) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
803 |
+(1L << GLIBTOP_NETLOAD_BYTES_OUT) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
804 |
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
805 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
806 |
+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
|
807 |
+(1L << GLIBTOP_NETLOAD_PACKETS_IN) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
808 |
+(1L << GLIBTOP_NETLOAD_PACKETS_OUT) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
809 |
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
810 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
811 |
+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
|
812 |
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
813 |
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
814 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
815 |
+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
|
816 |
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
817 |
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
818 |
+(1L << GLIBTOP_NETLOAD_PACKETS_IN) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
819 |
+(1L << GLIBTOP_NETLOAD_BYTES_IN); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
820 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
821 |
+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
|
822 |
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
823 |
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
824 |
+(1L << GLIBTOP_NETLOAD_PACKETS_OUT) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
825 |
+(1L << GLIBTOP_NETLOAD_BYTES_OUT); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
826 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
827 |
+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
|
828 |
+(1L << GLIBTOP_NETLOAD_ADDRESS6) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
829 |
+(1L << GLIBTOP_NETLOAD_PREFIX6) + |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
830 |
+(1L << GLIBTOP_NETLOAD_SCOPE6); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
831 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
832 |
/* Init function. */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
833 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
834 |
void |
9929 | 835 |
_glibtop_init_netload_s (glibtop *server) |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
836 |
{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
837 |
- server->sysdeps.netload = _glibtop_sysdeps_netload; |
9929 | 838 |
+ server->sysdeps.netload = _glibtop_sysdeps_netload | |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
839 |
+ _glibtop_sysdeps_netload_bytes | |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
840 |
+ _glibtop_sysdeps_netload_packets; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
841 |
+} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
842 |
+ |
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 |
+#ifdef HAVE_IFADDRS_H |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
845 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
846 |
+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
|
847 |
+ const char *interface) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
848 |
+{ |
8180 | 849 |
+/* |
850 |
+ * remove this code, because they are not available at Solaris, but keep them here for reference. |
|
851 |
+ * in fact, the function will not be called at Solaris, because HAVE_IFADDRS_H don't def. |
|
852 |
+ * |
|
853 |
+*/ |
|
854 |
+#if 0 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
855 |
+ struct ifaddrs *ifa0, *ifr6; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
856 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
857 |
+ if(getifaddrs (&ifa0) != 0) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
858 |
+ { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
859 |
+ 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
|
860 |
+ return; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
861 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
862 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
863 |
+ 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
|
864 |
+ 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
|
865 |
+ && ifr6->ifa_addr != NULL |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
866 |
+ && 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
|
867 |
+ break; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
868 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
869 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
870 |
+ if(!ifr6) goto free_ipv6; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
871 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
872 |
+ memcpy(buf->address6, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
873 |
+ &((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
|
874 |
+ 16); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
875 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
876 |
+ memcpy(buf->prefix6, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
877 |
+ &((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
|
878 |
+ 16); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
879 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
880 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
881 |
+ 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
|
882 |
+ 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
|
883 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
884 |
+ 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
|
885 |
+ 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
|
886 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
887 |
+ 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
|
888 |
+ || 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
|
889 |
+ || 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
|
890 |
+ || 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
|
891 |
+ || 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
|
892 |
+ ) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
893 |
+ 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
|
894 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
895 |
+ 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
|
896 |
+ 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
|
897 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
898 |
+ else |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
899 |
+ 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
|
900 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
901 |
+ 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
|
902 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
903 |
+ free_ipv6: |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
904 |
+ freeifaddrs(ifa0); |
8180 | 905 |
+#endif |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
906 |
+} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
907 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
908 |
+#endif /* HAVE_IFADDRS_H */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
909 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
910 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
911 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
912 |
+static int |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
913 |
+solaris_stats(glibtop *server, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
914 |
+ glibtop_netload *buf, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
915 |
+ const char *interface) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
916 |
+{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
917 |
+ char *name = interface; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
918 |
+ char *module; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
919 |
+ char *ptr; |
8180 | 920 |
+ 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
|
921 |
+ kstat_t *ksp; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
922 |
+ kstat_named_t *kdata; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
923 |
+ int have_bytes = 1; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
924 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
925 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
926 |
+ * 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
|
927 |
+ */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
928 |
+ module = strdup( name ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
929 |
+ ptr = module + strlen( module ) - 1; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
930 |
+ 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
|
931 |
+ *ptr = '\0'; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
932 |
+ ptr--; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
933 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
934 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
935 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
936 |
+ * 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
|
937 |
+ */ |
8180 | 938 |
+ if( kctl == NULL ){ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
939 |
+ 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
|
940 |
+ free( module ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
941 |
+ return( 0 ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
942 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
943 |
+ 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
|
944 |
+ ; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
945 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
946 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
947 |
+ * traverse the kstat chain |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
948 |
+ * to find the appropriate statistics |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
949 |
+ */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
950 |
+ if( (ksp = kstat_lookup( kctl, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
951 |
+ module, 0, name )) == NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
952 |
+ free( module ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
953 |
+ return( 0 ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
954 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
955 |
+ 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
|
956 |
+ free( module ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
957 |
+ return( 0 ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
958 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
959 |
+ free( module ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
960 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
961 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
962 |
+ * lookup & store the data |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
963 |
+ */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
964 |
+ 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
|
965 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
966 |
+ 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
|
967 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
968 |
+ 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
|
969 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
970 |
+ 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
|
971 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
972 |
+ 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
|
973 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
974 |
+ 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
|
975 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
976 |
+ 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
|
977 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
978 |
+ 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
|
979 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
980 |
+ 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
|
981 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
982 |
+ 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
|
983 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
984 |
+ 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
|
985 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
986 |
+ 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
|
987 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
988 |
+ 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
|
989 |
+ if( kdata != NULL ) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
990 |
+ buf->collisions = kdata->value.ul; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
991 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
992 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
993 |
+ /* Compute total valules. */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
994 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
995 |
+ 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
|
996 |
+ 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
|
997 |
+ 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
|
998 |
+ /* And now the flags. */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
999 |
+ buf->flags |= _glibtop_sysdeps_netload; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1000 |
+ 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
|
1001 |
+ 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
|
1002 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1003 |
+ /* finished */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1004 |
} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1005 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1006 |
/* Provides network statistics. */ |
9929 | 1007 |
@@ -40,5 +271,72 @@ void |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1008 |
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
|
1009 |
const char *interface) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1010 |
{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1011 |
- memset (buf, 0, sizeof (glibtop_netload)); |
9929 | 1012 |
+ int skfd; |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1013 |
+ 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
|
1014 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1015 |
+ /* set flag */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1016 |
+ 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
|
1017 |
+ if (skfd) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1018 |
+ struct ifreq ifr; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1019 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1020 |
+ 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
|
1021 |
+ 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
|
1022 |
+ 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
|
1023 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1024 |
+ 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
|
1025 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1026 |
+ if (flags & IFF_UP) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1027 |
+ 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
|
1028 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1029 |
+ if (flags & IFF_BROADCAST) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1030 |
+ 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
|
1031 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1032 |
+ if (flags & IFF_DEBUG) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1033 |
+ 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
|
1034 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1035 |
+ if (flags & IFF_LOOPBACK) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1036 |
+ 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
|
1037 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1038 |
+ if (flags & IFF_POINTOPOINT) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1039 |
+ 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
|
1040 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1041 |
+ if (flags & IFF_RUNNING) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1042 |
+ 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
|
1043 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1044 |
+ if (flags & IFF_NOARP) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1045 |
+ 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
|
1046 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1047 |
+ if (flags & IFF_PROMISC) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1048 |
+ 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
|
1049 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1050 |
+ if (flags & IFF_ALLMULTI) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1051 |
+ 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
|
1052 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1053 |
+ if (flags & IFF_MULTICAST) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1054 |
+ 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
|
1055 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1056 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1057 |
+ 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
|
1058 |
+ if (!ioctl (skfd, SIOCGIFADDR, &ifr)) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1059 |
+ 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
|
1060 |
+ 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
|
1061 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1062 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1063 |
+ 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
|
1064 |
+ if (!ioctl (skfd, SIOCGIFNETMASK, &ifr)) { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1065 |
+ 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
|
1066 |
+ 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
|
1067 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1068 |
+ close (skfd); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1069 |
+ } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1070 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1071 |
+ /* |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1072 |
+ * Statistics |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1073 |
+ */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1074 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1075 |
+ solaris_stats(server, buf, interface); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1076 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1077 |
+#ifdef HAVE_IFADDRS_H |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1078 |
+ get_ipv6(server, buf, interface); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1079 |
+#endif /* HAVE_IFADDRS_H */ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1080 |
} |
9929 | 1081 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/open.c libgtop-2.19.2.mod/sysdeps/solaris/open.c |
1082 |
--- libgtop-2.19.2/sysdeps/solaris/open.c 2007-04-27 06:27:38.000000000 +0800 |
|
1083 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/open.c 2007-05-18 16:21:21.872457000 +0800 |
|
1084 |
@@ -209,34 +209,5 @@ glibtop_open_s (glibtop *server, const c |
|
8180 | 1085 |
} |
1086 |
} |
|
1087 |
||
1088 |
- /* Now let's have a bit of magic dust... */ |
|
1089 |
- |
|
1090 |
-#if GLIBTOP_SOLARIS_RELEASE >= 50600 |
|
1091 |
- |
|
1092 |
- dl = dlopen("/usr/lib/libproc.so", RTLD_LAZY); |
|
1093 |
- if(server->machine.libproc) |
|
1094 |
- dlclose(server->machine.libproc); |
|
1095 |
- server->machine.libproc = dl; |
|
1096 |
- if(dl) |
|
1097 |
- { |
|
1098 |
- void *func; |
|
1099 |
- |
|
1100 |
- func = dlsym(dl, "Pobjname"); /* Solaris 8 */ |
|
1101 |
- if(!func) |
|
1102 |
- func = dlsym(dl, "proc_objname"); /* Solaris 7 */ |
|
1103 |
- server->machine.objname = (void (*) |
|
1104 |
- (void *, uintptr_t, const char *, size_t))func; |
|
1105 |
- server->machine.pgrab = (struct ps_prochandle *(*)(pid_t, int, int *)) |
|
1106 |
- dlsym(dl, "Pgrab"); |
|
1107 |
- server->machine.pfree = (void (*)(void *))dlsym(dl, "Pfree"); |
|
1108 |
- |
|
1109 |
- } |
|
1110 |
- else |
|
1111 |
- { |
|
1112 |
- server->machine.objname = NULL; |
|
1113 |
- server->machine.pgrab = NULL; |
|
1114 |
- server->machine.pfree = NULL; |
|
1115 |
- } |
|
1116 |
-#endif |
|
1117 |
server->machine.me = getpid(); |
|
1118 |
} |
|
9929 | 1119 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/procmap.c libgtop-2.19.2.mod/sysdeps/solaris/procmap.c |
1120 |
--- libgtop-2.19.2/sysdeps/solaris/procmap.c 2007-04-27 06:27:38.000000000 +0800 |
|
1121 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/procmap.c 2007-05-18 17:45:40.836275000 +0800 |
|
1122 |
@@ -54,9 +54,14 @@ glibtop_map_entry * |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1123 |
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
|
1124 |
{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1125 |
int fd, i, nmaps, pr_err, heap; |
8180 | 1126 |
+ char filename [BUFSIZ]; |
8569 | 1127 |
+ /* use flags as a check condition, if it is 1, check, or, not check... zhua */ |
1128 |
+ int check = buf->flags; |
|
1129 |
+ /* set flags back to 0 */ |
|
1130 |
+ buf->flags = 0; |
|
9929 | 1131 |
+ |
7833 | 1132 |
#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
|
1133 |
prxmap_t *maps; |
9127 | 1134 |
- struct ps_prochandle *Pr = NULL; |
1135 |
#else |
|
1136 |
prmap_t *maps; |
|
1137 |
#endif |
|
9929 | 1138 |
@@ -123,15 +128,34 @@ 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
|
1139 |
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
|
1140 |
entry = g_malloc0(buf->total); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1141 |
|
7833 | 1142 |
-#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
|
1143 |
- |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1144 |
- 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
|
1145 |
- server->machine.pfree) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1146 |
- 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
|
1147 |
-#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1148 |
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
|
1149 |
{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1150 |
- int len; |
8569 | 1151 |
+ /* take a check to see if we need all information, if not, just get what we need.. |
1152 |
+ Also please see comments in get_process_memory_writable() of gnome-system-monitor zhua */ |
|
1153 |
+ if (check == 1) |
|
1154 |
+ { |
|
1155 |
+ if(maps[i].pr_mflags & MA_WRITE){ |
|
1156 |
+ entry[i].perm |= GLIBTOP_MAP_PERM_WRITE; |
|
1157 |
+ entry[i].size = maps[i].pr_size; |
|
1158 |
+ } |
|
9929 | 1159 |
+ if(maps[i].pr_mflags & MA_SHARED){ |
8569 | 1160 |
+ entry[i].perm |= GLIBTOP_MAP_PERM_SHARED; |
1161 |
+ /* here use shared_clean to store Shared Memory */ |
|
1162 |
+ entry[i].shared_clean = maps[i].pr_size; |
|
1163 |
+ } |
|
1164 |
+ } |
|
9127 | 1165 |
+ else |
1166 |
+ if (check == 2) |
|
1167 |
+ { |
|
1168 |
+ if(maps[i].pr_mflags & MA_SHARED){ |
|
1169 |
+ entry[i].perm |= GLIBTOP_MAP_PERM_SHARED; |
|
1170 |
+ /* here use shared_clean to store Shared Memory */ |
|
1171 |
+ entry[i].shared_clean = maps[i].pr_size; |
|
1172 |
+ } |
|
1173 |
+ } |
|
8569 | 1174 |
+ else { |
1175 |
+ |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1176 |
+ int len, rv; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1177 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1178 |
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
|
1179 |
entry[i].end = maps[i].pr_vaddr + maps[i].pr_size; |
9929 | 1180 |
@@ -177,25 +201,26 @@ 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
|
1181 |
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
|
1182 |
} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1183 |
else |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1184 |
- if(Pr) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1185 |
- { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1186 |
- 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
|
1187 |
- BUFSIZ); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1188 |
- 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
|
1189 |
- GLIBTOP_MAP_FILENAME_LEN)) > 0) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1190 |
- { |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1191 |
- entry[i].filename[len] = 0; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1192 |
- 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
|
1193 |
- } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1194 |
- } |
8180 | 1195 |
+ { |
9929 | 1196 |
+ g_strlcpy(buffer, maps[i].pr_mapname, sizeof buffer); |
8180 | 1197 |
+ /* from /path get file name */ |
1198 |
+ g_snprintf(filename, sizeof filename, "/proc/%d/path/%s", |
|
1199 |
+ pid, buffer); |
|
1200 |
+ |
|
1201 |
+ rv = readlink(filename, entry[i].filename, sizeof(entry[i].filename) - 1); |
|
1202 |
+ /* read object, if have not, set it as NULL */ |
|
1203 |
+ if(rv < 0) |
|
1204 |
+ rv = 0; |
|
1205 |
+ entry[i].filename[rv] = '\0'; |
|
1206 |
+ /* now set the flags */ |
|
1207 |
+ entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME); |
|
1208 |
+ } |
|
9929 | 1209 |
+ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1210 |
#endif |
9929 | 1211 |
- } |
1212 |
+ } /* end of else check */ |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1213 |
|
7833 | 1214 |
-#if GLIBTOP_SOLARIS_RELEASE >= 50600 |
9929 | 1215 |
+ } |
1216 |
||
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1217 |
- if(Pr) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1218 |
- server->machine.pfree(Pr); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1219 |
-#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1220 |
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
|
1221 |
s_close(fd); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1222 |
return entry; |
9929 | 1223 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/procmem.c libgtop-2.19.2.mod/sysdeps/solaris/procmem.c |
1224 |
--- libgtop-2.19.2/sysdeps/solaris/procmem.c 2007-04-27 06:27:38.000000000 +0800 |
|
1225 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/procmem.c 2007-05-18 16:32:37.862629000 +0800 |
|
1226 |
@@ -22,12 +22,14 @@ |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1227 |
#include <config.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1228 |
#include <glibtop.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1229 |
#include <glibtop/procmem.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1230 |
+#include <glibtop/procmap.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1231 |
|
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1232 |
#include "glibtop_private.h" |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1233 |
|
9127 | 1234 |
static const unsigned long _glibtop_sysdeps_proc_mem = |
1235 |
(1L << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_VSIZE) + |
|
1236 |
-(1L << GLIBTOP_PROC_MEM_RESIDENT) + (1L << GLIBTOP_PROC_MEM_RSS); |
|
1237 |
+(1L << GLIBTOP_PROC_MEM_RESIDENT) + (1L << GLIBTOP_PROC_MEM_RSS) + |
|
1238 |
+(1L << GLIBTOP_PROC_MEM_SHARE); |
|
1239 |
||
1240 |
/* Init function. */ |
|
1241 |
||
9929 | 1242 |
@@ -61,5 +63,31 @@ 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
|
1243 |
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
|
1244 |
buf->resident = buf->rss = psinfo.pr_rssize << pagesize << 10; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1245 |
#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1246 |
+/* get Shared Memory */ |
8180 | 1247 |
+ glibtop_proc_map mapbuf; |
1248 |
+ glibtop_map_entry *maps; |
|
1249 |
+ unsigned i; |
|
1250 |
+ buf->share = 0; |
|
8569 | 1251 |
+ |
1252 |
+ /* we have to optimize the performance of libgtop, because update the information will occupy too much cpu. |
|
1253 |
+ |
|
1254 |
+ here I would like to make a little update:set glibtop_proc_map.flags=1,so as to let glibtop_get_proc_map_s() |
|
1255 |
+ only return the ones this function need: memwritable |
|
1256 |
+ |
|
1257 |
+ we do the check in glibtop_get_proc_map_s(), don't run the others part which don't need by this function, |
|
1258 |
+ I think this will accelerate the transaction lots, |
|
1259 |
+ Also this will not affect the existing codes, because when nobody set glibtop_proc_map.flags, |
|
1260 |
+ glibtop_get_proc_map() will return all as before. zhua |
|
1261 |
+ */ |
|
1262 |
+ mapbuf.flags = 2; |
|
8180 | 1263 |
+ |
1264 |
+ maps = glibtop_get_proc_map_s(server, &mapbuf, pid); |
|
1265 |
+ |
|
1266 |
+ for (i = 0; i < mapbuf.number; ++i) { |
|
1267 |
+ if (maps[i].perm & GLIBTOP_MAP_PERM_SHARED) |
|
1268 |
+ buf->share += maps[i].shared_clean; |
|
1269 |
+ } |
|
1270 |
+ g_free(maps); |
|
1271 |
+ |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1272 |
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
|
1273 |
} |
9929 | 1274 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/procstate.c libgtop-2.19.2.mod/sysdeps/solaris/procstate.c |
1275 |
--- libgtop-2.19.2/sysdeps/solaris/procstate.c 2007-04-27 06:27:38.000000000 +0800 |
|
1276 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/procstate.c 2007-05-19 21:18:30.078392000 +0800 |
|
1277 |
@@ -62,6 +62,27 @@ glibtop_get_proc_state_s (glibtop *serve |
|
1278 |
buf->gid = psinfo.pr_egid; |
|
9057 | 1279 |
buf->ruid = psinfo.pr_uid; |
1280 |
buf->rgid = psinfo.pr_gid; |
|
1281 |
+ /* zhua: get some value here, so that we don't need run open/pread/close psinfo later, |
|
1282 |
+ and can delete some other call for psinfo open/pread/close. it will save lots of time*/ |
|
1283 |
+#ifdef HAVE_PROCFS_H |
|
1284 |
+ buf->nice = psinfo.pr_lwp.pr_nice - NZERO; |
|
1285 |
+#else |
|
1286 |
+ buf->nice = psinfo.pr_nice - NZERO; |
|
1287 |
+#endif |
|
1288 |
+ |
|
1289 |
+ buf->start_time = psinfo.pr_start.tv_sec; |
|
1290 |
+ buf->ppid = psinfo.pr_ppid; |
|
1291 |
+ |
|
1292 |
+#ifdef HAVE_PROCFS_H |
|
1293 |
+ buf->vsize = psinfo.pr_size << 10; |
|
1294 |
+ buf->resident= psinfo.pr_rssize << 10; |
|
9929 | 1295 |
+ buf->load = (guint) psinfo.pr_lwp.pr_pctcpu * 100 / (guint) 0x8000; |
9057 | 1296 |
+#else |
1297 |
+ buf->vsize = psinfo.pr_size << pagesize << 10; |
|
1298 |
+ buf->resident = psinfo.pr_rssize << pagesize << 10; |
|
1299 |
+ buf->load = (guint) psinfo.pr_lwp.pr_pctcpu * 100 / (guint) 0x8000; |
|
1300 |
+#endif |
|
9929 | 1301 |
+ |
1302 |
||
9057 | 1303 |
#ifdef HAVE_PROCFS_H |
1304 |
switch(psinfo.pr_lwp.pr_state) |
|
9929 | 1305 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/proctime.c libgtop-2.19.2.mod/sysdeps/solaris/proctime.c |
1306 |
--- libgtop-2.19.2/sysdeps/solaris/proctime.c 2007-04-27 06:27:38.000000000 +0800 |
|
1307 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/proctime.c 2007-05-18 23:15:50.623438000 +0800 |
|
1308 |
@@ -43,8 +43,12 @@ void |
|
8180 | 1309 |
glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf, |
1310 |
pid_t pid) |
|
1311 |
{ |
|
1312 |
+#ifdef HAVE_PROCFS_H |
|
1313 |
+ struct psinfo pinfo; |
|
1314 |
+#else |
|
1315 |
+ struct prpsinfo pinfo; |
|
1316 |
+#endif |
|
1317 |
struct prusage prusage; |
|
1318 |
- GTimeVal time; |
|
1319 |
||
1320 |
memset (buf, 0, sizeof (glibtop_proc_time)); |
|
1321 |
||
9929 | 1322 |
@@ -52,19 +56,21 @@ glibtop_get_proc_time_s (glibtop *server |
8180 | 1323 |
|
1324 |
if(pid) |
|
1325 |
{ |
|
9929 | 1326 |
+ /* zhua remove this function call, because we can change to get start_time in |
9057 | 1327 |
+ glibtop_get_proc_state(), it don't need open psinfo again here |
1328 |
+ |
|
8180 | 1329 |
+ if (glibtop_get_proc_data_psinfo_s(server, &pinfo, pid)) |
1330 |
+ return; |
|
9057 | 1331 |
+ buf->start_time = pinfo.pr_start.tv_sec; */ |
8180 | 1332 |
+ |
1333 |
if (glibtop_get_proc_data_usage_s (server, &prusage, pid)) |
|
1334 |
return; |
|
1335 |
||
1336 |
- g_get_current_time (&time); |
|
1337 |
- /* prusage.pr_rtime.tv_sec is the during that the process existed */ |
|
1338 |
- buf->start_time = time.tv_sec - prusage.pr_rtime.tv_sec; |
|
1339 |
- |
|
1340 |
- buf->rtime = prusage.pr_rtime.tv_sec * 1E+6 + |
|
1341 |
- prusage.pr_rtime.tv_nsec / 1E+3; |
|
1342 |
buf->utime = prusage.pr_utime.tv_sec * 1E+6 + |
|
1343 |
prusage.pr_utime.tv_nsec / 1E+3; |
|
1344 |
buf->stime = prusage.pr_stime.tv_sec * 1E+6 + |
|
1345 |
prusage.pr_stime.tv_nsec / 1E+3; |
|
1346 |
+ buf->rtime = (buf->utime + buf->stime) / 10000; |
|
1347 |
} |
|
1348 |
||
1349 |
buf->flags = _glibtop_sysdeps_proc_time; |
|
9929 | 1350 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/procwd.c libgtop-2.19.2.mod/sysdeps/solaris/procwd.c |
1351 |
--- libgtop-2.19.2/sysdeps/solaris/procwd.c 1970-01-01 08:00:00.000000000 +0800 |
|
1352 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/procwd.c 2007-05-19 00:11:54.105195000 +0800 |
|
1353 |
@@ -0,0 +1,98 @@ |
|
1354 |
+/* Copyright (C) 2007 Benoît Dejean |
|
1355 |
+ This file is part of LibGTop 2. |
|
1356 |
+ |
|
1357 |
+ LibGTop is free software; you can redistribute it and/or modify it |
|
1358 |
+ under the terms of the GNU General Public License as published by |
|
1359 |
+ the Free Software Foundation; either version 2 of the License, |
|
1360 |
+ or (at your option) any later version. |
|
1361 |
+ |
|
1362 |
+ LibGTop is distributed in the hope that it will be useful, but WITHOUT |
|
1363 |
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
1364 |
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
1365 |
+ for more details. |
|
1366 |
+ |
|
1367 |
+ You should have received a copy of the GNU General Public License |
|
1368 |
+ along with LibGTop; see the file COPYING. If not, write to the |
|
1369 |
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
|
1370 |
+ Boston, MA 02111-1307, USA. |
|
1371 |
+*/ |
|
1372 |
+ |
|
1373 |
+#include <config.h> |
|
1374 |
+#include <glibtop/procwd.h> |
|
1375 |
+#include <glibtop/error.h> |
|
1376 |
+ |
|
1377 |
+#include <glibtop_private.h> |
|
1378 |
+ |
|
1379 |
+#include <unistd.h> |
|
1380 |
+#include <dirent.h> |
|
1381 |
+#include <sys/types.h> |
|
1382 |
+ |
|
1383 |
+ |
|
1384 |
+void |
|
1385 |
+_glibtop_init_proc_wd_s(glibtop *server) |
|
1386 |
+{ |
|
1387 |
+ server->sysdeps.proc_wd = |
|
1388 |
+ (1 << GLIBTOP_PROC_WD_EXE) + |
|
1389 |
+ (1 << GLIBTOP_PROC_WD_ROOT) + |
|
1390 |
+ (1 << GLIBTOP_PROC_WD_NUMBER); |
|
1391 |
+ |
|
1392 |
+} |
|
1393 |
+ |
|
1394 |
+static gboolean is_in(GPtrArray *array, const char *str) |
|
1395 |
+{ |
|
1396 |
+ guint i; |
|
1397 |
+ |
|
1398 |
+ for (i = 0; i != array->len; ++i) { |
|
1399 |
+ if (strcmp(g_ptr_array_index(array, i), str) == 0) |
|
1400 |
+ return TRUE; |
|
1401 |
+ } |
|
1402 |
+ |
|
1403 |
+ return FALSE; |
|
1404 |
+} |
|
1405 |
+ |
|
1406 |
+ |
|
1407 |
+char** |
|
1408 |
+glibtop_get_proc_wd_s(glibtop *server, glibtop_proc_wd *buf, pid_t pid) |
|
1409 |
+{ |
|
1410 |
+ GPtrArray *dirs; |
|
1411 |
+ char path[80]; |
|
1412 |
+ char dir[256]; |
|
1413 |
+ DIR *task; |
|
1414 |
+ |
|
1415 |
+ glibtop_init_s(&server, GLIBTOP_SYSDEPS_PROC_WD, 0); |
|
1416 |
+ |
|
1417 |
+ memset(buf, 0, sizeof(glibtop_proc_wd)); |
|
1418 |
+ |
|
1419 |
+ g_snprintf(path, sizeof path, "/proc/%u/root", pid); |
|
1420 |
+ if (safe_readlink(path, buf->root, sizeof buf->root)) |
|
1421 |
+ buf->flags |= (1 << GLIBTOP_PROC_WD_ROOT); |
|
1422 |
+ |
|
1423 |
+ g_snprintf(path, sizeof path, "/proc/%u/exe", pid); |
|
1424 |
+ if (safe_readlink(path, buf->exe, sizeof buf->exe)) |
|
1425 |
+ buf->flags |= (1 << GLIBTOP_PROC_WD_EXE); |
|
1426 |
+ |
|
1427 |
+ dirs = g_ptr_array_sized_new(2); |
|
1428 |
+ |
|
1429 |
+ g_snprintf(path, sizeof path, "/proc/%u/cwd", pid); |
|
1430 |
+ if (safe_readlink(path, dir, sizeof dir)) |
|
1431 |
+ g_ptr_array_add(dirs, g_strdup(dir)); |
|
1432 |
+ |
|
1433 |
+ g_snprintf(path, sizeof path, "/proc/%u/task", pid); |
|
1434 |
+ if ((task = opendir(path)) != NULL) { |
|
1435 |
+ struct dirent *sub; |
|
1436 |
+ while ((sub = readdir(task)) != NULL) { |
|
1437 |
+ g_snprintf(path, sizeof path, "/proc/%u/task/%s/cwd", pid, sub->d_name); |
|
1438 |
+ if (safe_readlink(path, dir, sizeof dir) && !is_in(dirs, dir)) |
|
1439 |
+ g_ptr_array_add(dirs, g_strdup(dir)); |
|
1440 |
+ } |
|
1441 |
+ closedir(task); |
|
1442 |
+ } |
|
1443 |
+ |
|
1444 |
+ buf->number = dirs->len; |
|
1445 |
+ buf->flags |= (1 << GLIBTOP_PROC_WD_NUMBER); |
|
1446 |
+ |
|
1447 |
+ g_ptr_array_add(dirs, NULL); |
|
1448 |
+ |
|
1449 |
+ return (char**) g_ptr_array_free(dirs, FALSE); |
|
1450 |
+} |
|
1451 |
+ |
|
1452 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/sem_limits.c libgtop-2.19.2.mod/sysdeps/solaris/sem_limits.c |
|
1453 |
--- libgtop-2.19.2/sysdeps/solaris/sem_limits.c 2007-04-27 06:27:38.000000000 +0800 |
|
1454 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/sem_limits.c 2007-05-18 18:27:01.752030000 +0800 |
|
1455 |
@@ -39,14 +39,22 @@ static const unsigned long _glibtop_sysd |
|
8180 | 1456 |
(1L << GLIBTOP_IPC_SEMUSZ) + (1L << GLIBTOP_IPC_SEMVMX) + |
1457 |
(1L << GLIBTOP_IPC_SEMAEM); |
|
1458 |
#else |
|
1459 |
-static const unsigned long _glibtop_sysdeps_sem_limits = 0; |
|
1460 |
+static const unsigned long _glibtop_sysdeps_sem_limits = |
|
1461 |
+(1L << GLIBTOP_IPC_SEMMNI) + |
|
1462 |
+(1L << GLIBTOP_IPC_SEMMSL) + |
|
1463 |
+(1L << GLIBTOP_IPC_SEMOPM); |
|
1464 |
#endif |
|
1465 |
||
1466 |
||
1467 |
/* Init function. */ |
|
1468 |
||
1469 |
+#if GLIBTOP_SUID_SEM_LIMITS |
|
1470 |
void |
|
9929 | 1471 |
_glibtop_init_sem_limits_p (glibtop *server) |
8180 | 1472 |
+#else |
1473 |
+void |
|
9929 | 1474 |
+_glibtop_init_sem_limits_s (glibtop *server) |
1475 |
+#endif |
|
8180 | 1476 |
{ |
1477 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
1478 |
||
9929 | 1479 |
@@ -61,8 +69,13 @@ _glibtop_init_sem_limits_p (glibtop *ser |
8180 | 1480 |
|
1481 |
/* Provides information about sysv sem limits. */ |
|
1482 |
||
1483 |
+#if GLIBTOP_SUID_SEM_LIMITS |
|
1484 |
void |
|
1485 |
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf) |
|
1486 |
+#else |
|
1487 |
+void |
|
1488 |
+glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf) |
|
1489 |
+#endif |
|
1490 |
{ |
|
1491 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
1492 |
kvm_t *kd = server->machine.kd; |
|
9929 | 1493 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/shm_limits.c libgtop-2.19.2.mod/sysdeps/solaris/shm_limits.c |
1494 |
--- libgtop-2.19.2/sysdeps/solaris/shm_limits.c 2007-04-27 06:27:38.000000000 +0800 |
|
1495 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/shm_limits.c 2007-05-18 18:27:11.803445000 +0800 |
|
1496 |
@@ -30,7 +30,9 @@ |
|
8180 | 1497 |
static const struct nlist nlst[] = { {"glibtop_shm_limits"}, {NULL} }; |
1498 |
||
1499 |
#if GLIBTOP_SOLARIS_RELEASE >=51000 |
|
1500 |
-static const unsigned long _glibtop_sysdeps_shm_limits = 0; |
|
1501 |
+static const unsigned long _glibtop_sysdeps_shm_limits = |
|
1502 |
+(1L << GLIBTOP_IPC_SHMMAX) + |
|
1503 |
+(1L << GLIBTOP_IPC_SHMMIN); |
|
1504 |
#else |
|
1505 |
# if GLIBTOP_SOLARIS_RELEASE < 50900 |
|
1506 |
static const unsigned long _glibtop_sysdeps_shm_limits = |
|
9929 | 1507 |
@@ -45,8 +47,13 @@ static const unsigned long _glibtop_sysd |
8180 | 1508 |
|
1509 |
/* Init function. */ |
|
1510 |
||
1511 |
+#if GLIBTOP_SUID_SHM_LIMITS |
|
1512 |
void |
|
9929 | 1513 |
_glibtop_init_shm_limits_p (glibtop *server) |
8180 | 1514 |
+#else |
1515 |
+void |
|
9929 | 1516 |
+_glibtop_init_shm_limits_s (glibtop *server) |
8180 | 1517 |
+#endif |
1518 |
{ |
|
1519 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
1520 |
||
9929 | 1521 |
@@ -61,8 +68,13 @@ _glibtop_init_shm_limits_p (glibtop *ser |
8180 | 1522 |
|
1523 |
/* Provides information about sysv ipc limits. */ |
|
1524 |
||
1525 |
+#if GLIBTOP_SUID_SHM_LIMITS |
|
1526 |
void |
|
1527 |
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf) |
|
1528 |
+#else |
|
1529 |
+void |
|
1530 |
+glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf) |
|
1531 |
+#endif |
|
1532 |
{ |
|
1533 |
#if GLIBTOP_SOLARIS_RELEASE < 51000 |
|
1534 |
||
9929 | 1535 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/siglist.c libgtop-2.19.2.mod/sysdeps/solaris/siglist.c |
1536 |
--- libgtop-2.19.2/sysdeps/solaris/siglist.c 2007-04-27 06:27:38.000000000 +0800 |
|
1537 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/siglist.c 2007-05-18 16:43:23.348125000 +0800 |
|
1538 |
@@ -61,6 +61,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
|
1539 |
{ 35, "SIGTHAW", "Checkpoint Thaw" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1540 |
{ 36, "SIGCANCEL","Thread Cancelation" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1541 |
{ 37, "SIGLOST", "Resource Lost" }, |
9929 | 1542 |
+#if GLIBTOP_SOLARIS_RELEASE < 50900 /* S8 */ |
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1543 |
{ 38, "SIGRTMIN","First Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1544 |
{ 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
|
1545 |
{ 40, "SIGRTMIN+2", "Third Realtime Signal" }, |
9929 | 1546 |
@@ -69,5 +70,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
|
1547 |
{ 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
|
1548 |
{ 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
|
1549 |
{ 45, "SIGRTMAX", "Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1550 |
+#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1551 |
+#if GLIBTOP_SOLARIS_RELEASE >= 50900 |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1552 |
+ { 38, "SIGXRES","Resource Control Exceeded" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1553 |
+#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
|
1554 |
+ { 39, "SIGRTMIN","First Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1555 |
+ { 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
|
1556 |
+ { 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
|
1557 |
+ { 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
|
1558 |
+ { 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
|
1559 |
+ { 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
|
1560 |
+ { 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
|
1561 |
+ { 46, "SIGRTMAX", "Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1562 |
+#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
|
1563 |
+ { 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
|
1564 |
+ { 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
|
1565 |
+ { 41, "SIGRTMIN","First Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1566 |
+ { 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
|
1567 |
+ { 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
|
1568 |
+ { 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
|
1569 |
+ { 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
|
1570 |
+ { 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
|
1571 |
+ { 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
|
1572 |
+ { 48, "SIGRTMAX", "Last Realtime Signal" }, |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1573 |
+#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1574 |
+#endif |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1575 |
{ 0, NULL, NULL } |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1576 |
}; |
9929 | 1577 |
diff -Nrup libgtop-2.19.2/sysdeps/solaris/sysinfo.c libgtop-2.19.2.mod/sysdeps/solaris/sysinfo.c |
1578 |
--- libgtop-2.19.2/sysdeps/solaris/sysinfo.c 1970-01-01 08:00:00.000000000 +0800 |
|
1579 |
+++ libgtop-2.19.2.mod/sysdeps/solaris/sysinfo.c 2007-05-18 17:03:56.558810000 +0800 |
|
7660
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1580 |
@@ -0,0 +1,48 @@ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1581 |
+/* $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
|
1582 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1583 |
+/* 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
|
1584 |
+ 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
|
1585 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1586 |
+ 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
|
1587 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1588 |
+ 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
|
1589 |
+ 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
|
1590 |
+ 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
|
1591 |
+ 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
|
1592 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1593 |
+ 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
|
1594 |
+ 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
|
1595 |
+ 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
|
1596 |
+ for more details. |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1597 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1598 |
+ 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
|
1599 |
+ 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
|
1600 |
+ 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
|
1601 |
+ Boston, MA 02111-1307, USA. |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1602 |
+*/ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1603 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1604 |
+#include <config.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1605 |
+#include <glibtop/error.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1606 |
+#include <glibtop/cpu.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1607 |
+#include <glibtop/sysinfo.h> |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1608 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1609 |
+#include "glibtop_private.h" |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1610 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1611 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1612 |
+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
|
1613 |
+(1L << GLIBTOP_SYSINFO_CPUINFO); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1614 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1615 |
+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
|
1616 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1617 |
+static void |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1618 |
+init_sysinfo (glibtop *server) |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1619 |
+{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1620 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1621 |
+} |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1622 |
+ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1623 |
+const glibtop_sysinfo * |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1624 |
+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
|
1625 |
+{ |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1626 |
+ init_sysinfo (server); |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1627 |
+ return &sysinfo; |
1b4c9716f2c4
Add a patch for libgtop, so that it can build and work at Solaris
hz159841
parents:
diff
changeset
|
1628 |
+} |