diff options
Diffstat (limited to 'devel/libgtop2/files')
-rw-r--r-- | devel/libgtop2/files/extra-45-patch-sysdeps_freebsd_Makefile.in | 33 | ||||
-rw-r--r-- | devel/libgtop2/files/extra-67-patch-sysdeps_freebsd_Makefile.in | 50 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-configure | 52 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-lib::read.c | 12 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-lib::write.c | 15 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-src::daemon::io.c | 14 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-sysdeps_freebsd_fsusage.c | 37 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-sysdeps_freebsd_glibtop_server.h | 12 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-sysdeps_freebsd_siglist.c | 41 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-sysdeps_freebsd_sysinfo.c | 95 | ||||
-rw-r--r-- | devel/libgtop2/files/patch-systeps::freebsd::procmap.c | 152 |
11 files changed, 274 insertions, 239 deletions
diff --git a/devel/libgtop2/files/extra-45-patch-sysdeps_freebsd_Makefile.in b/devel/libgtop2/files/extra-45-patch-sysdeps_freebsd_Makefile.in deleted file mode 100644 index dea0aec8224c..000000000000 --- a/devel/libgtop2/files/extra-45-patch-sysdeps_freebsd_Makefile.in +++ /dev/null @@ -1,33 +0,0 @@ ---- sysdeps/freebsd/Makefile.in.orig Mon Aug 8 15:10:50 2005 -+++ sysdeps/freebsd/Makefile.in Mon Aug 8 15:15:54 2005 -@@ -143,12 +143,11 @@ - - noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la - --libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c -+libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c netlist.c - - libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO) - --libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c uptime.c loadavg.c shm_limits.c msg_limits.c sem_limits.c proclist.c procstate.c procuid.c proctime.c procmem.c procsignal.c prockernel.c procsegment.c procargs.c procmap.c netlist.c netload.c ppp.c procopenfiles.c fsusage.c -- -+libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c uptime.c loadavg.c shm_limits.c msg_limits.c sem_limits.c proclist.c procstate.c procuid.c proctime.c procmem.c procsignal.c prockernel.c procsegment.c procargs.c procmap.c netload.c ppp.c procopenfiles.c fsusage.c sysinfo.c - - libgtop_sysdeps_suid_2_0_la_LDFLAGS = $(LT_VERSION_INFO) - -@@ -171,13 +170,13 @@ - X_EXTRA_LIBS = @X_EXTRA_LIBS@ - X_PRE_LIBS = @X_PRE_LIBS@ - libgtop_sysdeps_2_0_la_LIBADD = --libgtop_sysdeps_2_0_la_OBJECTS = nosuid.lo siglist.lo -+libgtop_sysdeps_2_0_la_OBJECTS = nosuid.lo siglist.lo netlist.lo - libgtop_sysdeps_suid_2_0_la_LIBADD = - libgtop_sysdeps_suid_2_0_la_OBJECTS = open.lo close.lo cpu.lo mem.lo \ - swap.lo uptime.lo loadavg.lo shm_limits.lo msg_limits.lo sem_limits.lo \ - proclist.lo procstate.lo procuid.lo proctime.lo procmem.lo \ - procsignal.lo prockernel.lo procsegment.lo procargs.lo procmap.lo \ --netlist.lo netload.lo ppp.lo procopenfiles.lo fsusage.lo -+netload.lo ppp.lo procopenfiles.lo fsusage.lo sysinfo.lo - CFLAGS = @CFLAGS@ - COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) - LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) diff --git a/devel/libgtop2/files/extra-67-patch-sysdeps_freebsd_Makefile.in b/devel/libgtop2/files/extra-67-patch-sysdeps_freebsd_Makefile.in index 8168ecb6ddd0..1258d576f76d 100644 --- a/devel/libgtop2/files/extra-67-patch-sysdeps_freebsd_Makefile.in +++ b/devel/libgtop2/files/extra-67-patch-sysdeps_freebsd_Makefile.in @@ -1,34 +1,20 @@ ---- sysdeps/freebsd/Makefile.in.orig Mon Aug 8 20:25:56 2005 -+++ sysdeps/freebsd/Makefile.in Mon Aug 8 20:28:06 2005 -@@ -143,12 +143,11 @@ - +--- sysdeps/freebsd/Makefile.in.orig Mon Apr 10 14:08:39 2006 ++++ sysdeps/freebsd/Makefile.in Mon Apr 10 14:11:50 2006 +@@ -50,7 +50,7 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/m + CONFIG_HEADER = $(top_builddir)/config.h + CONFIG_CLEAN_FILES = + LTLIBRARIES = $(noinst_LTLIBRARIES) +-libgtop_sysdeps_2_0_la_LIBADD = ++libgtop_sysdeps_2_0_la_LIBADD = -lgeom -ldevstat + am_libgtop_sysdeps_2_0_la_OBJECTS = nosuid.lo siglist.lo sysinfo.lo + libgtop_sysdeps_2_0_la_OBJECTS = $(am_libgtop_sysdeps_2_0_la_OBJECTS) + am__DEPENDENCIES_1 = +@@ -260,7 +260,7 @@ target_vendor = @target_vendor@ noinst_LTLIBRARIES = libgtop_sysdeps-2.0.la libgtop_sysdeps_suid-2.0.la - --libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c -+libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c netlist.c - + libgtop_sysdeps_2_0_la_SOURCES = nosuid.c siglist.c sysinfo.c libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO) - --libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c uptime.c loadavg.c shm_limits.c msg_limits.c sem_limits.c proclist.c procstate.c procuid.c proctime.c procmem.c procsignal.c prockernel.c procsegment.c procargs.c procmap.c netlist.c netload.c ppp.c procopenfiles.c fsusage.c -- -+libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c uptime.c loadavg.c shm_limits.c msg_limits.c sem_limits.c proclist.c procstate.c procuid.c proctime.c procmem.c procsignal.c prockernel.c procsegment.c procargs.c procmap.c netload.c ppp.c procopenfiles.c fsusage.c sysinfo.c - - libgtop_sysdeps_suid_2_0_la_LDFLAGS = $(LT_VERSION_INFO) - -@@ -171,13 +170,13 @@ - X_EXTRA_LIBS = @X_EXTRA_LIBS@ - X_PRE_LIBS = @X_PRE_LIBS@ - libgtop_sysdeps_2_0_la_LIBADD = --libgtop_sysdeps_2_0_la_OBJECTS = nosuid.lo siglist.lo --libgtop_sysdeps_suid_2_0_la_LIBADD = -+libgtop_sysdeps_2_0_la_OBJECTS = nosuid.lo siglist.lo netlist.lo -+libgtop_sysdeps_suid_2_0_la_LIBADD = -lgeom -ldevstat - libgtop_sysdeps_suid_2_0_la_OBJECTS = open.lo close.lo cpu.lo mem.lo \ - swap.lo uptime.lo loadavg.lo shm_limits.lo msg_limits.lo sem_limits.lo \ - proclist.lo procstate.lo procuid.lo proctime.lo procmem.lo \ - procsignal.lo prockernel.lo procsegment.lo procargs.lo procmap.lo \ --netlist.lo netload.lo ppp.lo procopenfiles.lo fsusage.lo -+netload.lo ppp.lo procopenfiles.lo fsusage.lo sysinfo.lo - CFLAGS = @CFLAGS@ - COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) - LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +-libgtop_sysdeps_suid_2_0_la_LIBADD = $(KVM_LIBS) ++libgtop_sysdeps_suid_2_0_la_LIBADD = $(KVM_LIBS) -lgeom -ldevstat + libgtop_sysdeps_suid_2_0_la_SOURCES = open.c close.c cpu.c mem.c swap.c \ + uptime.c loadavg.c shm_limits.c msg_limits.c \ + sem_limits.c proclist.c procstate.c procuid.c \ diff --git a/devel/libgtop2/files/patch-configure b/devel/libgtop2/files/patch-configure index e40ac7b08c2c..934f89e79fdc 100644 --- a/devel/libgtop2/files/patch-configure +++ b/devel/libgtop2/files/patch-configure @@ -1,33 +1,19 @@ ---- configure.orig Wed Jul 13 19:29:53 2005 -+++ configure Wed Jul 13 19:36:36 2005 -@@ -1931,9 +1931,9 @@ - - # libtool versioning - LT_RELEASE=$LIBGTOP_MAJOR_VERSION.$LIBGTOP_MINOR_VERSION --LT_CURRENT=$LIBGTOP_CURRENT --LT_REVISION=$LIBGTOP_REVISION --LT_AGE=$LIBGTOP_AGE -+LT_CURRENT=2 -+LT_REVISION=0 -+LT_AGE=0 - LT_VERSION_INFO="-version-info ${LT_CURRENT}:${LT_REVISION}:${LT_AGE}" - - -@@ -23654,6 +23654,8 @@ - fi - - done -+;; -+esac - - - -@@ -23792,8 +23794,6 @@ - - fi - -- ;; --esac - - - echo "$as_me:$LINENO: checking for vm_statistics in -lmach" >&5 +--- configure.orig Mon Apr 10 15:28:24 2006 ++++ configure Mon Apr 10 15:30:40 2006 +@@ -20568,6 +20568,7 @@ else + for def in nothing KERNEL _KERNEL; do + cat >conftest.$ac_ext <<_ACEOF + #define $def ++#include <sys/types.h> + #include <sys/ipc.h> + #include <sys/msg.h> + #include <stdio.h> +@@ -23458,7 +23459,7 @@ fi + + + case "$host_os" in +- solaris*) ++ solaris*|freebsd*) + + echo "$as_me:$LINENO: checking for kstat_open in -lkstat" >&5 + echo $ECHO_N "checking for kstat_open in -lkstat... $ECHO_C" >&6 diff --git a/devel/libgtop2/files/patch-lib::read.c b/devel/libgtop2/files/patch-lib::read.c index b4ca4953413b..18c837d377c2 100644 --- a/devel/libgtop2/files/patch-lib::read.c +++ b/devel/libgtop2/files/patch-lib::read.c @@ -1,5 +1,5 @@ ---- lib/read.c.orig Mon Apr 11 03:25:32 2005 -+++ lib/read.c Mon Apr 11 03:27:06 2005 +--- lib/read.c.orig Mon Apr 10 04:41:46 2006 ++++ lib/read.c Mon Apr 10 15:12:31 2006 @@ -22,6 +22,7 @@ */ @@ -7,9 +7,9 @@ +#include <errno.h> #include <glibtop/read.h> #include <glibtop/error.h> - #include "libgtop-i18n.h" -@@ -56,14 +57,18 @@ - fprintf (stderr, "LIBRARY: really reading %d bytes.\n", size); + #include <glib/gi18n-lib.h> +@@ -56,14 +57,18 @@ glibtop_read_l (glibtop *server, size_t + fprintf (stderr, "LIBRARY: really reading %d bytes.\n", (int)size); #endif +retry: @@ -24,7 +24,7 @@ server, ngettext ("read %d byte", "read %d bytes", size), - size); + (int)size); + } } } diff --git a/devel/libgtop2/files/patch-lib::write.c b/devel/libgtop2/files/patch-lib::write.c index 0d00f7a5f243..acb63c489cc1 100644 --- a/devel/libgtop2/files/patch-lib::write.c +++ b/devel/libgtop2/files/patch-lib::write.c @@ -1,5 +1,5 @@ ---- lib/write.c.orig Mon Apr 11 03:28:12 2005 -+++ lib/write.c Mon Apr 11 03:29:00 2005 +--- lib/write.c.orig Mon Apr 10 04:41:46 2006 ++++ lib/write.c Mon Apr 10 15:37:00 2006 @@ -22,7 +22,7 @@ */ @@ -8,9 +8,9 @@ +#include <errno.h> #include <glibtop/write.h> #include <glibtop/error.h> - #include "libgtop-i18n.h" -@@ -42,12 +42,16 @@ - fprintf (stderr, "LIBRARY: really writing %d bytes.\n", size); + #include <glib/gi18n-lib.h> +@@ -42,15 +42,19 @@ glibtop_write_l (glibtop *server, size_t + fprintf (stderr, "LIBRARY: really writing %d bytes.\n", (int)size); #endif +retry: @@ -24,6 +24,9 @@ + if (ret < 0) { + if (errno == EINTR) + goto retry; - glibtop_error_io_r (server, ngettext ("wrote %d byte", "wrote %d bytes", size), size); + glibtop_error_io_r (server, + ngettext("wrote %d byte", + "wrote %d bytes", size), + (int) size); + } } diff --git a/devel/libgtop2/files/patch-src::daemon::io.c b/devel/libgtop2/files/patch-src::daemon::io.c index a2d23482266c..f8fb71b0378b 100644 --- a/devel/libgtop2/files/patch-src::daemon::io.c +++ b/devel/libgtop2/files/patch-src::daemon::io.c @@ -1,14 +1,14 @@ ---- src/daemon/io.c.orig Mon Apr 11 03:30:12 2005 -+++ src/daemon/io.c Mon Apr 11 03:33:22 2005 +--- src/daemon/io.c.orig Mon Dec 12 05:09:38 2005 ++++ src/daemon/io.c Wed Dec 14 18:58:01 2005 @@ -21,6 +21,7 @@ Boston, MA 02111-1307, USA. */ +#include <errno.h> + #include <config.h> #include "daemon.h" #include <glibtop/error.h> - -@@ -36,9 +37,13 @@ +@@ -37,9 +38,13 @@ do_output (int s, glibtop_response *resp resp->offset = offset; resp->data_size = data_size; @@ -23,7 +23,7 @@ } else { if (send (s, (const void *) resp, sizeof (glibtop_response), 0) < 0) glibtop_warn_io ("send"); -@@ -49,9 +54,13 @@ +@@ -50,9 +55,13 @@ do_output (int s, glibtop_response *resp fprintf (stderr, "Writing %d bytes of data.\n", resp->data_size); #endif @@ -38,7 +38,7 @@ } else { if (send (s, data, resp->data_size, 0) , 0) glibtop_warn_io ("send"); -@@ -67,6 +76,7 @@ +@@ -68,6 +77,7 @@ do_read (int s, void *ptr, size_t total_ size_t already_read = 0, remaining = total_size; while (already_read < total_size) { @@ -46,7 +46,7 @@ if (s) nread = recv (s, ptr, remaining, 0); else -@@ -78,6 +88,8 @@ +@@ -79,6 +89,8 @@ do_read (int s, void *ptr, size_t total_ } if (nread <= 0) { diff --git a/devel/libgtop2/files/patch-sysdeps_freebsd_fsusage.c b/devel/libgtop2/files/patch-sysdeps_freebsd_fsusage.c index 128eda35b6cb..85c9822f86f9 100644 --- a/devel/libgtop2/files/patch-sysdeps_freebsd_fsusage.c +++ b/devel/libgtop2/files/patch-sysdeps_freebsd_fsusage.c @@ -1,21 +1,28 @@ ---- sysdeps/freebsd/fsusage.c.orig Mon Feb 28 03:54:41 2005 -+++ sysdeps/freebsd/fsusage.c Tue May 24 01:49:42 2005 -@@ -9,6 +9,12 @@ +--- sysdeps/freebsd/jfsusage.c.orig Sun Apr 9 12:52:45 2006 ++++ sysdeps/freebsd/fsusage.c Mon Apr 10 15:34:42 2006 +@@ -9,10 +9,12 @@ + #include <unistd.h> #include <sys/param.h> +-#if defined (HAVE_SYS_STATVFS_H) +-#include <sys/statvfs.h> +-#else #include <sys/mount.h> +#if __FreeBSD_version >= 600000 +#include <libgeom.h> +#include <sys/resource.h> +#include <devstat.h> +#include <sys/devicestat.h> -+#endif + #endif #include <stdio.h> - #include <string.h> -@@ -27,15 +33,107 @@ _glibtop_freebsd_get_fsusage_read_write( +@@ -31,24 +33,108 @@ _glibtop_freebsd_get_fsusage_read_write( + const char *path) { int result; +-#if defined (STAT_STATVFS) +- struct statvfs sfs; +-#else struct statfs sfs; +#if __FreeBSD_version >= 600000 + struct devstat *ds; @@ -26,14 +33,18 @@ + struct gmesh gmp; + double etime; + uint64_t ld[2]; -+#endif + #endif +-#if defined (STAT_STATVFS) +- result = statvfs (path, &sfs); +-#else result = statfs (path, &sfs); +-#endif if (result == -1) { + glibtop_warn_io_r (server, "statfs"); - return; - } ++ return; ++ } +#if __FreeBSD_version >= 600000 + ld[0] = 0; + ld[1] = 0; @@ -55,9 +66,9 @@ + glibtop_warn_io_r (server, "geom_stats_snapshot_get()"); + geom_stats_close (); + geom_deletetree (&gmp); -+ return; -+ } -+ + return; + } + + geom_stats_snapshot_timestamp (sc, &ts); + etime = ts.tv_sec + (ts.tv_nsec * 1e-9); + geom_stats_snapshot_reset (sc); @@ -107,7 +118,7 @@ + break; + } + } - ++ + geom_stats_snapshot_free (sc); + geom_stats_close (); + geom_deletetree (&gmp); diff --git a/devel/libgtop2/files/patch-sysdeps_freebsd_glibtop_server.h b/devel/libgtop2/files/patch-sysdeps_freebsd_glibtop_server.h index 5ded2dc3c3c0..4955aed65da5 100644 --- a/devel/libgtop2/files/patch-sysdeps_freebsd_glibtop_server.h +++ b/devel/libgtop2/files/patch-sysdeps_freebsd_glibtop_server.h @@ -1,5 +1,5 @@ ---- sysdeps/freebsd/glibtop_server.h.orig Mon Oct 20 11:19:49 2003 -+++ sysdeps/freebsd/glibtop_server.h Mon Aug 8 15:10:14 2005 +--- sysdeps/freebsd/glibtop_server.h.orig Tue Apr 4 16:06:13 2006 ++++ sysdeps/freebsd/glibtop_server.h Mon Apr 10 15:27:11 2006 @@ -21,8 +21,8 @@ Boston, MA 02111-1307, USA. */ @@ -11,11 +11,3 @@ G_BEGIN_DECLS -@@ -45,6 +45,7 @@ G_BEGIN_DECLS - #define GLIBTOP_SUID_PROC_ARGS (1 << GLIBTOP_SYSDEPS_PROC_ARGS) - #define GLIBTOP_SUID_PROC_MAP (1 << GLIBTOP_SYSDEPS_PROC_MAP) - #define GLIBTOP_SUID_NETLOAD (1 << GLIBTOP_SYSDEPS_NETLOAD) -+#define GLIBTOP_SUID_NETLIST 0 - #define GLIBTOP_SUID_PPP (1 << GLIBTOP_SYSDEPS_PPP) - - G_END_DECLS diff --git a/devel/libgtop2/files/patch-sysdeps_freebsd_siglist.c b/devel/libgtop2/files/patch-sysdeps_freebsd_siglist.c new file mode 100644 index 000000000000..6881723bd3ad --- /dev/null +++ b/devel/libgtop2/files/patch-sysdeps_freebsd_siglist.c @@ -0,0 +1,41 @@ +--- sysdeps/freebsd/siglist.c.orig Fri Jan 20 02:56:40 2006 ++++ sysdeps/freebsd/siglist.c Fri Jan 20 02:56:44 2006 +@@ -26,4 +26,37 @@ + #include <glibtop/signal.h> + + const glibtop_signame glibtop_sys_siglist [] = +-{ { 0, NULL, NULL } }; ++{ { 1, "SIGHUP", "Hangup" }, ++ { 2, "SIGINT", "Interrupt" }, ++ { 3, "SIGQUIT", "Quit" }, ++ { 4, "SIGILL", "Illegal Instruction" }, ++ { 5, "SIGTRAP", "Trace/Breakpoint Trap" }, ++ { 6, "SIGABRT", "Abort" }, ++ { 7, "SIGEMT", "Emulation Trap" }, ++ { 8, "SIGFPE", "Arithmetic Exception" }, ++ { 9, "SIGKILL", "Killed" }, ++ { 10, "SIGBUS", "Bus Error" }, ++ { 11, "SIGSEGV", "Segmentation Fault" }, ++ { 12, "SIGSYS", "Bad System Call" }, ++ { 13, "SIGPIPE", "Broken Pipe" }, ++ { 14, "SIGALRM", "Alarm Clock" }, ++ { 15, "SIGTERM", "Terminated" }, ++ { 16, "SIGURG", "Urgent Condition Present On Socket" }, ++ { 17, "SIGSTOP", "Stop (cannot be caught or ignored)" }, ++ { 18, "SIGTSTP", "Stop Signal Generated From Keyboard" }, ++ { 19, "SIGCONT", "Continue After Stop" }, ++ { 20, "SIGCHLD", "Child Status Has Changed" }, ++ { 21, "SIGTTIN", "Background Read Attempted From Control Terminal" }, ++ { 22, "SIGTTOU", "Background Write Attempted To Control Terminal" }, ++ { 23, "SIGIO", "I/O Is Possible On A Descriptor" }, ++ { 24, "SIGXCPU", "CPU Time Limit Exceeded" }, ++ { 25, "SIGXFSZ", "File Size Limit Exceeded" }, ++ { 26, "SIGVTALRM","Virtual Time Alarm" }, ++ { 27, "SIGPROF", "Profiling Timer Alarm" }, ++ { 28, "SIGWINCH","Window Size Change" }, ++ { 29, "SIGINFO", "Status Request From Keyboard" }, ++ { 30, "SIGUSR1", "User Defined Signal 1" }, ++ { 31, "SIGUSR2", "User Defined Signal 2" }, ++ { 32, "SIGTHR", "Thread Interrupt" }, ++ { 0, NULL, NULL } ++}; diff --git a/devel/libgtop2/files/patch-sysdeps_freebsd_sysinfo.c b/devel/libgtop2/files/patch-sysdeps_freebsd_sysinfo.c deleted file mode 100644 index 7a86f3327730..000000000000 --- a/devel/libgtop2/files/patch-sysdeps_freebsd_sysinfo.c +++ /dev/null @@ -1,95 +0,0 @@ ---- sysdeps/freebsd/sysinfo.c.orig Thu Jun 9 22:56:29 2005 -+++ sysdeps/freebsd/sysinfo.c Thu Jun 9 22:58:36 2005 -@@ -0,0 +1,92 @@ -+/* $Id$ */ -+ -+/* Copyright (C) 1998-99 Martin Baulig -+ This file is part of LibGTop 1.0. -+ -+ Contributed by Martin Baulig <martin@home-of-linux.org>, 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 <sys/types.h> -+#include <sys/sysctl.h> -+#include <glibtop/error.h> -+#include <glibtop/cpu.h> -+#include <glibtop/sysinfo.h> -+ -+static const unsigned long _glibtop_sysdeps_sysinfo = -+(1L << GLIBTOP_SYSINFO_CPUINFO); -+ -+static glibtop_sysinfo sysinfo = { .flags = 0 }; -+ -+static void -+init_sysinfo (glibtop *server) -+{ -+ char *model; -+ int ncpus = 1; -+ int mhz = 0; -+ size_t len; -+ -+ if(G_LIKELY(sysinfo.flags)) return; -+ -+ glibtop_init_s (&server, GLIBTOP_SYSDEPS_CPU, 0); -+ -+ len = sizeof (ncpus); -+ sysctlbyname ("hw.ncpu", &ncpus, &len, NULL, 0); -+ len = 0; -+ sysctlbyname ("hw.model", NULL, &len, NULL, 0); -+ model = malloc (len); -+ sysctlbyname ("hw.model", model, &len, NULL, 0); -+ len = sizeof (mhz); -+ sysctlbyname ("hw.clockrate", &mhz, &len, NULL, 0); -+ -+ for(sysinfo.ncpu = 0; -+ sysinfo.ncpu < GLIBTOP_NCPU && sysinfo.ncpu < ncpus; -+ sysinfo.ncpu++) { -+ -+ glibtop_entry * const cpuinfo = &sysinfo.cpuinfo[sysinfo.ncpu]; -+ -+ cpuinfo->labels = g_ptr_array_new (); -+ -+ cpuinfo->values = g_hash_table_new_full(g_str_hash, g_str_equal, -+ g_free, g_free); -+ -+ cpuinfo->descriptions = g_hash_table_new_full(g_str_hash, g_str_equal, -+ g_free, g_free); -+ -+ g_ptr_array_add (cpuinfo->labels, "processor"); -+ g_hash_table_insert (cpuinfo->values, "processor", &sysinfo.ncpu); -+ -+ g_ptr_array_add (cpuinfo->labels, "vendor_id"); -+ g_hash_table_insert (cpuinfo->values, "vendor_id", model); -+ -+ g_ptr_array_add (cpuinfo->labels, "cpu MHz"); -+ g_hash_table_insert (cpuinfo->values, "cpu MHz", &mhz); -+ -+ } -+ -+ free (model); -+ -+ sysinfo.flags = _glibtop_sysdeps_sysinfo; -+} -+ -+const glibtop_sysinfo * -+glibtop_get_sysinfo_s (glibtop *server) -+{ -+ init_sysinfo (server); -+ return &sysinfo; -+} diff --git a/devel/libgtop2/files/patch-systeps::freebsd::procmap.c b/devel/libgtop2/files/patch-systeps::freebsd::procmap.c index c8c701e46eca..a17e9595e7c8 100644 --- a/devel/libgtop2/files/patch-systeps::freebsd::procmap.c +++ b/devel/libgtop2/files/patch-systeps::freebsd::procmap.c @@ -1,11 +1,155 @@ ---- sysdeps/freebsd/procmap.c Wed Feb 23 17:20:45 2005 -+++ sysdeps/freebsd/procmap.c.orig Sat Mar 19 02:46:57 2005 -@@ -129,7 +129,7 @@ +--- sysdeps/freebsd/procmap.c.orig Mon Dec 12 05:09:39 2005 ++++ sysdeps/freebsd/procmap.c Fri Jan 20 16:28:33 2006 +@@ -108,14 +108,16 @@ glibtop_get_proc_map_p (glibtop *server, + #else + struct vm_object object; + #endif +- glibtop_map_entry *maps; ++ GArray *maps = g_array_sized_new(FALSE, FALSE, ++ sizeof(glibtop_map_entry), ++ 100); + #if defined __FreeBSD__ + struct vnode vnode; + #if __FreeBSD_version < 500039 + struct inode inode; + #endif + #endif +- int count, i = 0; ++ int count; + int update = 0; + + glibtop_init_p (server, (1L << GLIBTOP_SYSDEPS_PROC_MAP), 0); +@@ -123,15 +125,15 @@ glibtop_get_proc_map_p (glibtop *server, + memset (buf, 0, sizeof (glibtop_proc_map)); + + /* It does not work for the swapper task. */ +- if (pid == 0) return NULL; ++ if (pid == 0) return (glibtop_map_entry*) g_array_free(maps, TRUE); + + glibtop_suid_enter (server); + /* Get the process data */ pinfo = kvm_getprocs (server->machine.kd, KERN_PROC_PID, pid, &count); if ((pinfo == NULL) || (count < 1)) { - glibtop_error_io_r (server, "kvm_getprocs (%d)", pid); +- return NULL; + glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid); - return NULL; ++ return (glibtop_map_entry*) g_array_free(maps, TRUE); } + /* Now we get the memory maps. */ +@@ -159,8 +161,6 @@ glibtop_get_proc_map_p (glibtop *server, + + buf->total = buf->number * buf->size; + +- maps = g_malloc0(buf->total); +- + buf->flags = _glibtop_sysdeps_proc_map; + + /* Walk through the `vm_map_entry' list ... */ +@@ -170,6 +170,10 @@ glibtop_get_proc_map_p (glibtop *server, + * to OBJT_DEFAULT so if seems this really works. */ + + do { ++ glibtop_map_entry *mentry; ++ unsigned long inode, dev; ++ guint len; ++ + if (update) { + if (kvm_read (server->machine.kd, + (unsigned long) entry.next, +@@ -197,22 +201,6 @@ glibtop_get_proc_map_p (glibtop *server, + #endif + #endif + +- maps [i].flags = _glibtop_sysdeps_map_entry; +- +- maps [i].start = entry.start; +- maps [i].end = entry.end; +- maps [i].offset = entry.offset; +- +- maps [i].perm = 0; +- +- if (entry.protection & VM_PROT_READ) +- maps [i].perm |= GLIBTOP_MAP_PERM_READ; +- if (entry.protection & VM_PROT_WRITE) +- maps [i].perm |= GLIBTOP_MAP_PERM_WRITE; +- if (entry.protection & VM_PROT_EXECUTE) +- maps [i].perm |= GLIBTOP_MAP_PERM_EXECUTE; +- +- i++; + + #if defined(__NetBSD__) && (__NetBSD_Version__ >= 104000000) + if (!entry.object.uvm_obj) +@@ -224,7 +212,7 @@ glibtop_get_proc_map_p (glibtop *server, + (unsigned long) entry.object.uvm_obj, + &vnode, sizeof (vnode)) != sizeof (vnode)) { + glibtop_warn_io_r (server, "kvm_read (vnode)"); +- return NULL; ++ return (glibtop_map_entry*) g_array_free(maps, TRUE); + } + #else + if (!entry.object.vm_object) +@@ -251,8 +239,8 @@ glibtop_get_proc_map_p (glibtop *server, + &inode, sizeof (inode)) != sizeof (inode)) + glibtop_error_io_r (server, "kvm_read (inode)"); + +- maps [i-1].inode = inode.i_number; +- maps [i-1].device = inode.i_dev; ++ inode = inode.i_number; ++ dev = inode.i_dev; + #endif + + +@@ -274,8 +262,8 @@ glibtop_get_proc_map_p (glibtop *server, + switch (vnode.v_type) { + case VREG: + #if __FreeBSD_version < 600006 +- maps [i-1].inode = vnode.v_cachedid; +- maps [i-1].device = vnode.v_cachedfs; ++ inode = vnode.v_cachedid; ++ dev = vnode.v_cachedfs; + #endif + default: + continue; +@@ -289,11 +277,37 @@ glibtop_get_proc_map_p (glibtop *server, + &inode, sizeof (inode)) != sizeof (inode)) + glibtop_error_io_r (server, "kvm_read (inode)"); + +- maps [i-1].inode = inode.i_number; +- maps [i-1].device = inode.i_dev; ++ inode = inode.i_number; ++ dev = inode.i_dev; + #endif + #endif ++ len = maps->len; ++ g_array_set_size(maps, len + 1); ++ mentry = &g_array_index(maps, glibtop_map_entry, len); ++ ++ mentry->flags = _glibtop_sysdeps_map_entry; ++ ++ mentry->start = (guint64) entry.start; ++ mentry->end = (guint64) entry.end; ++ mentry->offset = (guint64) entry.offset; ++ mentry->device = (guint64) dev; ++ mentry->inode = (guint64) inode; ++ ++ mentry->perm = (guint64) 0; ++ ++ if (entry.protection & VM_PROT_READ) ++ mentry->perm |= GLIBTOP_MAP_PERM_READ; ++ if (entry.protection & VM_PROT_WRITE) ++ mentry->perm |= GLIBTOP_MAP_PERM_WRITE; ++ if (entry.protection & VM_PROT_EXECUTE) ++ mentry->perm |= GLIBTOP_MAP_PERM_EXECUTE; + } while (entry.next != first); + +- return maps; ++ buf->flags = _glibtop_sysdeps_proc_map; ++ ++ buf->number = maps->len; ++ buf->size = sizeof (glibtop_map_entry); ++ buf->total = buf->number * buf->size; ++ ++ return (glibtop_map_entry*) g_array_free(maps, FALSE); + } |