1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-28 01:06:17 +00:00

Update to 2.14.8 which includes a major refactoring of the FreeBSD backend.

This commit is contained in:
Joe Marcus Clarke 2007-02-25 18:22:19 +00:00
parent 6301751293
commit 19f39022dc
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=185915
15 changed files with 4 additions and 673 deletions

View File

@ -7,7 +7,7 @@
#
PORTNAME= libgtop
PORTVERSION= 2.14.6
PORTVERSION= 2.14.8
CATEGORIES= devel gnome
MASTER_SITES= ${MASTER_SITE_GNOME}
MASTER_SITE_SUBDIR= sources/${PORTNAME}/${PORTVERSION:C/^([0-9]+\.[0-9]+).*/\1/}
@ -37,15 +37,8 @@ INFO= libgtop2
.if ${OSVERSION} >= 600000
PKGMESSAGE= ${FILESDIR}/pkg-message
EXTRA_PATCHES+= ${FILESDIR}/extra-67-patch-sysdeps_freebsd_Makefile.in
.endif
post-patch:
@${REINPLACE_CMD} -e 's|int64_t|gint64|g' \
${WRKSRC}/include/glibtop/command.h \
${WRKSRC}/include/glibtop/proclist.h \
${WRKSRC}/lib/lib.pl
post-install:
@${CHGRP} kmem ${PREFIX}/bin/libgtop_server2
@${CHMOD} 2555 ${PREFIX}/bin/libgtop_server2

View File

@ -1,3 +1,3 @@
MD5 (gnome2/libgtop-2.14.6.tar.bz2) = 4aa425a6b66b976be6f364904eeda78a
SHA256 (gnome2/libgtop-2.14.6.tar.bz2) = 2d3fc614e2a49e32701037b3245d233b5b44ac5dd0f61db9f09d7c8635792f39
SIZE (gnome2/libgtop-2.14.6.tar.bz2) = 758165
MD5 (gnome2/libgtop-2.14.8.tar.bz2) = 2110c4ee2358b3443512b3f353e85895
SHA256 (gnome2/libgtop-2.14.8.tar.bz2) = 70a1132f834aed1055587d08c03abf7eb4657b20d0a6bf6ebf47968699cd085a
SIZE (gnome2/libgtop-2.14.8.tar.bz2) = 774429

View File

@ -1,20 +0,0 @@
--- 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 sysinfo.c
libgtop_sysdeps_2_0_la_LDFLAGS = $(LT_VERSION_INFO)
-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 \

View File

@ -1,19 +0,0 @@
--- 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

View File

@ -1,30 +0,0 @@
--- 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 @@
*/
#include <config.h>
+#include <errno.h>
#include <glibtop/read.h>
#include <glibtop/error.h>
#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:
if (server->socket) {
do_read (server->socket, buf, size);
} else {
- if(read (server->input [0], buf, size) < 0)
+ if(read (server->input [0], buf, size) < 0) {
+ if (errno == EINTR)
+ goto retry;
glibtop_error_io_r (
server,
ngettext ("read %d byte",
"read %d bytes", size),
(int)size);
+ }
}
}

View File

@ -1,32 +0,0 @@
--- 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 @@
*/
#include <config.h>
-
+#include <errno.h>
#include <glibtop/write.h>
#include <glibtop/error.h>
#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:
if (server->socket) {
ret = send (server->socket, buf, size, 0);
} else {
ret = write (server->output [1], buf, size);
}
- if (ret < 0)
+ if (ret < 0) {
+ if (errno == EINTR)
+ goto retry;
glibtop_error_io_r (server,
ngettext("wrote %d byte",
"wrote %d bytes", size),
(int) size);
+ }
}

View File

