Compiling libgtop in Garnome on Solaris 8 and 9




I patched glibtop-2.0.1 with the differences from glibtop-1.1.2.1-solaris and got a compiled version of glibtop-2.0.1 for solaris 8 and 9. (tested both on x86). I have no idea if it's a working patch, but I believe that the changes are not
to drastic in nature.

This is a garnome patch to make libgtop compile on Solaris. This will get you a clean compile, but unfortunately, the maintainers of glibtop put a #define in the top level config.h directory, and while this will compile cleanly on Solaris, it immediately breaks gnome-system-monitor
because u_int64_t is not defined.

For the meantime, I patched glibtop.h to have

#ifndef u_int64_t
#define u_int64_t unsigned long long int
#endif

so that gnome-system-monitor could compile.

Testers and comments welcome

Ben
GARNAME = libgtop
GARVERSION = 2.0.1
CATEGORIES = gnome
DISTFILES = $(GARNAME)-$(GARVERSION).tar.bz2
PATCHFILES = solaris.diff

LIBDEPS = gnome/glib

DESCRIPTION = libgtop
define BLURB
 #FIXME: blurb goes here
endef

CONFIGURE_SCRIPTS = $(WORKSRC)/configure
BUILD_SCRIPTS = $(WORKSRC)/Makefile
INSTALL_SCRIPTS = $(WORKSRC)/Makefile

CONFIGURE_ARGS = $(DIRPATHS) --with-libgtop-smp --with-libgtop-inodedb

include ../category.mk
1757801cb39ad7be19b1a472e7fc9060  download/libgtop-2.0.1.tar.bz2
d0eaa01a7fa75d936b80b11c5fb57d4f  files/solaris.diff
diff --speed-large-files --minimal -Nru tmp/libgtop-2.0.1/include/glibtop/cpu.h work/libgtop-2.0.1/include/glibtop/cpu.h
--- tmp/libgtop-2.0.1/include/glibtop/cpu.h	2003-01-12 21:40:00.000000000 -0500
+++ work/libgtop-2.0.1/include/glibtop/cpu.h	2003-02-15 07:14:29.172270000 -0500
@@ -41,8 +41,9 @@
 #define GLIBTOP_XCPU_NICE	8
 #define GLIBTOP_XCPU_SYS	9
 #define GLIBTOP_XCPU_IDLE	10
+#define GLIBTOP_XCPU_FLAGS	11
 
-#define GLIBTOP_MAX_CPU		11
+#define GLIBTOP_MAX_CPU		12
 
 /* Nobody should really be using more than 4 processors. */
 #define GLIBTOP_NCPU		4
@@ -62,7 +63,8 @@
 		xcpu_user [GLIBTOP_NCPU],	/* GLIBTOP_XCPU_USER		*/
 		xcpu_nice [GLIBTOP_NCPU],	/* GLIBTOP_XCPU_NICE		*/
 		xcpu_sys  [GLIBTOP_NCPU],	/* GLIBTOP_XCPU_SYS		*/
-		xcpu_idle [GLIBTOP_NCPU];	/* GLIBTOP_XCPU_IDLE		*/
+		xcpu_idle [GLIBTOP_NCPU],	/* GLIBTOP_XCPU_IDLE		*/
+		xcpu_flags;			/* GLIBTOP_XCPU_FLAGS		*/
 };
 
 #define glibtop_get_cpu(cpu)	glibtop_get_cpu_l(glibtop_global_server, cpu)
diff --speed-large-files --minimal -Nru tmp/libgtop-2.0.1/include/glibtop/procstate.h work/libgtop-2.0.1/include/glibtop/procstate.h
--- tmp/libgtop-2.0.1/include/glibtop/procstate.h	2003-01-12 21:40:00.000000000 -0500
+++ work/libgtop-2.0.1/include/glibtop/procstate.h	2003-02-15 07:18:37.240852000 -0500
@@ -29,12 +29,25 @@
 
 BEGIN_LIBGTOP_DECLS
 
-#define GLIBTOP_PROC_STATE_CMD		0
-#define GLIBTOP_PROC_STATE_STATE	1
-#define GLIBTOP_PROC_STATE_UID		2
-#define GLIBTOP_PROC_STATE_GID		3
+#define GLIBTOP_PROC_STATE_CMD			0
+#define GLIBTOP_PROC_STATE_STATE		1
+#define GLIBTOP_PROC_STATE_UID			2
+#define GLIBTOP_PROC_STATE_GID			3
+#define GLIBTOP_PROC_STATE_RUID			4
+#define GLIBTOP_PROC_STATE_RGID			5
+#define GLIBTOP_PROC_STATE_HAS_CPU		6
+#define GLIBTOP_PROC_STATE_PROCESSOR		7
+#define GLIBTOP_PROC_STATE_LAST_PROCESSOR	8
 
