diff -Nrup libgtop-2.14.3/include/glibtop/error.h libgtop-2.14.3.mod/include/glibtop/error.h
--- libgtop-2.14.3/include/glibtop/error.h 2005-02-15 18:14:59.000000000 +0800
+++ libgtop-2.14.3.mod/include/glibtop/error.h 2006-09-19 15:57:44.849308000 +0800
@@ -33,20 +33,20 @@
G_BEGIN_DECLS
-void glibtop_error_vr (glibtop *server, const char *format, va_list args) G_GNUC_INTERNAL G_GNUC_NORETURN;
-void glibtop_warn_vr (glibtop *server, const char *format, va_list args) G_GNUC_INTERNAL;
-void glibtop_error_io_vr (glibtop *server, const char *format, int, va_list args) G_GNUC_INTERNAL G_GNUC_NORETURN;
-void glibtop_warn_io_vr (glibtop *server, const char *format, int, va_list args) G_GNUC_INTERNAL;
-
-void glibtop_error_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN;
-void glibtop_warn_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
-void glibtop_error_io_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN;
-void glibtop_warn_io_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
-
-void glibtop_error (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN;
-void glibtop_warn (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2);
-void glibtop_error_io (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN;
-void glibtop_warn_io (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2);
+G_GNUC_INTERNAL void glibtop_error_vr (glibtop *server, const char *format, va_list args) G_GNUC_NORETURN;
+G_GNUC_INTERNAL void glibtop_warn_vr (glibtop *server, const char *format, va_list args) ;
+G_GNUC_INTERNAL void glibtop_error_io_vr (glibtop *server, const char *format, int, va_list args) G_GNUC_NORETURN;
+G_GNUC_INTERNAL void glibtop_warn_io_vr (glibtop *server, const char *format, int, va_list args) ;
+
+G_GNUC_INTERNAL void glibtop_error_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN;
+G_GNUC_INTERNAL void glibtop_warn_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3);
+G_GNUC_INTERNAL void glibtop_error_io_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN;
+G_GNUC_INTERNAL void glibtop_warn_io_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3);
+
+G_GNUC_INTERNAL void glibtop_error (const char *format, ...) G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN;
+G_GNUC_INTERNAL void glibtop_warn (const char *format, ...) G_GNUC_PRINTF(1, 2);
+G_GNUC_INTERNAL void glibtop_error_io (const char *format, ...) G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN;
+G_GNUC_INTERNAL void glibtop_warn_io (const char *format, ...) G_GNUC_PRINTF(1, 2);
G_END_DECLS
diff -Nrup libgtop-2.14.3/include/glibtop/procmem.h libgtop-2.14.3.mod/include/glibtop/procmem.h
--- libgtop-2.14.3/include/glibtop/procmem.h 2006-04-23 02:16:53.000000000 +0800
+++ libgtop-2.14.3.mod/include/glibtop/procmem.h 2006-09-19 17:28:53.936872000 +0800
@@ -53,6 +53,7 @@ struct _glibtop_proc_mem
guint64 rss; /* resident set size */
guint64 rss_rlim; /* current limit (in bytes) of the rss
* of the process; usually 2,147,483,647 */
+ guint load; /* cpu load for process */
};
void glibtop_get_proc_mem(glibtop_proc_mem *buf, pid_t pid);
diff -Nrup libgtop-2.14.3/src/daemon/daemon.h libgtop-2.14.3.mod/src/daemon/daemon.h
--- libgtop-2.14.3/src/daemon/daemon.h 2006-04-02 17:10:00.000000000 +0800
+++ libgtop-2.14.3.mod/src/daemon/daemon.h 2006-09-19 17:32:49.755370000 +0800
@@ -59,17 +59,17 @@ G_BEGIN_DECLS
#define MSG_BUFSZ sizeof (struct _glibtop_ipc_message)
#define MSG_MSGSZ (MSG_BUFSZ - sizeof (long))
-void handle_parent_connection (int s) G_GNUC_INTERNAL;
-void handle_slave_connection (int input, int output) G_GNUC_INTERNAL;
-void handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
- const void *parameter) G_GNUC_INTERNAL ;
-
-void do_output (int s, glibtop_response *resp, off_t offset,
- size_t data_size, const void *data) G_GNUC_INTERNAL;
-int do_read (int s, void *ptr, size_t total_size) G_GNUC_INTERNAL;
+G_GNUC_INTERNAL void handle_parent_connection (int s) ;
+G_GNUC_INTERNAL void handle_slave_connection (int input, int output) ;
+G_GNUC_INTERNAL void handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
+ const void *parameter) ;
+
+G_GNUC_INTERNAL void do_output (int s, glibtop_response *resp, off_t offset,
+ size_t data_size, const void *data) ;
+G_GNUC_INTERNAL int do_read (int s, void *ptr, size_t total_size) ;
-void syslog_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
-void syslog_io_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
+G_GNUC_INTERNAL void syslog_message (int priority, const char *format, ...) G_GNUC_PRINTF(2, 3);
+G_GNUC_INTERNAL void syslog_io_message (int priority, const char *format, ...) G_GNUC_PRINTF(2, 3);
extern int enable_debug;
extern int verbose_output;
diff -Nrup libgtop-2.14.3/sysdeps/common/fsusage.c libgtop-2.14.3.mod/sysdeps/common/fsusage.c
--- libgtop-2.14.3/sysdeps/common/fsusage.c 2005-02-28 16:11:15.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/common/fsusage.c 2006-09-19 17:35:19.379045000 +0800
@@ -126,10 +126,10 @@ static const unsigned long _glibtop_sysd
*/
#ifdef linux
-void
+G_GNUC_INTERNAL void
_glibtop_linux_get_fsusage_read_write(glibtop *server,
glibtop_fsusage *buf,
- const char *path) G_GNUC_INTERNAL;
+ const char *path) ;
static inline void
_glibtop_get_fsusage_read_write(glibtop *server,
@@ -141,7 +141,7 @@ _glibtop_get_fsusage_read_write(glibtop
#elif defined(__FreeBSD__)
-void G_GNUC_INTERNAL
+G_GNUC_INTERNAL void
_glibtop_freebsd_get_fsusage_read_write(glibtop *server,
glibtop_fsusage *buf,
const char *path);
@@ -149,8 +149,17 @@ _glibtop_freebsd_get_fsusage_read_write(
#define _glibtop_get_fsusage_read_write(S, B, P) \
_glibtop_freebsd_get_fsusage_read_write(S, B, P)
+#elif (defined(sun) || defined(__sun))
+G_GNUC_INTERNAL void
+_glibtop_sun_get_fsusage_read_write(glibtop *server,
+ glibtop_fsusage *buf,
+ const char *path);
+
+#define _glibtop_get_fsusage_read_write(S, B, P) \
+ _glibtop_sun_get_fsusage_read_write(S, B, P)
+
#else /* default fallback */
-#warning glibtop_get_fsusage .read .write are not implemented.
+/*#warning glibtop_get_fsusage .read .write are not implemented.*/
static inline void
_glibtop_get_fsusage_read_write(glibtop *server,
glibtop_fsusage *buf,
diff -Nrup libgtop-2.14.3/sysdeps/common/mountlist.c libgtop-2.14.3.mod/sysdeps/common/mountlist.c
--- libgtop-2.14.3/sysdeps/common/mountlist.c 2006-06-25 01:24:27.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/common/mountlist.c 2006-09-19 17:39:31.506970000 +0800
@@ -477,8 +477,10 @@ read_filesystem_list (void)
if (fclose (fp) == EOF)
return NULL;
- if (ret > 0)
+ if (ret > 0) {
+ fclose (fp);
return NULL;
+ }
}
#endif /* MOUNTED_GETMNTENT2. */
diff -Nrup libgtop-2.14.3/sysdeps/solaris/Makefile.am libgtop-2.14.3.mod/sysdeps/solaris/Makefile.am
--- libgtop-2.14.3/sysdeps/solaris/Makefile.am 2004-11-13 08:53:20.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/Makefile.am 2006-09-19 17:41:18.192524000 +0800
@@ -8,6 +8,7 @@ libgtop_sysdeps_2_0_la_SOURCES = open.c
proclist.c procstate.c procuid.c \
proctime.c procmem.c procsignal.c \
prockernel.c procsegment.c procargs.c \
+ procopenfiles.c sysinfo.c fsusage.c \
procmap.c netload.c ppp.c procdata.c netlist.c
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
diff -Nrup libgtop-2.14.3/sysdeps/solaris/cpu.c libgtop-2.14.3.mod/sysdeps/solaris/cpu.c
--- libgtop-2.14.3/sysdeps/solaris/cpu.c 2005-12-12 18:09:40.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/cpu.c 2006-09-19 17:42:40.723199000 +0800
@@ -36,6 +36,7 @@ static const unsigned long _glibtop_sysd
static const unsigned long _glibtop_sysdeps_cpu_all =
(1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
+(1L << GLIBTOP_CPU_NICE) +
(1L << GLIBTOP_CPU_SYS) + (1L << GLIBTOP_CPU_IDLE) +
(1L << GLIBTOP_XCPU_TOTAL) + (1L << GLIBTOP_XCPU_USER) +
(1L << GLIBTOP_XCPU_SYS) + (1L << GLIBTOP_XCPU_IDLE) +
diff -Nrup libgtop-2.14.3/sysdeps/solaris/fsusage.c libgtop-2.14.3.mod/sysdeps/solaris/fsusage.c
--- libgtop-2.14.3/sysdeps/solaris/fsusage.c 1970-01-01 08:00:00.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/fsusage.c 2006-09-19 17:44:12.574124000 +0800
@@ -0,0 +1,99 @@
+#include <config.h>
+#include <glibtop.h>
+#include <glibtop/error.h>
+#include <glibtop/fsusage.h>
+#include <glibtop/union.h>
+
+#include "glibtop_private.h"
+
+#include <glib.h>
+
+#include <unistd.h>
+#include <kstat.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <sys/statvfs.h>
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+G_GNUC_INTERNAL void
+_glibtop_sun_get_fsusage_read_write(glibtop *server,
+ glibtop_fsusage *buf,
+ const char *path)
+{
+ struct statvfs64 statvfsbuf;
+ char ksname[KSTAT_STRLEN + 1];
+ kstat_ctl_t * const kctl = server->machine.kc;
+ kstat_t *ksp;
+ kstat_io_t kio;
+ kstat_named_t *kread, *kwrite;
+ int i;
+
+ /*
+ * get a kstat handle and update the user's kstat chain
+ */
+ if( kctl == NULL ){
+ glibtop_warn_io_r (server, "kstat_open ()");
+ return;
+ }
+
+ /* make sure we have current data */
+ while( kstat_chain_update( kctl ) != 0 )
+ ;
+
+ for (ksp = kctl->kc_chain, i =0; ksp != NULL; ksp = ksp->ks_next, i++) {
+ if (ksp->ks_type == KSTAT_TYPE_IO && strcmp(ksp->ks_class,"disk") == 0) {
+ kstat_read(kctl, ksp, &kio);
+ buf->read += kio.nread;
+ buf->write += kio.nwritten;
+ }
+ }
+#if 0
+ /* these codes keep here, because they are a good way to get the
+ fsusage information, but at the moment, the interfaces used
+ are not public or stable. so let's use them when public...
+ */
+ /*
+ * get a kstat handle and update the user's kstat chain
+ */
+ if( kctl == NULL ){
+ glibtop_warn_io_r (server, "kstat_open ()");
+ return;
+ }
+
+ while( kstat_chain_update( kctl ) != 0 )
+ ;
+
+ if (statvfs64(path, &statvfsbuf) != 0) {
+ glibtop_warn_io_r (server, "kstat_open ()");
+ return;
+ }
+ snprintf(ksname, KSTAT_STRLEN, "%s%lx", VOPSTATS_STR,
+ statvfsbuf.f_fsid);
+
+ /*
+ * traverse the kstat chain
+ * to find the appropriate statistics
+ */
+ if( (ksp = kstat_lookup( kctl,
+ "unix", 0, ksname )) == NULL ) {
+ return;
+ }
+ if( kstat_read( kctl, ksp, NULL ) == -1 ) {
+ return;
+ }
+
+ kread = (kstat_named_t *)kstat_data_lookup(ksp,"read_bytes");
+ if( kread != NULL ) {
+ buf->read = kread->value.ull;
+ }
+
+ kwrite = (kstat_named_t *)kstat_data_lookup(ksp,"write_bytes");
+ if( kwrite != NULL ) {
+ buf->write = kwrite->value.ull;
+ }
+#endif
+ buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
+}
diff -Nrup libgtop-2.14.3/sysdeps/solaris/glibtop_machine.h libgtop-2.14.3.mod/sysdeps/solaris/glibtop_machine.h
--- libgtop-2.14.3/sysdeps/solaris/glibtop_machine.h 2006-06-25 01:52:28.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/glibtop_machine.h 2006-09-19 17:47:32.238908000 +0800
@@ -63,14 +63,7 @@ struct _glibtop_machine
int pagesize; /* in bits to shift, ie. 2^pagesize gives Kb */
int ticks; /* clock ticks, as returned by sysconf() */
unsigned long long boot; /* boot time, although it's ui32 in kstat */
- void *libproc; /* libproc handle */
-#if GLIBTOP_SOLARIS_RELEASE >= 50600
- void (*objname)(void *, uintptr_t, const char *, size_t);
- struct ps_prochandle *(*pgrab)(pid_t, int, int *);
- void (*pfree)(void *);
-#else
void *filler[3];
-#endif
};
G_END_DECLS
diff -Nrup libgtop-2.14.3/sysdeps/solaris/glibtop_server.h libgtop-2.14.3.mod/sysdeps/solaris/glibtop_server.h
--- libgtop-2.14.3/sysdeps/solaris/glibtop_server.h 2005-08-12 22:55:37.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/glibtop_server.h 2006-09-19 17:50:53.413486000 +0800
@@ -31,9 +31,15 @@ G_BEGIN_DECLS
#define GLIBTOP_SUID_SWAP 0
#define GLIBTOP_SUID_UPTIME 0
#define GLIBTOP_SUID_LOADAVG 0
+#if GLIBTOP_SOLARIS_RELEASE < 51000
#define GLIBTOP_SUID_SHM_LIMITS (1L << GLIBTOP_SYSDEPS_SHM_LIMITS)
#define GLIBTOP_SUID_MSG_LIMITS (1L << GLIBTOP_SYSDEPS_MSG_LIMITS)
#define GLIBTOP_SUID_SEM_LIMITS (1L << GLIBTOP_SYSDEPS_SEM_LIMITS)
+#else
+#define GLIBTOP_SUID_SHM_LIMITS 0
+#define GLIBTOP_SUID_MSG_LIMITS 0
+#define GLIBTOP_SUID_SEM_LIMITS 0
+#endif
#define GLIBTOP_SUID_PROCLIST 0
#define GLIBTOP_SUID_PROC_STATE 0
#define GLIBTOP_SUID_PROC_UID 0
diff -Nrup libgtop-2.14.3/sysdeps/solaris/msg_limits.c libgtop-2.14.3.mod/sysdeps/solaris/msg_limits.c
--- libgtop-2.14.3/sysdeps/solaris/msg_limits.c 2006-06-25 01:16:53.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/msg_limits.c 2006-09-19 17:58:06.482092000 +0800
@@ -39,14 +39,24 @@ static const unsigned long _glibtop_sysd
(1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGMNI) +
(1L << GLIBTOP_IPC_MSGTQL);
#else
-static const unsigned long _glibtop_sysdeps_msg_limits = 0;
+static const unsigned long _glibtop_sysdeps_msg_limits =
+(1L << GLIBTOP_IPC_MSGMNB) +
+(1L << GLIBTOP_IPC_MSGMNI) +
+(1L << GLIBTOP_IPC_MSGMAX) +
+(1L << GLIBTOP_IPC_MSGPOOL) +
+(1L << GLIBTOP_IPC_MSGTQL);
#endif
/* Init function. */
+#if GLIBTOP_SUID_MSG_LIMITS
void
glibtop_init_msg_limits_p (glibtop *server)
+#else
+void
+glibtop_init_msg_limits_s (glibtop *server)
+#endif
{
#if GLIBTOP_SOLARIS_RELEASE < 51000
@@ -61,8 +71,13 @@ glibtop_init_msg_limits_p (glibtop *serv
/* Provides information about sysv ipc limits. */
+#if GLIBTOP_SUID_MSG_LIMITS
void
glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
+#else
+void
+glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
+#endif
{
#if GLIBTOP_SOLARIS_RELEASE < 51000
diff -Nrup libgtop-2.14.3/sysdeps/solaris/netlist.c libgtop-2.14.3.mod/sysdeps/solaris/netlist.c
--- libgtop-2.14.3/sysdeps/solaris/netlist.c 2006-06-25 01:33:05.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/netlist.c 2006-09-19 18:06:30.883466000 +0800
@@ -41,7 +41,10 @@ glibtop_get_netlist_s (glibtop *server,
{
GPtrArray *devices;
kstat_t *ksp;
- kstat_ctl_t *kc;
+ /* use the kc installed in server, don't need to create again,
+ it will save some time and improve performance */
+ kstat_ctl_t * const kc = server->machine.kc;
+ int check = buf->flags;
glibtop_init_s (&server, GLIBTOP_SYSDEPS_NETLIST, 0);
@@ -49,9 +52,9 @@ glibtop_get_netlist_s (glibtop *server,
devices = g_ptr_array_new();
- kc = kstat_open();
if (kc == NULL) {
glibtop_warn_io_r(server, "kstat_open()");
+ buf->number = 0;
return NULL;
}
@@ -60,12 +63,27 @@ glibtop_get_netlist_s (glibtop *server,
if (strcmp(ksp->ks_class, "net") != 0)
continue;
- g_ptr_array_add(devices, g_strdup(ksp->ks_name));
- buf->number++;
+ /* do some check to see if the first character is the same between
+ name and module, if not, we don't return it, because
+ glibtop_get_netload() only want the same ones....
+ */
+ if (check){
+ /* if the first character is not same, they should not
+ the one we will use in glibtop_get_netload() */
+ if (ksp->ks_name[0] != ksp->ks_module[0])
+ continue;
+ /* because in glibtop_get_netload(), name
+ is at least 1 character longer than module */
+ if (strlen( ksp->ks_module ) >= strlen( ksp->ks_name))
+ continue;
+ /* if it's not digital, continue directly */
+ if( !isdigit( (int) ksp->ks_name[strlen( ksp->ks_module )] ))
+ continue;
+ }
+ g_ptr_array_add(devices, g_strdup(ksp->ks_name));
+ buf->number++;
}
- kstat_close(kc);
-
buf->flags = _glibtop_sysdeps_netlist;
g_ptr_array_add(devices, NULL);
diff -Nrup libgtop-2.14.3/sysdeps/solaris/netload.c libgtop-2.14.3.mod/sysdeps/solaris/netload.c
--- libgtop-2.14.3/sysdeps/solaris/netload.c 2005-12-12 18:09:40.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/netload.c 2006-09-19 18:21:59.974996000 +0800
@@ -26,14 +26,247 @@
#include <glibtop/error.h>
#include <glibtop/netload.h>
-static const unsigned long _glibtop_sysdeps_netload = 0;
+#include "glibtop_private.h"
+
+#include <errno.h>
+#include <string.h>
+#include <kstat.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <sys/sockio.h>
+
+//#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
+/* GNU LibC */
+#include <net/if.h>
+
+#ifdef HAVE_IFADDRS_H
+/* needed for IPV6 support */
+
+#include <ifaddrs.h>
+
+#ifndef IN6_IS_ADDR_GLOBAL
+#define IN6_IS_ADDR_GLOBAL(a) \
+ (((((__const uint8_t *) (a))[0] & 0xff) == 0x3f \
+ || (((__const uint8_t *) (a))[0] & 0xff) == 0x20))
+#endif
+#endif /* HAVE_IFADDRS_H */
+
+static const unsigned long _glibtop_sysdeps_netload =
+(1L << GLIBTOP_NETLOAD_ERRORS_IN) +
+(1L << GLIBTOP_NETLOAD_ERRORS_OUT) +
+(1L << GLIBTOP_NETLOAD_COLLISIONS);
+
+static const unsigned long _glibtop_sysdeps_netload_data =
+(1L << GLIBTOP_NETLOAD_ADDRESS) +
+(1L << GLIBTOP_NETLOAD_SUBNET) +
+(1L << GLIBTOP_NETLOAD_MTU);
+
+static const unsigned long _glibtop_sysdeps_netload_bytes =
+(1L << GLIBTOP_NETLOAD_BYTES_IN) +
+(1L << GLIBTOP_NETLOAD_BYTES_OUT) +
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL);
+
+static const unsigned long _glibtop_sysdeps_netload_packets =
+(1L << GLIBTOP_NETLOAD_PACKETS_IN) +
+(1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL);
+
+static const unsigned long _glibtop_sysdeps_netload_total =
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL);
+
+static const unsigned long _glibtop_sysdeps_netload_in =
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) +
+(1L << GLIBTOP_NETLOAD_PACKETS_IN) +
+(1L << GLIBTOP_NETLOAD_BYTES_IN);
+
+static const unsigned long _glibtop_sysdeps_netload_out =
+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) +
+(1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
+(1L << GLIBTOP_NETLOAD_BYTES_OUT);
+
+static const unsigned long _glibtop_sysdeps_netload_6 =
+(1L << GLIBTOP_NETLOAD_ADDRESS6) +
+(1L << GLIBTOP_NETLOAD_PREFIX6) +
+(1L << GLIBTOP_NETLOAD_SCOPE6);
+
/* Init function. */
void
glibtop_init_netload_s (glibtop *server)
{
- server->sysdeps.netload = _glibtop_sysdeps_netload;
+ server->sysdeps.netload = _glibtop_sysdeps_netload |
+ _glibtop_sysdeps_netload_bytes |
+ _glibtop_sysdeps_netload_packets;
+}
+
+
+#ifdef HAVE_IFADDRS_H
+
+static void get_ipv6(glibtop *server, glibtop_netload *buf,
+ const char *interface)
+{
+/*
+ * remove this code, because they are not available at Solaris, but keep them here for reference.
+ * in fact, the function will not be called at Solaris, because HAVE_IFADDRS_H don't def.
+ *
+*/
+#if 0
+ struct ifaddrs *ifa0, *ifr6;
+
+ if(getifaddrs (&ifa0) != 0)
+ {
+ glibtop_warn_r(server, "getifaddrs failed : %s", g_strerror(errno));
+ return;
+ }
+
+ for (ifr6 = ifa0; ifr6; ifr6 = ifr6->ifa_next) {
+ if (strcmp (ifr6->ifa_name, interface) == 0
+ && ifr6->ifa_addr != NULL
+ && ifr6->ifa_addr->sa_family == AF_INET6)
+ break;
+ }
+
+ if(!ifr6) goto free_ipv6;
+
+ memcpy(buf->address6,
+ &((struct sockaddr_in6 *) ifr6->ifa_addr)->sin6_addr,
+ 16);
+
+ memcpy(buf->prefix6,
+ &((struct sockaddr_in6 *) ifr6->ifa_netmask)->sin6_addr,
+ 16);
+
+
+ if (IN6_IS_ADDR_LINKLOCAL (buf->address6))
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_LINK;
+
+ else if (IN6_IS_ADDR_SITELOCAL (buf->address6))
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_SITE;
+
+ else if (IN6_IS_ADDR_GLOBAL (buf->address6)
+ || IN6_IS_ADDR_MC_ORGLOCAL (buf->address6)
+ || IN6_IS_ADDR_V4COMPAT (buf->address6)
+ || IN6_IS_ADDR_MULTICAST (buf->address6)
+ || IN6_IS_ADDR_UNSPECIFIED (buf->address6)
+ )
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_GLOBAL;
+
+ else if (IN6_IS_ADDR_LOOPBACK (buf->address6))
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_HOST;
+
+ else
+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_UNKNOWN;
+
+ buf->flags |= _glibtop_sysdeps_netload_6;
+
+ free_ipv6:
+ freeifaddrs(ifa0);
+#endif
+}
+
+#endif /* HAVE_IFADDRS_H */
+
+
+
+static int
+solaris_stats(glibtop *server,
+ glibtop_netload *buf,
+ const char *interface)
+{
+ char *name = interface;
+ char *module;
+ char *ptr;
+ kstat_ctl_t * const kctl = server->machine.kc;
+ kstat_t *ksp;
+ kstat_named_t *kdata;
+ int have_bytes = 1;
+
+ /*
+ * chop off the trailing interface and
+ */
+ module = strdup( name );
+ ptr = module + strlen( module ) - 1;
+ while( (ptr > module) && isdigit( (int) *ptr ) ) {
+ *ptr = '\0';
+ ptr--;
+ }
+
+ /*
+ * get a kstat handle and update the user's kstat chain
+ */
+ if( kctl == NULL ){
+ glibtop_warn_io_r (server, "kstat_open ()");
+ free( module );
+ return( 0 );
+ }
+ while( kstat_chain_update( kctl ) != 0 )
+ ;
+
+ /*
+ * traverse the kstat chain
+ * to find the appropriate statistics
+ */
+ if( (ksp = kstat_lookup( kctl,
+ module, 0, name )) == NULL ) {
+ free( module );
+ return( 0 );
+ }
+ if( kstat_read( kctl, ksp, NULL ) == -1 ) {
+ free( module );
+ return( 0 );
+ }
+ free( module );
+
+ /*
+ * lookup & store the data
+ */
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "ipackets" );
+ if( kdata != NULL ) {
+ buf->packets_in= kdata->value.ul;
+ }
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "opackets" );
+ if( kdata != NULL ) {
+ buf->packets_out = kdata->value.ul;
+ }
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "rbytes" );
+ if( kdata != NULL ) {
+ buf->bytes_in =kdata->value.ul;
+ }
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "obytes" );
+ if( kdata != NULL ) {
+ buf->bytes_out =kdata->value.ul;
+ }
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "ierrors" );
+ if( kdata != NULL ) {
+ buf->errors_in = kdata->value.ul;
+ }
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "oerrors" );
+ if( kdata != NULL ) {
+ buf->errors_out = kdata->value.ul;
+ }
+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "collisions" );
+ if( kdata != NULL ) {
+ buf->collisions = kdata->value.ul;
+ }
+
+ /* Compute total valules. */
+
+ buf->bytes_total = buf->bytes_in + buf->bytes_out;
+ buf->packets_total = buf->packets_in + buf->packets_out;
+ buf->errors_total = buf->errors_in + buf->errors_out;
+ /* And now the flags. */
+ buf->flags |= _glibtop_sysdeps_netload;
+ buf->flags |= _glibtop_sysdeps_netload_bytes;
+ buf->flags |= _glibtop_sysdeps_netload_packets;
+
+ /* finished */
+
}
/* Provides network statistics. */
@@ -42,5 +275,73 @@ void
glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
const char *interface)
{
- memset (buf, 0, sizeof (glibtop_netload));
+ int skfd;
+ memset (buf, 0, sizeof (glibtop_netload));
+
+ /* set flag */
+ skfd = socket (PF_INET, SOCK_DGRAM, 0);
+ if (skfd) {
+ struct ifreq ifr;
+
+ g_strlcpy (ifr.ifr_name, interface, sizeof ifr.ifr_name);
+ if (ioctl (skfd, SIOCGIFFLAGS, &ifr) >= 0) {
+ const unsigned long long flags = ifr.ifr_flags;
+
+ buf->flags |= (1L << GLIBTOP_NETLOAD_IF_FLAGS);
+
+ if (flags & IFF_UP)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_UP);
+
+ if (flags & IFF_BROADCAST)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_BROADCAST);
+
+ if (flags & IFF_DEBUG)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_DEBUG);
+
+ if (flags & IFF_LOOPBACK)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK);
+
+ if (flags & IFF_POINTOPOINT)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT);
+
+ if (flags & IFF_RUNNING)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING);
+
+ if (flags & IFF_NOARP)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP);
+
+ if (flags & IFF_PROMISC)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC);
+
+ if (flags & IFF_ALLMULTI)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI);
+
+ if (flags & IFF_MULTICAST)
+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_MULTICAST);
+ }
+
+ g_strlcpy (ifr.ifr_name, interface, sizeof ifr.ifr_name);
+ if (!ioctl (skfd, SIOCGIFADDR, &ifr)) {
+ buf->address = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr;
+ buf->flags |= (1L << GLIBTOP_NETLOAD_ADDRESS);
+ }
+
+ g_strlcpy (ifr.ifr_name, interface, sizeof ifr.ifr_name);
+ if (!ioctl (skfd, SIOCGIFNETMASK, &ifr)) {
+ buf->subnet = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr.s_addr;
+ buf->flags |= (1L << GLIBTOP_NETLOAD_SUBNET);
+ }
+ close (skfd);
+ }
+
+ /*
+ * Statistics
+ */
+
+ solaris_stats(server, buf, interface);
+
+#ifdef HAVE_IFADDRS_H
+ get_ipv6(server, buf, interface);
+#endif /* HAVE_IFADDRS_H */
}
+
diff -Nrup libgtop-2.14.3/sysdeps/solaris/open.c libgtop-2.14.3.mod/sysdeps/solaris/open.c
--- libgtop-2.14.3/sysdeps/solaris/open.c 2006-06-25 01:39:49.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/open.c 2006-09-19 18:25:54.519665000 +0800
@@ -211,34 +211,5 @@ glibtop_open_s (glibtop *server, const c
}
}
- /* Now let's have a bit of magic dust... */
-
-#if GLIBTOP_SOLARIS_RELEASE >= 50600
-
- dl = dlopen("/usr/lib/libproc.so", RTLD_LAZY);
- if(server->machine.libproc)
- dlclose(server->machine.libproc);
- server->machine.libproc = dl;
- if(dl)
- {
- void *func;
-
- func = dlsym(dl, "Pobjname"); /* Solaris 8 */
- if(!func)
- func = dlsym(dl, "proc_objname"); /* Solaris 7 */
- server->machine.objname = (void (*)
- (void *, uintptr_t, const char *, size_t))func;
- server->machine.pgrab = (struct ps_prochandle *(*)(pid_t, int, int *))
- dlsym(dl, "Pgrab");
- server->machine.pfree = (void (*)(void *))dlsym(dl, "Pfree");
-
- }
- else
- {
- server->machine.objname = NULL;
- server->machine.pgrab = NULL;
- server->machine.pfree = NULL;
- }
-#endif
server->machine.me = getpid();
}
diff -Nrup libgtop-2.14.3/sysdeps/solaris/procmap.c libgtop-2.14.3.mod/sysdeps/solaris/procmap.c
--- libgtop-2.14.3/sysdeps/solaris/procmap.c 2006-06-25 01:45:29.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/procmap.c 2006-09-19 18:41:08.104537000 +0800
@@ -56,6 +56,7 @@ glibtop_map_entry *
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
{
int fd, i, nmaps, pr_err, heap;
+ char filename [BUFSIZ];
#if GLIBTOP_SOLARIS_RELEASE >= 50600
prxmap_t *maps;
struct ps_prochandle *Pr = NULL;
@@ -125,15 +126,9 @@ glibtop_get_proc_map_s (glibtop *server,
buf->total = nmaps * sizeof(glibtop_map_entry);
entry = g_malloc0(buf->total);
-#if GLIBTOP_SOLARIS_RELEASE >= 50600
-
- if(server->machine.objname && server->machine.pgrab &&
- server->machine.pfree)
- Pr = (server->machine.pgrab)(pid, 1, &pr_err);
-#endif
for(heap = 0,i = 0; i < nmaps; ++i)
{
- int len;
+ int len, rv;
entry[i].start = maps[i].pr_vaddr;
entry[i].end = maps[i].pr_vaddr + maps[i].pr_size;
@@ -156,8 +151,12 @@ glibtop_get_proc_map_s (glibtop *server,
}
if(maps[i].pr_mflags & MA_EXEC)
entry[i].perm |= GLIBTOP_MAP_PERM_EXECUTE;
- if(maps[i].pr_mflags & MA_SHARED)
- entry[i].perm |= GLIBTOP_MAP_PERM_SHARED;
+ if(maps[i].pr_mflags & MA_SHARED){
+ entry[i].perm |= GLIBTOP_MAP_PERM_SHARED;
+ /* here use shared_clean to store Shared Memory */
+ entry[i].shared_clean = maps[i].pr_size;
+ }
+
else
entry[i].perm |= GLIBTOP_MAP_PERM_PRIVATE;
entry[i].flags = _glibtop_sysdeps_map_entry;
@@ -179,25 +178,24 @@ glibtop_get_proc_map_s (glibtop *server,
entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME);
}
else
- if(Pr)
- {
- server->machine.objname(Pr, maps[i].pr_vaddr, buffer,
- BUFSIZ);
- if((len = resolvepath(buffer, entry[i].filename,
- GLIBTOP_MAP_FILENAME_LEN)) > 0)
- {
- entry[i].filename[len] = 0;
- entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME);
- }
- }
+ {
+ strcpy(buffer, maps[i].pr_mapname);
+ /* from /path get file name */
+ g_snprintf(filename, sizeof filename, "/proc/%d/path/%s",
+ pid, buffer);
+
+ rv = readlink(filename, entry[i].filename, sizeof(entry[i].filename) - 1);
+ /* read object, if have not, set it as NULL */
+ if(rv < 0)
+ rv = 0;
+ entry[i].filename[rv] = '\0';
+ /* now set the flags */
+ entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME);
+ }
+
#endif
}
-#if GLIBTOP_SOLARIS_RELEASE >= 50600
-
- if(Pr)
- server->machine.pfree(Pr);
-#endif
buf->flags = _glibtop_sysdeps_proc_map;
s_close(fd);
return entry;
diff -Nrup libgtop-2.14.3/sysdeps/solaris/procmem.c libgtop-2.14.3.mod/sysdeps/solaris/procmem.c
--- libgtop-2.14.3/sysdeps/solaris/procmem.c 2005-12-12 18:09:40.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/procmem.c 2006-09-19 19:52:07.742086000 +0800
@@ -24,6 +24,7 @@
#include <config.h>
#include <glibtop.h>
#include <glibtop/procmem.h>
+#include <glibtop/procmap.h>
#include "glibtop_private.h"
@@ -59,9 +60,26 @@ glibtop_get_proc_mem_s (glibtop *server,
#ifdef HAVE_PROCFS_H
buf->size = buf->vsize = psinfo.pr_size << 10;
buf->resident = buf->rss = psinfo.pr_rssize << 10;
+ buf->load = (guint) psinfo.pr_lwp.pr_pctcpu * 100 / (guint) 0x8000;
#else
buf->size = buf->vsize = psinfo.pr_size << pagesize << 10;
buf->resident = buf->rss = psinfo.pr_rssize << pagesize << 10;
+ buf->load = (guint) psinfo.pr_lwp.pr_pctcpu * 100 / (guint) 0x8000;
#endif
+
+/* get Shared Memory */
+ glibtop_proc_map mapbuf;
+ glibtop_map_entry *maps;
+ unsigned i;
+ buf->share = 0;
+
+ maps = glibtop_get_proc_map_s(server, &mapbuf, pid);
+
+ for (i = 0; i < mapbuf.number; ++i) {
+ if (maps[i].perm & GLIBTOP_MAP_PERM_SHARED)
+ buf->share += maps[i].shared_clean;
+ }
+ g_free(maps);
+
buf->flags = _glibtop_sysdeps_proc_mem;
}
diff -Nrup libgtop-2.14.3/sysdeps/solaris/procopenfiles.c libgtop-2.14.3.mod/sysdeps/solaris/procopenfiles.c
--- libgtop-2.14.3/sysdeps/solaris/procopenfiles.c 1970-01-01 08:00:00.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/procopenfiles.c 2006-09-19 18:47:59.367792000 +0800
@@ -0,0 +1,130 @@
+/* $Id: procopenfiles.c,v 1.7 2005/12/12 09:38:12 jamesh Exp $ */
+
+/* Copyright (C) 2006 Henry Zhang
+ This file is part of LibGTop 2.14.
+
+ Contributed by Henry Zhang <[email protected]>, July 2006.
+
+ LibGTop is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ LibGTop is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LibGTop; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+#include <glibtop.h>
+#include <glibtop/error.h>
+#include <glibtop/procopenfiles.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "glibtop_private.h"
+
+static const unsigned long _glibtop_sysdeps_proc_open_files =
+(1L << GLIBTOP_PROC_OPEN_FILES_NUMBER)|
+(1L << GLIBTOP_PROC_OPEN_FILES_TOTAL)|
+(1L << GLIBTOP_PROC_OPEN_FILES_SIZE);
+
+/* Init function. */
+
+void
+glibtop_init_proc_open_files_s (glibtop *server)
+{
+ server->sysdeps.proc_open_files = _glibtop_sysdeps_proc_open_files;
+}
+
+
+
+/* Provides detailed information about a process' open files */
+
+glibtop_open_files_entry *
+glibtop_get_proc_open_files_s (glibtop *server, glibtop_proc_open_files *buf, pid_t pid)
+{
+ char filename [BUFSIZ];
+ GArray *entries;
+ struct dirent *direntry;
+ DIR *dir;
+ int errno;
+
+ glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_OPEN_FILES, 0);
+
+ memset (buf, 0, sizeof (glibtop_proc_open_files));
+
+ sprintf (filename, "/proc/%d/fd", pid);
+
+ dir = opendir (filename);
+ if (!dir) return NULL;
+
+ entries = g_array_new(FALSE, FALSE, sizeof(glibtop_open_files_entry));
+
+ while((direntry = readdir(dir))) {
+ char tgt [BUFSIZ];
+ int rv;
+ glibtop_open_files_entry entry = {0};
+ struct stat statbuf;
+
+ if(direntry->d_name[0] == '.')
+ continue;
+
+ if ((entry.fd = (int) g_ascii_strtoull(direntry->d_name, NULL, 10)) == 0)
+ continue;
+
+ /* from /path get object name */
+ g_snprintf(filename, sizeof filename, "/proc/%d/path/%s",
+ pid, direntry->d_name);
+
+ rv = readlink(filename, tgt, sizeof(tgt) - 1);
+ /* read object, if not have, set it as NULL, but this fd still need to insert into the array */
+ if(rv < 0)
+ rv = 0;
+ tgt[rv] = '\0';
+
+ /* from /fd get the stat data */
+ g_snprintf(filename, sizeof filename, "/proc/%d/fd/%s",
+ pid, direntry->d_name);
+
+ if(stat (filename, &statbuf))
+ statbuf.st_mode = 0;
+
+ switch (statbuf.st_mode & S_IFMT) {
+ case S_IFIFO: /* pipe */
+ entry.type = GLIBTOP_FILE_TYPE_PIPE;
+ break;
+ case S_IFSOCK: /* socket */
+ /* at solaris, now a little difficult to tell the Socket type, so here I
+ give the type 0, it will not impact the existed code. Later will provide
+ a patch to tell the type, and get the object name */
+ entry.type = 0;
+ break;
+ default:
+ entry.type = GLIBTOP_FILE_TYPE_FILE;
+ }
+
+ g_strlcpy(entry.info.file.name, tgt, sizeof entry.info.file.name);
+
+ g_array_append_val(entries, entry);
+ }
+
+ closedir (dir);
+
+ buf->flags = _glibtop_sysdeps_proc_open_files;
+ buf->number = entries->len;
+ buf->size = sizeof(glibtop_open_files_entry);
+ buf->total = buf->number * buf->size;
+
+ return (glibtop_open_files_entry*)g_array_free(entries, FALSE);
+}
diff -Nrup libgtop-2.14.3/sysdeps/solaris/proctime.c libgtop-2.14.3.mod/sysdeps/solaris/proctime.c
--- libgtop-2.14.3/sysdeps/solaris/proctime.c 2006-06-25 01:47:34.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/proctime.c 2006-09-19 18:57:06.349706000 +0800
@@ -45,8 +45,12 @@ void
glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf,
pid_t pid)
{
+#ifdef HAVE_PROCFS_H
+ struct psinfo pinfo;
+#else
+ struct prpsinfo pinfo;
+#endif
struct prusage prusage;
- GTimeVal time;
memset (buf, 0, sizeof (glibtop_proc_time));
@@ -54,19 +58,18 @@ glibtop_get_proc_time_s (glibtop *server
if(pid)
{
+ if (glibtop_get_proc_data_psinfo_s(server, &pinfo, pid))
+ return;
+ buf->start_time = pinfo.pr_start.tv_sec;
+
if (glibtop_get_proc_data_usage_s (server, &prusage, pid))
return;
- g_get_current_time (&time);
- /* prusage.pr_rtime.tv_sec is the during that the process existed */
- buf->start_time = time.tv_sec - prusage.pr_rtime.tv_sec;
-
- buf->rtime = prusage.pr_rtime.tv_sec * 1E+6 +
- prusage.pr_rtime.tv_nsec / 1E+3;
buf->utime = prusage.pr_utime.tv_sec * 1E+6 +
prusage.pr_utime.tv_nsec / 1E+3;
buf->stime = prusage.pr_stime.tv_sec * 1E+6 +
prusage.pr_stime.tv_nsec / 1E+3;
+ buf->rtime = (buf->utime + buf->stime) / 10000;
}
buf->flags = _glibtop_sysdeps_proc_time;
diff -Nrup libgtop-2.14.3/sysdeps/solaris/sem_limits.c libgtop-2.14.3.mod/sysdeps/solaris/sem_limits.c
--- libgtop-2.14.3/sysdeps/solaris/sem_limits.c 2006-06-25 01:16:53.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/sem_limits.c 2006-09-19 20:05:46.475921000 +0800
@@ -41,14 +41,22 @@ static const unsigned long _glibtop_sysd
(1L << GLIBTOP_IPC_SEMUSZ) + (1L << GLIBTOP_IPC_SEMVMX) +
(1L << GLIBTOP_IPC_SEMAEM);
#else
-static const unsigned long _glibtop_sysdeps_sem_limits = 0;
+static const unsigned long _glibtop_sysdeps_sem_limits =
+(1L << GLIBTOP_IPC_SEMMNI) +
+(1L << GLIBTOP_IPC_SEMMSL) +
+(1L << GLIBTOP_IPC_SEMOPM);
#endif
/* Init function. */
+#if GLIBTOP_SUID_SEM_LIMITS
void
glibtop_init_sem_limits_p (glibtop *server)
+#else
+void
+glibtop_init_sem_limits_s (glibtop *server)
+#endif
{
#if GLIBTOP_SOLARIS_RELEASE < 51000
@@ -63,8 +71,13 @@ glibtop_init_sem_limits_p (glibtop *serv
/* Provides information about sysv sem limits. */
+#if GLIBTOP_SUID_SEM_LIMITS
void
glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
+#else
+void
+glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf)
+#endif
{
#if GLIBTOP_SOLARIS_RELEASE < 51000
kvm_t *kd = server->machine.kd;
diff -Nrup libgtop-2.14.3/sysdeps/solaris/shm_limits.c libgtop-2.14.3.mod/sysdeps/solaris/shm_limits.c
--- libgtop-2.14.3/sysdeps/solaris/shm_limits.c 2006-06-25 01:16:53.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/shm_limits.c 2006-09-19 19:10:47.378164000 +0800
@@ -32,7 +32,9 @@
static const struct nlist nlst[] = { {"glibtop_shm_limits"}, {NULL} };
#if GLIBTOP_SOLARIS_RELEASE >=51000
-static const unsigned long _glibtop_sysdeps_shm_limits = 0;
+static const unsigned long _glibtop_sysdeps_shm_limits =
+(1L << GLIBTOP_IPC_SHMMAX) +
+(1L << GLIBTOP_IPC_SHMMIN);
#else
# if GLIBTOP_SOLARIS_RELEASE < 50900
static const unsigned long _glibtop_sysdeps_shm_limits =
@@ -47,8 +49,13 @@ static const unsigned long _glibtop_sysd
/* Init function. */
+#if GLIBTOP_SUID_SHM_LIMITS
void
glibtop_init_shm_limits_p (glibtop *server)
+#else
+void
+glibtop_init_shm_limits_s (glibtop *server)
+#endif
{
#if GLIBTOP_SOLARIS_RELEASE < 51000
@@ -63,8 +70,13 @@ glibtop_init_shm_limits_p (glibtop *serv
/* Provides information about sysv ipc limits. */
+#if GLIBTOP_SUID_SHM_LIMITS
void
glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
+#else
+void
+glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf)
+#endif
{
#if GLIBTOP_SOLARIS_RELEASE < 51000
diff -Nrup libgtop-2.14.3/sysdeps/solaris/siglist.c libgtop-2.14.3.mod/sysdeps/solaris/siglist.c
--- libgtop-2.14.3/sysdeps/solaris/siglist.c 2005-12-12 18:09:40.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/siglist.c 2006-09-19 19:12:41.405247000 +0800
@@ -63,6 +63,7 @@ const glibtop_signame glibtop_sys_siglis
{ 35, "SIGTHAW", "Checkpoint Thaw" },
{ 36, "SIGCANCEL","Thread Cancelation" },
{ 37, "SIGLOST", "Resource Lost" },
+#if GLIBTOP_SOLARIS_RELEASE < 50900 /* S8 */
{ 38, "SIGRTMIN","First Realtime Signal" },
{ 39, "SIGRTMIN+1", "Second Realtime Signal" },
{ 40, "SIGRTMIN+2", "Third Realtime Signal" },
@@ -71,5 +72,30 @@ const glibtop_signame glibtop_sys_siglis
{ 43, "SIGRTMAX-2", "Third Last Realtime Signal" },
{ 44, "SIGRTMAX-1", "Second Last Realtime Signal" },
{ 45, "SIGRTMAX", "Last Realtime Signal" },
+#endif
+#if GLIBTOP_SOLARIS_RELEASE >= 50900
+ { 38, "SIGXRES","Resource Control Exceeded" },
+#if GLIBTOP_SOLARIS_RELEASE <51000 /* signal here existed in s9 */
+ { 39, "SIGRTMIN","First Realtime Signal" },
+ { 40, "SIGRTMIN+1", "Second Realtime Signal" },
+ { 41, "SIGRTMIN+2", "Third Realtime Signal" },
+ { 42, "SIGRTMIN+3", "Fourth Realtime Signal" },
+ { 43, "SIGRTMAX-3", "Fourth Last Realtime Signal" },
+ { 44, "SIGRTMAX-2", "Third Last Realtime Signal" },
+ { 45, "SIGRTMAX-1", "Second Last Realtime Signal" },
+ { 46, "SIGRTMAX", "Last Realtime Signal" },
+#else /* signal here existed in s10 and s11 */
+ { 39, "SIGJVM1","Reserved signal for Java Virtual Machine" },
+ { 40, "SIGJVM1","Reserved signal for Java Virtual Machine" },
+ { 41, "SIGRTMIN","First Realtime Signal" },
+ { 42, "SIGRTMIN+1", "Second Realtime Signal" },
+ { 43, "SIGRTMIN+2", "Third Realtime Signal" },
+ { 44, "SIGRTMIN+3", "Fourth Realtime Signal" },
+ { 45, "SIGRTMAX-3", "Fourth Last Realtime Signal" },
+ { 46, "SIGRTMAX-2", "Third Last Realtime Signal" },
+ { 47, "SIGRTMAX-1", "Second Last Realtime Signal" },
+ { 48, "SIGRTMAX", "Last Realtime Signal" },
+#endif
+#endif
{ 0, NULL, NULL }
};
diff -Nrup libgtop-2.14.3/sysdeps/solaris/sysinfo.c libgtop-2.14.3.mod/sysdeps/solaris/sysinfo.c
--- libgtop-2.14.3/sysdeps/solaris/sysinfo.c 1970-01-01 08:00:00.000000000 +0800
+++ libgtop-2.14.3.mod/sysdeps/solaris/sysinfo.c 2006-09-19 19:14:17.410484000 +0800
@@ -0,0 +1,48 @@
+/* $Id: sysinfo.c,v 1.22 2004/11/28 01:32:55 bdejean Exp $ */
+
+/* Copyright (C) 1998-99 Martin Baulig
+ This file is part of LibGTop 1.0.
+
+ Contributed by Martin Baulig <[email protected]>, April 1998.
+
+ LibGTop is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License,
+ or (at your option) any later version.
+
+ LibGTop is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with LibGTop; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#include <config.h>
+#include <glibtop/error.h>
+#include <glibtop/cpu.h>
+#include <glibtop/sysinfo.h>
+
+#include "glibtop_private.h"
+
+
+static const unsigned long _glibtop_sysdeps_sysinfo =
+(1L << GLIBTOP_SYSINFO_CPUINFO);
+
+static glibtop_sysinfo sysinfo = { .flags = 0 };
+
+static void
+init_sysinfo (glibtop *server)
+{
+
+}
+
+const glibtop_sysinfo *
+glibtop_get_sysinfo_s (glibtop *server)
+{
+ init_sysinfo (server);
+ return &sysinfo;
+}