@ -1,57 +0,0 @@
--- 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>
@@ -37,9 +38,13 @@ do_output (int s, glibtop_response *resp
resp->offset = offset;
resp->data_size = data_size;
+retry1:
if (s == 0) {
- if (write (1, (const void *) resp, sizeof (glibtop_response)) < 0)
+ if (write (1, (const void *) resp, sizeof (glibtop_response)) < 0) {
+ if (errno == EINTR)
+ goto retry1;
glibtop_warn_io ("write");
+ }
} else {
if (send (s, (const void *) resp, sizeof (glibtop_response), 0) < 0)
glibtop_warn_io ("send");
@@ -50,9 +55,13 @@ do_output (int s, glibtop_response *resp
fprintf (stderr, "Writing %d bytes of data.\n", resp->data_size);
#endif
+retry2:
if (s == 0) {
- if (write (1, data, resp->data_size) < 0)
+ if (write (1, data, resp->data_size) < 0) {
+ if (errno == EINTR)
+ goto retry2;
glibtop_warn_io ("write");
+ }
} else {
if (send (s, data, resp->data_size, 0) , 0)
glibtop_warn_io ("send");
@@ -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) {
+retry:
if (s)
nread = recv (s, ptr, remaining, 0);
else
@@ -79,6 +89,8 @@ do_read (int s, void *ptr, size_t total_
}
if (nread <= 0) {
+ if (errno == EINTR)
+ goto retry;
glibtop_warn_io ("recv");
return 0;
}

View File

@ -1,134 +0,0 @@
--- 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
#include <stdio.h>
@@ -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;
+ void *sc;
+ struct timespec ts;
+ struct gprovider *gp;
+ struct gident *gid;
+ struct gmesh gmp;
+ double etime;
+ uint64_t ld[2];
#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;
+ }
+#if __FreeBSD_version >= 600000
+ ld[0] = 0;
+ ld[1] = 0;
+ result = geom_gettree (&gmp);
+ if (result != 0) {
+ glibtop_warn_io_r (server, "geom_gettree = %d", result);
+ return;
+ }
+
+ result = geom_stats_open ();
+ if (result) {
+ glibtop_warn_io_r (server, "geom_stats_open()");
+ geom_deletetree (&gmp);
+ return;
+ }
+
+ sc = geom_stats_snapshot_get ();
+ if (sc == NULL) {
+ glibtop_warn_io_r (server, "geom_stats_snapshot_get()");
+ geom_stats_close ();
+ geom_deletetree (&gmp);
return;
}
+ geom_stats_snapshot_timestamp (sc, &ts);
+ etime = ts.tv_sec + (ts.tv_nsec * 1e-9);
+ geom_stats_snapshot_reset (sc);
+
+ for (;;) {
+ ds = geom_stats_snapshot_next (sc);
+ if (ds == NULL) {
+ break;
+ }
+ if (ds->id == NULL) {
+ continue;
+ }
+
+ gid = geom_lookupid (&gmp, ds->id);
+ if (gid == NULL) {
+ geom_deletetree (&gmp);
+ result = geom_gettree (&gmp);
+ gid = geom_lookupid (&gmp, ds->id);
+ }
+
+ if (gid == NULL) {
+ continue;
+ }
+ if (gid->lg_what == ISCONSUMER) {
+ continue;
+ }
+
+ gp = gid->lg_ptr;
+
+ if (!g_str_has_suffix (sfs.f_mntfromname, gp->lg_name)) {
+ continue;
+ }
+ else {
+ result = devstat_compute_statistics (ds, NULL, etime,
+ DSM_TOTAL_TRANSFERS_READ,
+ &ld[0],
+ DSM_TOTAL_TRANSFERS_WRITE,
+ &ld[1], DSM_NONE);
+ if (result != 0) {
+ glibtop_warn_io_r (server,
+ "devstat_compute_statistics()");
+ geom_stats_snapshot_free (sc);
+ geom_stats_close ();
+ geom_deletetree (&gmp);
+ return;
+ }
+ break;
+ }
+ }
+
+ geom_stats_snapshot_free (sc);
+ geom_stats_close ();
+ geom_deletetree (&gmp);
+
+ buf->read = ld[0];
+ buf->write = ld[1];
+#else
#if !defined(__FreeBSD_kernel__)
buf->read = sfs.f_syncreads + sfs.f_asyncreads;
buf->write = sfs.f_syncwrites + sfs.f_asyncwrites;
#endif
+#endif
buf->flags |= (1 << GLIBTOP_FSUSAGE_READ) | (1 << GLIBTOP_FSUSAGE_WRITE);
}

View File

@ -1,13 +0,0 @@
--- 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.
*/
-#ifndef __GLIBTOP_SERVER_H__
-#define __GLIBTOP_SERVER_H__
+#ifndef __FREEBSD__GLIBTOP_SERVER_H__
+#define __FREEBSD__GLIBTOP_SERVER_H__
G_BEGIN_DECLS

View File

@ -1,102 +0,0 @@
--- sysdeps/freebsd/netload.c.orig Mon Dec 12 05:09:39 2005
+++ sysdeps/freebsd/netload.c Wed May 3 13:46:08 2006
@@ -28,6 +28,8 @@
#include <glibtop_suid.h>
+#include <string.h>
+
#include <net/if.h>
#include <net/if_dl.h>
#include <net/if_types.h>
@@ -83,9 +85,11 @@ glibtop_get_netload_p (glibtop *server,
const char *interface)
{
struct ifnet ifnet;
- u_long ifnetaddr, ifnetfound, ifaddraddr;
+ u_long ifnetaddr, ifnetfound;
struct sockaddr *sa = NULL;
+#if (defined(__FreeBSD__) && (__FreeBSD_version < 501113)) || defined(__bsdi__)
char tname [16];
+#endif
char name [32];
union {
@@ -101,12 +105,12 @@ glibtop_get_netload_p (glibtop *server,
&ifnetaddr, sizeof (ifnetaddr)) != sizeof (ifnetaddr))
glibtop_error_io_r (server, "kvm_read (ifnet)");
- ifaddraddr = 0;
- while (ifnetaddr || ifaddraddr) {
+ while (ifnetaddr) {
struct sockaddr_in *sin;
register char *cp;
+ u_long ifaddraddr;
- if (ifaddraddr == 0) {
+ {
ifnetfound = ifnetaddr;
if (kvm_read (server->machine.kd, ifnetaddr, &ifnet,
@@ -151,7 +155,11 @@ glibtop_get_netload_p (glibtop *server,
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_LOOPBACK);
if (ifnet.if_flags & IFF_POINTOPOINT)
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_POINTOPOINT);
+#ifdef IFF_DRV_RUNNING
+ if (ifnet.if_drv_flags & IFF_DRV_RUNNING)
+#else
if (ifnet.if_flags & IFF_RUNNING)
+#endif
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_RUNNING);
if (ifnet.if_flags & IFF_NOARP)
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_NOARP);
@@ -159,7 +167,11 @@ glibtop_get_netload_p (glibtop *server,
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_PROMISC);
if (ifnet.if_flags & IFF_ALLMULTI)
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_ALLMULTI);
+#ifdef IFF_DRV_OACTIVE
+ if (ifnet.if_drv_flags & IFF_DRV_OACTIVE)
+#else
if (ifnet.if_flags & IFF_OACTIVE)
+#endif
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_OACTIVE);
if (ifnet.if_flags & IFF_SIMPLEX)
buf->if_flags |= (1L << GLIBTOP_IF_FLAGS_SIMPLEX);
@@ -191,7 +203,7 @@ glibtop_get_netload_p (glibtop *server,
buf->collisions = ifnet.if_collisions;
buf->flags = _glibtop_sysdeps_netload;
- if (ifaddraddr) {
+ while (ifaddraddr) {
if ((kvm_read (server->machine.kd, ifaddraddr, &ifaddr,
sizeof (ifaddr)) != sizeof (ifaddr)))
glibtop_error_io_r (server, "kvm_read (ifaddraddr)");
@@ -201,7 +213,12 @@ glibtop_get_netload_p (glibtop *server,
CP(&ifaddr);
sa = (struct sockaddr *)cp;
- if (sa->sa_family == AF_INET) {
+ if (sa->sa_family == AF_LINK) {
+ struct sockaddr_dl *dl = (struct sockaddr_dl *) sa;
+
+ memcpy (buf->hwaddress, LLADDR (dl), sizeof (buf->hwaddress));
+ buf->flags |= GLIBTOP_NETLOAD_HWADDRESS;
+ } else if (sa->sa_family == AF_INET) {
sin = (struct sockaddr_in *)sa;
#if !defined(__bsdi__)
/* Commenting out to "fix" #13345. */
@@ -211,8 +228,14 @@ glibtop_get_netload_p (glibtop *server,
buf->mtu = ifnet.if_mtu;
buf->flags |= _glibtop_sysdeps_netload_data;
+ } else if (sa->sa_family == AF_INET6) {
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa;
+ memcpy (buf->address6, &sin6->sin6_addr, sizeof (buf->address6));
+ buf->flags |= GLIBTOP_NETLOAD_ADDRESS6;
}
+ /* FIXME prefix6, scope6 */
+ ifaddraddr = (u_long) ifaddr.ifa.ifa_link.tqe_next;
}
return;
}

View File

@ -1,41 +0,0 @@
--- 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 }
+};

View File

@ -1,13 +0,0 @@
--- sysdeps/freebsd/sysinfo.c.orig Fri Nov 24 02:36:12 2006
+++ sysdeps/freebsd/sysinfo.c Fri Nov 24 02:57:37 2006
@@ -73,6 +73,10 @@ init_sysinfo (glibtop *server)
g_hash_table_insert (cpuinfo->values, "vendor_id",
g_strdup(model));
+ g_ptr_array_add (cpuinfo->labels, "model name");
+ g_hash_table_insert (cpuinfo->values, "model name",
+ g_strdup(model));
+
g_ptr_array_add (cpuinfo->labels, "cpu MHz");
g_hash_table_insert (cpuinfo->values, "cpu MHz",
g_strdup_printf("%d", mhz));

View File

@ -1,15 +0,0 @@
--- sysdeps/freebsd/prockernel.c Mon Jul 19 05:33:56 2004
+++ sysdeps/freebsd/prockernel.c.orig Sat Mar 19 02:39:47 2005
@@ -115,8 +115,10 @@
/* Get the process information */
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);
+ if ((pinfo == NULL) || (count != 1)) {
+ glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
+ return;
+ }
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013)

View File

@ -1,155 +0,0 @@
--- sysdeps/freebsd/procmap.c.orig Mon Nov 27 14:22:45 2006
+++ sysdeps/freebsd/procmap.c Sun Dec 3 14:41:07 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__) || defined(__FreeBSD_kernel__)
struct vnode vnode;
#if (__FreeBSD_version < 500039) && !defined(__FreeBSD_kernel__)
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 (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 inum, 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;
+ inum = 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) && !defined(__FreeBSD_kernel__)
- maps [i-1].inode = vnode.v_cachedid;
- maps [i-1].device = vnode.v_cachedfs;
+ inum = 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;
+ inum = 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) inum;
+
+ 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);
}