-#define GLIBTOP_MAX_PROC_STATE		4
+#define GLIBTOP_MAX_PROC_STATE			9
+
+/* Constants for the `state' field. */
+#define GLIBTOP_PROCESS_RUNNING			1
+#define GLIBTOP_PROCESS_INTERRUPTIBLE		2
+#define GLIBTOP_PROCESS_UNINTERRUPTIBLE		4
+#define GLIBTOP_PROCESS_ZOMBIE			8
+#define GLIBTOP_PROCESS_STOPPED			16
+#define GLIBTOP_PROCESS_SWAPPING		32
 
 typedef struct _glibtop_proc_state	glibtop_proc_state;
 
@@ -53,7 +66,13 @@
 	 *                   only to set the flags value for those two
 	 *                   fields if their values are corrent ! */
 	int uid,		/* UID of process */
-		gid;		/* GID of process */
+		gid,		/* GID of process */
+		ruid,		/* real UID of process */
+		rgid;		/* real GID of process */
+	/* SMP values. */
+	int has_cpu,
+	    processor,
+	    last_processor;
 };
 
 #define glibtop_get_proc_state(p1, p2)	glibtop_get_proc_state_l(glibtop_global_server, p1, p2)
diff --speed-large-files --minimal -Nru tmp/libgtop-2.0.1/include/glibtop/procuid.h work/libgtop-2.0.1/include/glibtop/procuid.h
--- tmp/libgtop-2.0.1/include/glibtop/procuid.h	2003-01-12 21:40:00.000000000 -0500
+++ work/libgtop-2.0.1/include/glibtop/procuid.h	2003-02-15 07:26:41.549386000 -0500
@@ -29,6 +29,9 @@
 
 BEGIN_LIBGTOP_DECLS
 
+/* Originally in include/glibtop/limits.h */
+#define GLIBTOP_MAX_GROUPS		32
+
 #define GLIBTOP_PROC_UID_UID		0
 #define GLIBTOP_PROC_UID_EUID		1
 #define GLIBTOP_PROC_UID_GID		2
@@ -41,8 +44,12 @@
 #define GLIBTOP_PROC_UID_TPGID		9
 #define GLIBTOP_PROC_UID_PRIORITY	10
 #define GLIBTOP_PROC_UID_NICE		11
+#define GLIBTOP_PROC_UID_GROUPS		12
+#define GLIBTOP_PROC_UID_SUID		13
+#define GLIBTOP_PROC_UID_SGID		14
+#define GLIBTOP_PROC_UID_NGROUPS	15
 
-#define GLIBTOP_MAX_PROC_UID		12
+#define GLIBTOP_MAX_PROC_UID		16
 
 typedef struct _glibtop_proc_uid	glibtop_proc_uid;
 
@@ -55,6 +62,8 @@
 		euid,		/* effective user id */
 		gid,		/* group id */
 		egid,		/* effective group id */
+		suid,		/* saved user id */
+		sgid,		/* saved group id */
 		pid,		/* process id */
 		ppid,		/* pid of parent process */
 		pgrp,		/* process group id */
@@ -62,7 +71,9 @@
 		tty,		/* full device number of controlling terminal */
 		tpgid,		/* terminal process group id */
 		priority,	/* kernel scheduling priority */
-		nice;		/* standard unix nice level of process */
+		nice,		/* standard unix nice level of process */
+		ngroups,	/* number of additional process groups */
+		groups [GLIBTOP_MAX_GROUPS];	/* addtional process groups */
 };
 
 #define glibtop_get_proc_uid(p1, p2)	glibtop_get_proc_uid_l(glibtop_global_server, p1, p2)
diff --speed-large-files --minimal -Nru tmp/libgtop-2.0.1/include/glibtop/uptime.h work/libgtop-2.0.1/include/glibtop/uptime.h
--- tmp/libgtop-2.0.1/include/glibtop/uptime.h	2003-01-12 21:40:00.000000000 -0500
+++ work/libgtop-2.0.1/include/glibtop/uptime.h	2003-02-15 07:10:46.578586000 -0500
@@ -31,8 +31,9 @@
 
 #define GLIBTOP_UPTIME_UPTIME		0
 #define GLIBTOP_UPTIME_IDLETIME		1
+#define GLIBTOP_UPTIME_BOOT_TIME	2
 
-#define GLIBTOP_MAX_UPTIME		2
+#define GLIBTOP_MAX_UPTIME		3
 
 typedef struct _glibtop_uptime	glibtop_uptime;
 
@@ -41,6 +42,7 @@
 	u_int64_t flags;
 	double uptime,		/* GLIBTOP_UPTIME_UPTIME	*/
 		idletime;	/* GLIBTOP_UPTIME_IDLETIME	*/
