8402N/A-void glibtop_error_vr (glibtop *server, const char *format, va_list args) G_GNUC_INTERNAL G_GNUC_NORETURN;
8402N/A-void glibtop_warn_vr (glibtop *server, const char *format, va_list args) G_GNUC_INTERNAL;
8402N/A-void glibtop_error_io_vr (glibtop *server, const char *format, int, va_list args) G_GNUC_INTERNAL G_GNUC_NORETURN;
8402N/A-void glibtop_warn_io_vr (glibtop *server, const char *format, int, va_list args) G_GNUC_INTERNAL;
8402N/A-void glibtop_error_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN;
8402N/A-void glibtop_warn_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
8402N/A-void glibtop_error_io_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN;
8402N/A-void glibtop_warn_io_r (glibtop *server, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
8402N/A-void glibtop_error (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN;
8402N/A-void glibtop_warn (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2);
8402N/A-void glibtop_error_io (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN;
8402N/A-void glibtop_warn_io (const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(1, 2);
8402N/A+G_GNUC_INTERNAL void glibtop_error_vr (glibtop *server, const char *format, va_list args) G_GNUC_NORETURN;
8402N/A+G_GNUC_INTERNAL void glibtop_warn_vr (glibtop *server, const char *format, va_list args) ;
8402N/A+G_GNUC_INTERNAL void glibtop_error_io_vr (glibtop *server, const char *format, int, va_list args) G_GNUC_NORETURN;
8402N/A+G_GNUC_INTERNAL void glibtop_warn_io_vr (glibtop *server, const char *format, int, va_list args) ;
8402N/A+G_GNUC_INTERNAL void glibtop_error_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN;
8402N/A+G_GNUC_INTERNAL void glibtop_warn_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3);
8402N/A+G_GNUC_INTERNAL void glibtop_error_io_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3) G_GNUC_NORETURN;
8402N/A+G_GNUC_INTERNAL void glibtop_warn_io_r (glibtop *server, const char *format, ...) G_GNUC_PRINTF(2, 3);
8402N/A+G_GNUC_INTERNAL void glibtop_error (const char *format, ...) G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN;
8402N/A+G_GNUC_INTERNAL void glibtop_warn (const char *format, ...) G_GNUC_PRINTF(1, 2);
8402N/A+G_GNUC_INTERNAL void glibtop_error_io (const char *format, ...) G_GNUC_PRINTF(1, 2) G_GNUC_NORETURN;
8402N/A+G_GNUC_INTERNAL void glibtop_warn_io (const char *format, ...) G_GNUC_PRINTF(1, 2);
9799N/A@@ -66,11 +66,19 @@ struct _glibtop_proc_state
9799N/A * fields if their values are corrent ! */
9799N/A int uid; /* UID of process */
9799N/A int gid; /* GID of process */
9799N/A+ gint32 nice; /*zhua: used to store nice */
9799N/A+ guint64 start_time; /* start time of process -- */
9799N/A+ guint64 vsize; /* number of pages of virtual memory ... */
9799N/A+ guint64 resident; /* number of resident set */
9799N/A+ guint load; /* cpu load for process */
9799N/A+ gint32 ppid; /* pid of parent process */
9799N/A void glibtop_get_proc_state(glibtop_proc_state *buf, pid_t pid);
8402N/A@@ -59,17 +59,17 @@ G_BEGIN_DECLS
8402N/A #define MSG_BUFSZ sizeof (struct _glibtop_ipc_message)
8402N/A #define MSG_MSGSZ (MSG_BUFSZ - sizeof (long))
8402N/A-void handle_parent_connection (int s) G_GNUC_INTERNAL;
8402N/A-void handle_slave_connection (int input, int output) G_GNUC_INTERNAL;
8402N/A-void handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
8402N/A- const void *parameter) G_GNUC_INTERNAL ;
8402N/A-void do_output (int s, glibtop_response *resp, off_t offset,
8402N/A- size_t data_size, const void *data) G_GNUC_INTERNAL;
8402N/A-int do_read (int s, void *ptr, size_t total_size) G_GNUC_INTERNAL;
8402N/A+G_GNUC_INTERNAL void handle_parent_connection (int s) ;
8402N/A+G_GNUC_INTERNAL void handle_slave_connection (int input, int output) ;
8402N/A+G_GNUC_INTERNAL void handle_slave_command (glibtop_command *cmnd, glibtop_response *resp,
8402N/A+G_GNUC_INTERNAL void do_output (int s, glibtop_response *resp, off_t offset,
8402N/A+ size_t data_size, const void *data) ;
8402N/A+G_GNUC_INTERNAL int do_read (int s, void *ptr, size_t total_size) ;
8402N/A-void syslog_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
8402N/A-void syslog_io_message (int priority, const char *format, ...) G_GNUC_INTERNAL G_GNUC_PRINTF(2, 3);
8402N/A+G_GNUC_INTERNAL void syslog_message (int priority, const char *format, ...) G_GNUC_PRINTF(2, 3);
8402N/A+G_GNUC_INTERNAL void syslog_io_message (int priority, const char *format, ...) G_GNUC_PRINTF(2, 3);
9869N/A@@ -149,6 +149,15 @@ _glibtop_freebsd_get_fsusage_read_write(
8922N/A #define _glibtop_get_fsusage_read_write(S, B, P) \
8922N/A _glibtop_freebsd_get_fsusage_read_write(S, B, P)
8922N/A+#elif (defined(sun) || defined(__sun))
8922N/A+_glibtop_sun_get_fsusage_read_write(glibtop *server,
8922N/A+#define _glibtop_get_fsusage_read_write(S, B, P) \
8922N/A+ _glibtop_sun_get_fsusage_read_write(S, B, P)
8922N/A #else /* default fallback */
9869N/A #warning glibtop_get_fsusage .read .write are not implemented.
8922N/A@@ -477,8 +477,10 @@ read_filesystem_list (void)
8922N/A #endif /* MOUNTED_GETMNTENT2. */
9799N/A@@ -586,6 +588,17 @@ glibtop_get_mountlist_s (glibtop *server
9799N/A for (cur = &entries[0]; cur != NULL; cur = next) {
9799N/A+ /*zhua: delete these 2 type of fs: objfs,ctfs */
9799N/A+ if (!strcmp(cur->me_type, "objfs") || !strcmp(cur->me_type,"ctfs")){
9799N/A+ /* free current mount_entry and move to the next */
9799N/A if(all_fs || !ignore_mount_entry(cur)) {
9799N/A /* add a new glibtop_mountentry */
8402N/A libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
8402N/A@@ -36,6 +36,7 @@ static const unsigned long _glibtop_sysd
8402N/A static const unsigned long _glibtop_sysdeps_cpu_all =
8402N/A (1L << GLIBTOP_CPU_TOTAL) + (1L << GLIBTOP_CPU_USER) +
9869N/A+(1L << GLIBTOP_CPU_NICE) + /* this value is needed by multiload */
8402N/A (1L << GLIBTOP_CPU_SYS) + (1L << GLIBTOP_CPU_IDLE) +
8402N/A (1L << GLIBTOP_XCPU_TOTAL) + (1L << GLIBTOP_XCPU_USER) +
8402N/A (1L << GLIBTOP_XCPU_SYS) + (1L << GLIBTOP_XCPU_IDLE) +
8922N/A+_glibtop_sun_get_fsusage_read_write(glibtop *server,
8922N/A+ struct statvfs64 statvfsbuf;
8922N/A+ char ksname[KSTAT_STRLEN + 1];
8922N/A+ kstat_named_t *kread, *kwrite;
8922N/A+ * get a kstat handle and update the user's kstat chain
8922N/A+ glibtop_warn_io_r (server, "kstat_open ()");
8922N/A+ /* make sure we have current data */
8922N/A+ while( kstat_chain_update( kctl ) != 0 )
8922N/A+ for (ksp = kctl->kc_chain, i =0; ksp != NULL; ksp = ksp->ks_next, i++) {
8922N/A+ if (ksp->ks_type == KSTAT_TYPE_IO && strcmp(ksp->ks_class,"disk") == 0) {
8922N/A+ kstat_read(kctl, ksp, &kio);
8922N/A+ /* these codes keep here, because they are a good way to get the
8922N/A+ fsusage information, but at the moment, the interfaces used
8922N/A+ are not public or stable. so let's use them when public...
8922N/A+ * get a kstat handle and update the user's kstat chain
8922N/A+ glibtop_warn_io_r (server, "kstat_open ()");
8922N/A+ while( kstat_chain_update( kctl ) != 0 )
8922N/A+ if (statvfs64(path, &statvfsbuf) != 0) {
8922N/A+ glibtop_warn_io_r (server, "kstat_open ()");
8922N/A+ snprintf(ksname, KSTAT_STRLEN, "%s%lx", VOPSTATS_STR,
8922N/A+ * traverse the kstat chain
8922N/A+ * to find the appropriate statistics
8922N/A+ if( (ksp = kstat_lookup( kctl,
8922N/A+ "unix", 0, ksname )) == NULL ) {
8922N/A+ if( kstat_read( kctl, ksp, NULL ) == -1 ) {
8922N/A+ kread = (kstat_named_t *)kstat_data_lookup(ksp,"read_bytes");
8922N/A+ kwrite = (kstat_named_t *)kstat_data_lookup(ksp,"write_bytes");
8922N/A+ buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
8922N/A@@ -63,14 +63,7 @@ struct _glibtop_machine
8402N/A int pagesize; /* in bits to shift, ie. 2^pagesize gives Kb */
8402N/A int ticks; /* clock ticks, as returned by sysconf() */
8402N/A unsigned long long boot; /* boot time, although it's ui32 in kstat */
8402N/A- void *libproc; /* libproc handle */
8575N/A-#if GLIBTOP_SOLARIS_RELEASE >= 50600
8402N/A- void (*objname)(void *, uintptr_t, const char *, size_t);
8402N/A- struct ps_prochandle *(*pgrab)(pid_t, int, int *);
8922N/A@@ -31,9 +31,15 @@ G_BEGIN_DECLS
8922N/A #define GLIBTOP_SUID_SWAP 0
8922N/A #define GLIBTOP_SUID_UPTIME 0
8922N/A #define GLIBTOP_SUID_LOADAVG 0
8922N/A+#if GLIBTOP_SOLARIS_RELEASE < 51000
8922N/A #define GLIBTOP_SUID_SHM_LIMITS (1L << GLIBTOP_SYSDEPS_SHM_LIMITS)
8922N/A #define GLIBTOP_SUID_MSG_LIMITS (1L << GLIBTOP_SYSDEPS_MSG_LIMITS)
8922N/A #define GLIBTOP_SUID_SEM_LIMITS (1L << GLIBTOP_SYSDEPS_SEM_LIMITS)
8922N/A+#define GLIBTOP_SUID_SHM_LIMITS 0
8922N/A+#define GLIBTOP_SUID_MSG_LIMITS 0
8922N/A+#define GLIBTOP_SUID_SEM_LIMITS 0
8922N/A #define GLIBTOP_SUID_PROCLIST 0
8922N/A #define GLIBTOP_SUID_PROC_STATE 0
8922N/A #define GLIBTOP_SUID_PROC_UID 0
8922N/A@@ -39,14 +39,24 @@ static const unsigned long _glibtop_sysd
8922N/A (1L << GLIBTOP_IPC_MSGMNB) + (1L << GLIBTOP_IPC_MSGMNI) +
8922N/A (1L << GLIBTOP_IPC_MSGTQL);
8922N/A-static const unsigned long _glibtop_sysdeps_msg_limits = 0;
8922N/A+static const unsigned long _glibtop_sysdeps_msg_limits =
8922N/A+(1L << GLIBTOP_IPC_MSGMNB) +
8922N/A+(1L << GLIBTOP_IPC_MSGMNI) +
8922N/A+(1L << GLIBTOP_IPC_MSGMAX) +
8922N/A+(1L << GLIBTOP_IPC_MSGPOOL) +
8922N/A+(1L << GLIBTOP_IPC_MSGTQL);
8922N/A+#if GLIBTOP_SUID_MSG_LIMITS
8922N/A glibtop_init_msg_limits_p (glibtop *server)
8922N/A+glibtop_init_msg_limits_s (glibtop *server)
8922N/A #if GLIBTOP_SOLARIS_RELEASE < 51000
8922N/A@@ -61,8 +71,13 @@ glibtop_init_msg_limits_p (glibtop *serv
8922N/A /* Provides information about sysv ipc limits. */
8922N/A+#if GLIBTOP_SUID_MSG_LIMITS
8922N/A glibtop_get_msg_limits_p (glibtop *server, glibtop_msg_limits *buf)
8922N/A+glibtop_get_msg_limits_s (glibtop *server, glibtop_msg_limits *buf)
8922N/A #if GLIBTOP_SOLARIS_RELEASE < 51000
9311N/A@@ -41,7 +41,13 @@ glibtop_get_netlist_s (glibtop *server,
8922N/A+ /* use the kc installed in server, don't need to create again,
8922N/A+ it will save some time and improve performance */
9311N/A+ /* use flags as a check condition, if it is 1, check, or not check... zhua */
8922N/A glibtop_init_s (&server, GLIBTOP_SYSDEPS_NETLIST, 0);
9869N/A@@ -49,7 +55,6 @@ glibtop_get_netlist_s (glibtop *server,
8922N/A devices = g_ptr_array_new();
8922N/A glibtop_warn_io_r(server, "kstat_open()");
9869N/A@@ -60,12 +65,27 @@ glibtop_get_netlist_s (glibtop *server,
8922N/A if (strcmp(ksp->ks_class, "net") != 0)
8922N/A- g_ptr_array_add(devices, g_strdup(ksp->ks_name));
8922N/A+ /* do some check to see if the first character is the same between
8922N/A+ name and module, if not, we don't return it, because
8922N/A+ glibtop_get_netload() only want the same ones....
8922N/A+ /* if the first character is not same, they should not
8922N/A+ the one we will use in glibtop_get_netload() */
8922N/A+ if (ksp->ks_name[0] != ksp->ks_module[0])
8922N/A+ /* because in glibtop_get_netload(), name
8922N/A+ is at least 1 character longer than module */
8922N/A+ if (strlen( ksp->ks_module ) >= strlen( ksp->ks_name))
8922N/A+ /* if it's not digital, continue directly */
8922N/A+ if( !isdigit( (int) ksp->ks_name[strlen( ksp->ks_module )] ))
8922N/A+ g_ptr_array_add(devices, g_strdup(ksp->ks_name));
8922N/A buf->flags = _glibtop_sysdeps_netlist;
8922N/A g_ptr_array_add(devices, NULL);
8402N/A-static const unsigned long _glibtop_sysdeps_netload = 0;
8402N/A+//#if !defined (_LIBC) && defined (__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
8402N/A+/* needed for IPV6 support */
8402N/A+#define IN6_IS_ADDR_GLOBAL(a) \
8402N/A+ (((((__const uint8_t *) (a))[0] & 0xff) == 0x3f \
8402N/A+ || (((__const uint8_t *) (a))[0] & 0xff) == 0x20))
8402N/A+#endif /* HAVE_IFADDRS_H */
8402N/A+static const unsigned long _glibtop_sysdeps_netload =
8402N/A+(1L << GLIBTOP_NETLOAD_ERRORS_IN) +
8402N/A+(1L << GLIBTOP_NETLOAD_ERRORS_OUT) +
8402N/A+(1L << GLIBTOP_NETLOAD_COLLISIONS);
8402N/A+static const unsigned long _glibtop_sysdeps_netload_data =
8402N/A+(1L << GLIBTOP_NETLOAD_ADDRESS) +
8402N/A+(1L << GLIBTOP_NETLOAD_SUBNET) +
8402N/A+(1L << GLIBTOP_NETLOAD_MTU);
8402N/A+static const unsigned long _glibtop_sysdeps_netload_bytes =
8402N/A+(1L << GLIBTOP_NETLOAD_BYTES_IN) +
8402N/A+(1L << GLIBTOP_NETLOAD_BYTES_OUT) +
8402N/A+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL);
8402N/A+static const unsigned long _glibtop_sysdeps_netload_packets =
8402N/A+(1L << GLIBTOP_NETLOAD_PACKETS_IN) +
8402N/A+(1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
8402N/A+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL);
8402N/A+static const unsigned long _glibtop_sysdeps_netload_total =
8402N/A+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
8402N/A+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL);
8402N/A+static const unsigned long _glibtop_sysdeps_netload_in =
8402N/A+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
8402N/A+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) +
8402N/A+(1L << GLIBTOP_NETLOAD_PACKETS_IN) +
8402N/A+(1L << GLIBTOP_NETLOAD_BYTES_IN);
8402N/A+static const unsigned long _glibtop_sysdeps_netload_out =
8402N/A+(1L << GLIBTOP_NETLOAD_PACKETS_TOTAL) +
8402N/A+(1L << GLIBTOP_NETLOAD_BYTES_TOTAL) +
8402N/A+(1L << GLIBTOP_NETLOAD_PACKETS_OUT) +
8402N/A+(1L << GLIBTOP_NETLOAD_BYTES_OUT);
8402N/A+static const unsigned long _glibtop_sysdeps_netload_6 =
8402N/A+(1L << GLIBTOP_NETLOAD_ADDRESS6) +
8402N/A+(1L << GLIBTOP_NETLOAD_PREFIX6) +
8402N/A+(1L << GLIBTOP_NETLOAD_SCOPE6);
8402N/A glibtop_init_netload_s (glibtop *server)
8402N/A+ _glibtop_sysdeps_netload_bytes |
8402N/A+ _glibtop_sysdeps_netload_packets;
8402N/A+static void get_ipv6(glibtop *server, glibtop_netload *buf,
8922N/A+ * remove this code, because they are not available at Solaris, but keep them here for reference.
8922N/A+ * in fact, the function will not be called at Solaris, because HAVE_IFADDRS_H don't def.
8402N/A+ struct ifaddrs *ifa0, *ifr6;
8402N/A+ if(getifaddrs (&ifa0) != 0)
8402N/A+ glibtop_warn_r(server, "getifaddrs failed : %s", g_strerror(errno));
8402N/A+ for (ifr6 = ifa0; ifr6; ifr6 = ifr6->ifa_next) {
8402N/A+ if (strcmp (ifr6->ifa_name, interface) == 0
8402N/A+ && ifr6->ifa_addr->sa_family == AF_INET6)
8402N/A+ &((struct sockaddr_in6 *) ifr6->ifa_addr)->sin6_addr,
8402N/A+ &((struct sockaddr_in6 *) ifr6->ifa_netmask)->sin6_addr,
8402N/A+ if (IN6_IS_ADDR_LINKLOCAL (buf->address6))
8402N/A+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_LINK;
8402N/A+ else if (IN6_IS_ADDR_SITELOCAL (buf->address6))
8402N/A+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_SITE;
8402N/A+ else if (IN6_IS_ADDR_GLOBAL (buf->address6)
8402N/A+ || IN6_IS_ADDR_MC_ORGLOCAL (buf->address6)
8402N/A+ || IN6_IS_ADDR_V4COMPAT (buf->address6)
8402N/A+ || IN6_IS_ADDR_MULTICAST (buf->address6)
8402N/A+ || IN6_IS_ADDR_UNSPECIFIED (buf->address6)
8402N/A+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_GLOBAL;
8402N/A+ else if (IN6_IS_ADDR_LOOPBACK (buf->address6))
8402N/A+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_HOST;
8402N/A+ buf->scope6 = GLIBTOP_IF_IN6_SCOPE_UNKNOWN;
8402N/A+ buf->flags |= _glibtop_sysdeps_netload_6;
8402N/A+#endif /* HAVE_IFADDRS_H */
8402N/A+solaris_stats(glibtop *server,
8402N/A+ * chop off the trailing interface and
8402N/A+ ptr = module + strlen( module ) - 1;
8402N/A+ while( (ptr > module) && isdigit( (int) *ptr ) ) {
8402N/A+ * get a kstat handle and update the user's kstat chain
8402N/A+ glibtop_warn_io_r (server, "kstat_open ()");
8402N/A+ while( kstat_chain_update( kctl ) != 0 )
8402N/A+ * traverse the kstat chain
8402N/A+ * to find the appropriate statistics
8402N/A+ if( (ksp = kstat_lookup( kctl,
8402N/A+ module, 0, name )) == NULL ) {
8402N/A+ if( kstat_read( kctl, ksp, NULL ) == -1 ) {
8402N/A+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "ipackets" );
8402N/A+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "opackets" );
8402N/A+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "rbytes" );
8402N/A+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "obytes" );
8402N/A+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "ierrors" );
8402N/A+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "oerrors" );
8402N/A+ kdata = (kstat_named_t *) kstat_data_lookup( ksp, "collisions" );
8402N/A+ /* Compute total valules. */
8402N/A+ buf->bytes_total = buf->bytes_in + buf->bytes_out;
8402N/A+ buf->packets_total = buf->packets_in + buf->packets_out;
8402N/A+ buf->errors_total = buf->errors_in + buf->errors_out;
8402N/A+ buf->flags |= _glibtop_sysdeps_netload;
8402N/A+ buf->flags |= _glibtop_sysdeps_netload_bytes;
8402N/A+ buf->flags |= _glibtop_sysdeps_netload_packets;
8402N/A /* Provides network statistics. */
8402N/A glibtop_get_netload_s (glibtop *server, glibtop_netload *buf,
8402N/A- memset (buf, 0, sizeof (glibtop_netload));
8402N/A+ memset (buf, 0, sizeof (glibtop_netload));
8402N/A+ skfd = socket (PF_INET, SOCK_DGRAM, 0);
8402N/A+ if (ioctl (skfd, SIOCGIFFLAGS, &ifr) >= 0) {
8402N/A+ buf->flags |= (1L << GLIBTOP_NETLOAD_IF_FLAGS);
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_UP);
8402N/A+ if (flags & IFF_BROADCAST)
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_BROADCAST);
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_DEBUG);
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK);
8402N/A+ if (flags & IFF_POINTOPOINT)
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT);
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING);
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP);
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC);
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI);
8402N/A+ if (flags & IFF_MULTICAST)
8402N/A+ buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_MULTICAST);
8402N/A+ if (!ioctl (skfd, SIOCGIFADDR, &ifr)) {
8402N/A+ buf->flags |= (1L << GLIBTOP_NETLOAD_ADDRESS);
8402N/A+ if (!ioctl (skfd, SIOCGIFNETMASK, &ifr)) {
8402N/A+ buf->flags |= (1L << GLIBTOP_NETLOAD_SUBNET);
8402N/A+ solaris_stats(server, buf, interface);
8402N/A+ get_ipv6(server, buf, interface);
8402N/A+#endif /* HAVE_IFADDRS_H */
8922N/A@@ -211,34 +211,5 @@ glibtop_open_s (glibtop *server, const c
8922N/A- /* Now let's have a bit of magic dust... */
8922N/A-#if GLIBTOP_SOLARIS_RELEASE >= 50600
8922N/A- func = dlsym(dl, "Pobjname"); /* Solaris 8 */
8922N/A- func = dlsym(dl, "proc_objname"); /* Solaris 7 */
8922N/A- (void *, uintptr_t, const char *, size_t))func;
9869N/A@@ -56,9 +56,14 @@ glibtop_map_entry *
8402N/A glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
8402N/A int fd, i, nmaps, pr_err, heap;
9311N/A+ /* use flags as a check condition, if it is 1, check, or, not check... zhua */
8575N/A #if GLIBTOP_SOLARIS_RELEASE >= 50600
9869N/A- struct ps_prochandle *Pr = NULL;
9869N/A@@ -125,15 +130,35 @@ glibtop_get_proc_map_s (glibtop *server,
8402N/A buf->total = nmaps * sizeof(glibtop_map_entry);
8402N/A entry = g_malloc0(buf->total);
8575N/A-#if GLIBTOP_SOLARIS_RELEASE >= 50600
8402N/A for(heap = 0,i = 0; i < nmaps; ++i)
9311N/A+ /* take a check to see if we need all information, if not, just get what we need..
9311N/A+ Also please see comments in get_process_memory_writable() of gnome-system-monitor zhua */
9311N/A+ if(maps[i].pr_mflags & MA_WRITE){
9311N/A+ entry[i].perm |= GLIBTOP_MAP_PERM_WRITE;
9311N/A+ entry[i].size = maps[i].pr_size;
9869N/A+ if(maps[i].pr_mflags & MA_SHARED){
9311N/A+ entry[i].perm |= GLIBTOP_MAP_PERM_SHARED;
9311N/A+ /* here use shared_clean to store Shared Memory */
9311N/A+ entry[i].shared_clean = maps[i].pr_size;
9869N/A+ if(maps[i].pr_mflags & MA_SHARED){
9869N/A+ entry[i].perm |= GLIBTOP_MAP_PERM_SHARED;
9869N/A+ /* here use shared_clean to store Shared Memory */
9869N/A+ entry[i].shared_clean = maps[i].pr_size;
8402N/A entry[i].start = maps[i].pr_vaddr;
8402N/A entry[i].end = maps[i].pr_vaddr + maps[i].pr_size;
9869N/A@@ -156,8 +181,12 @@ glibtop_get_proc_map_s (glibtop *server,
8922N/A if(maps[i].pr_mflags & MA_EXEC)
8402N/A entry[i].perm |= GLIBTOP_MAP_PERM_EXECUTE;
8922N/A- if(maps[i].pr_mflags & MA_SHARED)
8922N/A- entry[i].perm |= GLIBTOP_MAP_PERM_SHARED;
8922N/A+ if(maps[i].pr_mflags & MA_SHARED){
8922N/A+ entry[i].perm |= GLIBTOP_MAP_PERM_SHARED;
8922N/A+ /* here use shared_clean to store Shared Memory */
8922N/A+ entry[i].shared_clean = maps[i].pr_size;
8402N/A entry[i].perm |= GLIBTOP_MAP_PERM_PRIVATE;
8402N/A entry[i].flags = _glibtop_sysdeps_map_entry;
9869N/A@@ -179,25 +208,25 @@ glibtop_get_proc_map_s (glibtop *server,
8402N/A entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME);
8402N/A- if((len = resolvepath(buffer, entry[i].filename,
8402N/A- GLIBTOP_MAP_FILENAME_LEN)) > 0)
8402N/A- entry[i].filename[len] = 0;
8402N/A- entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME);
8922N/A+ strcpy(buffer, maps[i].pr_mapname);
8922N/A+ /* from /path get file name */
8922N/A+ g_snprintf(filename, sizeof filename, "/proc/%
d/path/%s",
8922N/A+ rv = readlink(filename, entry[i].filename, sizeof(entry[i].filename) - 1);
8922N/A+ /* read object, if have not, set it as NULL */
8922N/A+ entry[i].filename[rv] = '\0';
8922N/A+ entry[i].flags |= (1L << GLIBTOP_MAP_ENTRY_FILENAME);
8575N/A-#if GLIBTOP_SOLARIS_RELEASE >= 50600
8402N/A buf->flags = _glibtop_sysdeps_proc_map;
9869N/A static const unsigned long _glibtop_sysdeps_proc_mem =
9869N/A (1L << GLIBTOP_PROC_MEM_SIZE) + (1L << GLIBTOP_PROC_MEM_VSIZE) +
9869N/A-(1L << GLIBTOP_PROC_MEM_RESIDENT) + (1L << GLIBTOP_PROC_MEM_RSS);
9869N/A+(1L << GLIBTOP_PROC_MEM_RESIDENT) + (1L << GLIBTOP_PROC_MEM_RSS) +
9869N/A+(1L << GLIBTOP_PROC_MEM_SHARE);
9869N/A@@ -63,5 +65,32 @@ glibtop_get_proc_mem_s (glibtop *server,
9311N/A+ /* we have to optimize the performance of libgtop, because update the information will occupy too much cpu.
9311N/A+ only return the ones this function need: memwritable
9311N/A+ we do the check in glibtop_get_proc_map_s(), don't run the others part which don't need by this function,
9311N/A+ I think this will accelerate the transaction lots,
9311N/A+ glibtop_get_proc_map() will return all as before. zhua
8922N/A+ maps = glibtop_get_proc_map_s(server, &mapbuf, pid);
8922N/A+ if (maps[i].perm & GLIBTOP_MAP_PERM_SHARED)
8922N/A+ buf->share += maps[i].shared_clean;
8402N/A buf->flags = _glibtop_sysdeps_proc_mem;
9799N/A@@ -65,6 +65,28 @@ glibtop_get_proc_state_s (glibtop *serve
8922N/A glibtop_get_proc_time_s (glibtop *server, glibtop_proc_time *buf,
8922N/A memset (buf, 0, sizeof (glibtop_proc_time));
9799N/A@@ -54,19 +58,21 @@ glibtop_get_proc_time_s (glibtop *server
9799N/A+ /* zhua remove this function call, because we can change to get start_time in
9799N/A+ glibtop_get_proc_state(), it don't need open psinfo again here
8922N/A+ if (glibtop_get_proc_data_psinfo_s(server, &pinfo, pid))
8922N/A if (glibtop_get_proc_data_usage_s (server, &prusage, pid))
8922N/A- g_get_current_time (&time);
8922N/A+ buf->rtime = (buf->utime + buf->stime) / 10000;
8922N/A buf->flags = _glibtop_sysdeps_proc_time;
8922N/A@@ -41,14 +41,22 @@ static const unsigned long _glibtop_sysd
8922N/A (1L << GLIBTOP_IPC_SEMUSZ) + (1L << GLIBTOP_IPC_SEMVMX) +
8922N/A (1L << GLIBTOP_IPC_SEMAEM);
8922N/A-static const unsigned long _glibtop_sysdeps_sem_limits = 0;
8922N/A+static const unsigned long _glibtop_sysdeps_sem_limits =
8922N/A+(1L << GLIBTOP_IPC_SEMMNI) +
8922N/A+(1L << GLIBTOP_IPC_SEMMSL) +
8922N/A+(1L << GLIBTOP_IPC_SEMOPM);
8922N/A+#if GLIBTOP_SUID_SEM_LIMITS
8922N/A glibtop_init_sem_limits_p (glibtop *server)
8922N/A+glibtop_init_sem_limits_s (glibtop *server)
8922N/A #if GLIBTOP_SOLARIS_RELEASE < 51000
8922N/A@@ -63,8 +71,13 @@ glibtop_init_sem_limits_p (glibtop *serv
8922N/A /* Provides information about sysv sem limits. */
8922N/A+#if GLIBTOP_SUID_SEM_LIMITS
8922N/A glibtop_get_sem_limits_p (glibtop *server, glibtop_sem_limits *buf)
8922N/A+glibtop_get_sem_limits_s (glibtop *server, glibtop_sem_limits *buf)
8922N/A #if GLIBTOP_SOLARIS_RELEASE < 51000
8922N/A static const struct nlist nlst[] = { {"glibtop_shm_limits"}, {NULL} };
8922N/A #if GLIBTOP_SOLARIS_RELEASE >=51000
8922N/A-static const unsigned long _glibtop_sysdeps_shm_limits = 0;
8922N/A+static const unsigned long _glibtop_sysdeps_shm_limits =
8922N/A+(1L << GLIBTOP_IPC_SHMMAX) +
8922N/A+(1L << GLIBTOP_IPC_SHMMIN);
8922N/A # if GLIBTOP_SOLARIS_RELEASE < 50900
8922N/A static const unsigned long _glibtop_sysdeps_shm_limits =
8922N/A@@ -47,8 +49,13 @@ static const unsigned long _glibtop_sysd
8922N/A+#if GLIBTOP_SUID_SHM_LIMITS
8922N/A glibtop_init_shm_limits_p (glibtop *server)
8922N/A+glibtop_init_shm_limits_s (glibtop *server)
8922N/A #if GLIBTOP_SOLARIS_RELEASE < 51000
8922N/A@@ -63,8 +70,13 @@ glibtop_init_shm_limits_p (glibtop *serv
8922N/A /* Provides information about sysv ipc limits. */
8922N/A+#if GLIBTOP_SUID_SHM_LIMITS
8922N/A glibtop_get_shm_limits_p (glibtop *server, glibtop_shm_limits *buf)
8922N/A+glibtop_get_shm_limits_s (glibtop *server, glibtop_shm_limits *buf)
8922N/A #if GLIBTOP_SOLARIS_RELEASE < 51000
8922N/A@@ -63,6 +63,7 @@ const glibtop_signame glibtop_sys_siglis
8402N/A { 35, "SIGTHAW", "Checkpoint Thaw" },
8402N/A { 36, "SIGCANCEL","Thread Cancelation" },
8402N/A { 37, "SIGLOST", "Resource Lost" },
8402N/A+#if GLIBTOP_SOLARIS_RELEASE < 50900 /* S8 */
8402N/A { 38, "SIGRTMIN","First Realtime Signal" },
8402N/A { 39, "SIGRTMIN+1", "Second Realtime Signal" },
8402N/A { 40, "SIGRTMIN+2", "Third Realtime Signal" },
8922N/A@@ -71,5 +72,30 @@ const glibtop_signame glibtop_sys_siglis
8402N/A { 43, "SIGRTMAX-2", "Third Last Realtime Signal" },
8402N/A { 44, "SIGRTMAX-1", "Second Last Realtime Signal" },
8402N/A { 45, "SIGRTMAX", "Last Realtime Signal" },
8402N/A+#if GLIBTOP_SOLARIS_RELEASE >= 50900
8402N/A+ { 38, "SIGXRES","Resource Control Exceeded" },
8402N/A+#if GLIBTOP_SOLARIS_RELEASE <51000 /* signal here existed in s9 */
8402N/A+ { 39, "SIGRTMIN","First Realtime Signal" },
8402N/A+ { 40, "SIGRTMIN+1", "Second Realtime Signal" },
8402N/A+ { 41, "SIGRTMIN+2", "Third Realtime Signal" },
8402N/A+ { 42, "SIGRTMIN+3", "Fourth Realtime Signal" },
8402N/A+ { 43, "SIGRTMAX-3", "Fourth Last Realtime Signal" },
8402N/A+ { 44, "SIGRTMAX-2", "Third Last Realtime Signal" },
8402N/A+ { 45, "SIGRTMAX-1", "Second Last Realtime Signal" },
8402N/A+ { 46, "SIGRTMAX", "Last Realtime Signal" },
8402N/A+#else /* signal here existed in s10 and s11 */
8402N/A+ { 39, "SIGJVM1","Reserved signal for Java Virtual Machine" },
8402N/A+ { 40, "SIGJVM1","Reserved signal for Java Virtual Machine" },
8402N/A+ { 41, "SIGRTMIN","First Realtime Signal" },
8402N/A+ { 42, "SIGRTMIN+1", "Second Realtime Signal" },
8402N/A+ { 43, "SIGRTMIN+2", "Third Realtime Signal" },
8402N/A+ { 44, "SIGRTMIN+3", "Fourth Realtime Signal" },
8402N/A+ { 45, "SIGRTMAX-3", "Fourth Last Realtime Signal" },
8402N/A+ { 46, "SIGRTMAX-2", "Third Last Realtime Signal" },
8402N/A+ { 47, "SIGRTMAX-1", "Second Last Realtime Signal" },
8402N/A+ { 48, "SIGRTMAX", "Last Realtime Signal" },
8402N/A+/* Copyright (C) 1998-99 Martin Baulig
8402N/A+ This file is part of LibGTop 1.0.
8402N/A+ Contributed by Martin Baulig <martin@home-of-linux.org>, April 1998.
8402N/A+ LibGTop is free software; you can redistribute it
and/or modify it
8402N/A+ under the terms of the GNU General Public License as published by
8402N/A+ the Free Software Foundation; either version 2 of the License,
8402N/A+ or (at your option) any later version.
8402N/A+ LibGTop is distributed in the hope that it will be useful, but WITHOUT
8402N/A+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8402N/A+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
8402N/A+ You should have received a copy of the GNU General Public License
8402N/A+ along with LibGTop; see the file COPYING. If not, write to the
8402N/A+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
8402N/A+ Boston, MA 02111-1307, USA.
8402N/A+static const unsigned long _glibtop_sysdeps_sysinfo =
8402N/A+(1L << GLIBTOP_SYSINFO_CPUINFO);
8402N/A+static glibtop_sysinfo sysinfo = { .flags = 0 };
8402N/A+init_sysinfo (glibtop *server)
8402N/A+glibtop_get_sysinfo_s (glibtop *server)