View File

@ -1,31 +0,0 @@
--- sysdeps/freebsd/proctime.c.orig Wed Feb 23 03:20:45 2005
+++ sysdeps/freebsd/proctime.c Tue Aug 2 12:49:38 2005
@@ -146,8 +146,10 @@ glibtop_get_proc_time_p (glibtop *server
/* Get the process information */
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);
+ if ((pinfo == NULL) || (count != 1)) {
+ glibtop_warn_io_r (server, "kvm_getprocs (%d)", pid);
+ return;
+ }
#if defined(__FreeBSD__) && (__FreeBSD_version >= 500013)
buf->rtime = pinfo [0].ki_runtime;
@@ -193,9 +195,13 @@ glibtop_get_proc_time_p (glibtop *server
if ((pinfo [0].ki_flag & P_INMEM)) {
#endif
buf->utime = pinfo [0].ki_runtime;
- buf->stime = 0; /* XXX */
+ buf->stime = tv2sec (pinfo [0].ki_rusage.ru_stime);
buf->cutime = tv2sec (pinfo [0].ki_childtime);
- buf->cstime = 0; /* XXX */
+#if __FreeBSD_version >= 600000
+ buf->cstime = tv2sec (pinfo [0].ki_rusage_ch.ru_stime);
+#else
+ buf->cstime = 0;
+#endif
buf->start_time = tv2sec (pinfo [0].ki_start);
buf->flags = _glibtop_sysdeps_proc_time_user;
}