+	u_int64_t boot_time;	/* GLIBTOP_UPTIME_BOOT_TIME	*/
 };
 
 #define glibtop_get_uptime(uptime)	glibtop_get_uptime_l(glibtop_global_server, uptime)
diff --speed-large-files --minimal -Nru tmp/libgtop-2.0.1/lib/sysdeps.c work/libgtop-2.0.1/lib/sysdeps.c
--- tmp/libgtop-2.0.1/lib/sysdeps.c	2003-01-12 21:40:00.000000000 -0500
+++ work/libgtop-2.0.1/lib/sysdeps.c	2003-02-15 06:40:11.246109000 -0500
@@ -109,6 +109,70 @@
 	NULL
 };
 
+glibtop_init_func_t _glibtop_init_hook_p [] = {
+#if GLIBTOP_SUID_CPU
+	glibtop_init_cpu_p,
+#endif
+#if GLIBTOP_SUID_MEM
+	glibtop_init_mem_p,
+#endif
+#if GLIBTOP_SUID_SWAP
+	glibtop_init_swap_p,
+#endif
+#if GLIBTOP_SUID_UPTIME
+	glibtop_init_uptime_p,
+#endif
+#if GLIBTOP_SUID_LOADAVG
+	glibtop_init_loadavg_p,
+#endif
+#if GLIBTOP_SUID_SHM_LIMITS
+	glibtop_init_shm_limits_p,
+#endif
+#if GLIBTOP_SUID_MSG_LIMITS
+	glibtop_init_msg_limits_p,
+#endif
+#if GLIBTOP_SUID_SEM_LIMITS
+	glibtop_init_sem_limits_p,
+#endif
+#if GLIBTOP_SUID_PROCLIST
+	glibtop_init_proclist_p,
+#endif
+#if GLIBTOP_SUID_PROC_STATE
+	glibtop_init_proc_state_p,
+#endif
+#if GLIBTOP_SUID_PROC_UID
+	glibtop_init_proc_uid_p,
+#endif
+#if GLIBTOP_SUID_PROC_MEM
+	glibtop_init_proc_mem_p,
+#endif
+#if GLIBTOP_SUID_PROC_TIME
+	glibtop_init_proc_time_p,
+#endif
+#if GLIBTOP_SUID_PROC_SIGNAL
+	glibtop_init_proc_signal_p,
+#endif
+#if GLIBTOP_SUID_PROC_KERNEL
+	glibtop_init_proc_kernel_p,
+#endif
+#if GLIBTOP_SUID_PROC_SEGMENT
+	glibtop_init_proc_segment_p,
+#endif
+#if GLIBTOP_SUID_PROC_ARGS
+	glibtop_init_proc_args_p,
+#endif
+#if GLIBTOP_SUID_PROC_MAP
+	glibtop_init_proc_map_p,
+#endif
+#if GLIBTOP_SUID_NETLOAD
+	glibtop_init_netload_p,
+#endif
+#if GLIBTOP_SUID_PPP
+	glibtop_init_ppp_p,
+#endif
+	NULL
+};
+
 /* Checks which features are implemented. */
 
 void
diff --speed-large-files --minimal -Nru tmp/libgtop-2.0.1/sysdeps/solaris/shm_limits.c work/libgtop-2.0.1/sysdeps/solaris/shm_limits.c
--- tmp/libgtop-2.0.1/sysdeps/solaris/shm_limits.c	2003-01-12 21:40:08.000000000 -0500
+++ work/libgtop-2.0.1/sysdeps/solaris/shm_limits.c	2003-02-15 06:42:24.251207000 -0500
@@ -61,8 +61,10 @@
 		    sizeof(struct shminfo)) != sizeof(struct shminfo))
 	        return;
         buf->shmmax = sinfo.shmmax;
-	buf->shmmin = sinfo.shmmin;
 	buf->shmmni = sinfo.shmmni;
+#if  GLIBTOP_SOLARIS_RELEASE < 590
+	buf->shmmin = sinfo.shmmin;
 	buf->shmseg = sinfo.shmseg;
+#endif
 	buf->flags = _glibtop_sysdeps_shm_limits;
 }
diff --speed-large-files --minimal -Nru tmp/libgtop-2.0.1/glibtop.h work/glibtop.h
--- tmp/libgtop-2.0.1/glibtop.h	2003-02-15 08:39:55.748711000 -0500
+++ work/libgtop-2.0.1/glibtop.h	2003-01-12 21:40:00.000000000 -0500
@@ -24,6 +24,10 @@
 #ifndef __GLIBTOP_H__
 #define __GLIBTOP_H__
 
+#ifndef u_int64_t
+#define u_int64_t unsigned long long int
+#endif
+
 #include <glibtop/global.h>
 
 #include <glibtop_server.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]