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