Fix some bogus errors in the FreeBSD backend, and remove all compiler warnings.

This commit is contained in:
Joe Marcus Clarke 2009-12-14 00:04:17 +00:00
parent 206126ca1c
commit b4e4df1bb7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=245730
6 changed files with 47 additions and 15 deletions

View file

@ -8,7 +8,7 @@
PORTNAME= libgtop
PORTVERSION= 2.28.0
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= devel gnome
MASTER_SITES= GNOME
DIST_SUBDIR= gnome2

View file

@ -0,0 +1,10 @@
--- sysdeps/freebsd/glibtop_machine.h.orig 2009-12-13 18:34:21.000000000 -0500
+++ sysdeps/freebsd/glibtop_machine.h 2009-12-13 18:34:32.000000000 -0500
@@ -24,6 +24,7 @@
#include <sys/param.h>
#include <nlist.h>
+#include <limits.h>
#include <kvm.h>
#include <sys/dkstat.h>
#include <time.h>

View file

@ -1,6 +1,16 @@
--- sysdeps/freebsd/procmap.c.orig 2009-12-13 13:47:22.000000000 -0500
+++ sysdeps/freebsd/procmap.c 2009-12-13 13:47:27.000000000 -0500
@@ -111,18 +111,18 @@ _glibtop_sysdeps_freebsd_dev_inode (glib
--- sysdeps/freebsd/procmap.c.orig 2009-12-13 18:53:02.827740000 -0500
+++ sysdeps/freebsd/procmap.c 2009-12-13 19:00:04.000000000 -0500
@@ -85,7 +85,9 @@ _glibtop_sysdeps_freebsd_dev_inode (glib
char tagstr[12];
struct inode inode;
struct cdev_priv priv;
+#if __FreeBSD_version < 800039
struct cdev si;
+#endif
*inum = 0;
*dev = 0;
@@ -111,18 +113,18 @@ _glibtop_sysdeps_freebsd_dev_inode (glib
return;
}

View file

@ -1,28 +1,30 @@
--- sysdeps/freebsd/procopenfiles.c.orig 2008-08-18 11:23:36.000000000 -0400
+++ sysdeps/freebsd/procopenfiles.c 2008-12-07 00:17:26.000000000 -0500
--- sysdeps/freebsd/procopenfiles.c.orig 2009-12-13 18:53:02.827740000 -0500
+++ sysdeps/freebsd/procopenfiles.c 2009-12-13 18:54:55.000000000 -0500
@@ -35,6 +35,9 @@
#include <sys/user.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#ifdef HAVE_KINFO_PROC
+#ifdef HAVE_KINFO_GETFILE
+#include <libutil.h>
+#endif
#include <string.h>
#include <stdlib.h>
@@ -263,8 +266,12 @@ glibtop_get_proc_open_files_s (glibtop *
@@ -263,9 +266,13 @@ glibtop_get_proc_open_files_s (glibtop *
{
#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
struct kinfo_file *freep, *kif;
+#ifndef HAVE_KINFO_GETFILE
int name[4];
size_t len;
- size_t i;
+#else
+ int cnt;
+#endif
size_t i;
+ ssize_t i;
#else
char *output;
#endif
@@ -274,6 +281,7 @@ glibtop_get_proc_open_files_s (glibtop *
memset(buf, 0, sizeof (glibtop_proc_open_files));

View file

@ -1,5 +1,5 @@
--- sysdeps/freebsd/procwd.c.orig 2008-08-18 11:23:36.000000000 -0400
+++ sysdeps/freebsd/procwd.c 2008-12-07 00:19:44.000000000 -0500
--- sysdeps/freebsd/procwd.c.orig 2009-12-13 18:53:02.827740000 -0500
+++ sysdeps/freebsd/procwd.c 2009-12-13 18:59:27.000000000 -0500
@@ -27,6 +27,9 @@
#include <sys/sysctl.h>
#include <sys/param.h>
@ -10,6 +10,15 @@
#include <string.h>
static const unsigned long _glibtop_sysdeps_proc_wd =
@@ -40,7 +43,7 @@ _glibtop_init_proc_wd_s(glibtop *server)
server->sysdeps.proc_wd = _glibtop_sysdeps_proc_wd;
}
-#if (__FreeBSD_version >= 800000 && __FreeBSD_version < 800019) || _FreeBSD_version < 700104
+#if (__FreeBSD_version >= 800000 && __FreeBSD_version < 800019) || __FreeBSD_version < 700104
static GPtrArray *
parse_output(const char *output, glibtop_proc_wd *buf)
{
@@ -101,10 +104,14 @@ glibtop_get_proc_wd_s(glibtop *server, g
#if __FreeBSD_version > 800018 || (__FreeBSD_version < 800000 && __FreeBSD_version >= 700104)
struct kinfo_file *freep, *kif;

View file

@ -1,6 +1,6 @@
--- sysdeps/freebsd/suid_open.c.orig 2008-09-29 17:22:12.000000000 -0400
+++ sysdeps/freebsd/suid_open.c 2008-09-29 17:23:35.000000000 -0400
@@ -0,0 +1,91 @@
--- sysdeps/freebsd/suid_open.c.orig 2009-12-13 13:47:12.739004000 -0500
+++ sysdeps/freebsd/suid_open.c 2009-12-13 18:37:51.000000000 -0500
@@ -0,0 +1,92 @@
+/* Copyright (C) 1998 Joshua Sled
+ This file is part of LibGTop 1.0.
+
@ -58,6 +58,7 @@
+ const unsigned long features,
+ const unsigned flags)
+{
+ char errbuf[_POSIX2_LINE_MAX];
+#ifdef DEBUG
+ fprintf (stderr, "DEBUG (%d): glibtop_open_p ()\n", getpid ());
+#endif
@ -68,7 +69,7 @@
+ server->machine.gid = getgid ();
+ server->machine.egid = getegid ();
+ /* Setup machine-specific data */
+ server->machine.kd = kvm_open (NULL, NULL, NULL, O_RDONLY, "kvm_open");
+ server->machine.kd = kvm_openfiles (NULL, NULL, NULL, O_RDONLY, errbuf);
+
+ if (server->machine.kd == NULL)
+ glibtop_error_io_r (server, "kvm_open");