Subject: pkg/15081: tct patch for NetBSD
To: None <gnats-bugs@gnats.netbsd.org>
From: None <frazee.23@osu.edu>
List: netbsd-bugs
Date: 12/28/2001 15:36:18
>Number: 15081
>Category: pkg
>Synopsis: tct patch for NetBSD
>Confidential: yes
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Dec 28 12:38:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:
>Release: NetBSD 1.5.1
>Organization:
>Environment:
System: NetBSD mai006s4 1.5.2 NetBSD 1.5.2 (GENERIC) #3: Sat Aug 18 23:37:05 CEST 2001 he@hamster.urc.uninett.no:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
The Coroner's Toolkit (tct) does not have native support for NetBSD. The included patch allows clean compilation of tct on NetBSD 1.5.2 and has been done on i386 and macppc platforms. Rigorous testing has not yet been done. Only grave robber has been run.
>How-To-Repeat:
>Fix:
diff -ru tct-1.09/bin/grave-robber tct-1.09-netbsd/bin/grave-robber
--- tct-1.09/bin/grave-robber Wed Dec 12 13:42:44 2001
+++ tct-1.09-netbsd/bin/grave-robber Thu Dec 27 14:04:19 2001
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5
+#!/usr/pkg/bin/perl5.6.1
#
# Usage: $0 [-filmnpstvDEFIMOPVS] [-b body_file] [-c corpse_dir]
diff -ru tct-1.09/bin/mactime tct-1.09-netbsd/bin/mactime
--- tct-1.09/bin/mactime Wed Dec 12 14:21:25 2001
+++ tct-1.09-netbsd/bin/mactime Thu Dec 27 14:09:03 2001
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5
+#!/usr/pkg/bin/perl5.6.1
#
# A program that attempts to determine what files (taken from an already
# calculated DB; see the file "body") were mucked with at a given time...
diff -ru tct-1.09/bin/strip_tct_home tct-1.09-netbsd/bin/strip_tct_home
--- tct-1.09/bin/strip_tct_home Wed Dec 12 13:41:49 2001
+++ tct-1.09-netbsd/bin/strip_tct_home Thu Dec 27 13:38:57 2001
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5
+#!/usr/pkg/bin/perl5.6.1
#
# NOTE!!!
#
diff -ru tct-1.09/extras/bdf tct-1.09-netbsd/extras/bdf
--- tct-1.09/extras/bdf Wed Dec 12 13:42:44 2001
+++ tct-1.09-netbsd/extras/bdf Thu Dec 27 14:08:32 2001
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5
+#!/usr/pkg/bin/perl5.6.1
#
# Goes through text & binaries files, looking for executables
diff -ru tct-1.09/extras/entropy/makedefs tct-1.09-netbsd/extras/entropy/makedefs
--- tct-1.09/extras/entropy/makedefs Thu Oct 4 15:59:35 2001
+++ tct-1.09-netbsd/extras/entropy/makedefs Thu Dec 27 13:36:45 2001
@@ -2,6 +2,8 @@
RELEASE=`(uname -r) 2>/dev/null`
case "$SYSTEM.$RELEASE" in
+ NetBSD.1*) DEFS="-DNETBSD1"
+ ;;
FreeBSD.2*) DEFS="-DFREEBSD2"
;;
FreeBSD.3*) DEFS="-DFREEBSD3"
diff -ru tct-1.09/extras/findkey/makedefs tct-1.09-netbsd/extras/findkey/makedefs
--- tct-1.09/extras/findkey/makedefs Thu Oct 4 15:32:54 2001
+++ tct-1.09-netbsd/extras/findkey/makedefs Thu Dec 27 13:36:45 2001
@@ -2,6 +2,8 @@
RELEASE=`(uname -r) 2>/dev/null`
case "$SYSTEM.$RELEASE" in
+ NetBSD.1*) DEFS="-DNETBSD1"
+ ;;
FreeBSD.2*) DEFS="-DFREEBSD2"
;;
FreeBSD.3*) DEFS="-DFREEBSD3"
diff -ru tct-1.09/extras/ils2mac tct-1.09-netbsd/extras/ils2mac
--- tct-1.09/extras/ils2mac Wed Dec 12 13:42:44 2001
+++ tct-1.09-netbsd/extras/ils2mac Thu Dec 27 14:10:18 2001
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5
+#!/usr/pkg/bin/perl5.6.1
#
# Take a stream of time machine formatted data from ils and re-arrange
diff -ru tct-1.09/extras/realpath tct-1.09-netbsd/extras/realpath
--- tct-1.09/extras/realpath Wed Dec 12 13:42:44 2001
+++ tct-1.09-netbsd/extras/realpath Thu Dec 27 14:10:02 2001
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5
+#!/usr/pkg/bin/perl5.6.1
#
# Prints out the real pathname of file(s); usage:
diff -ru tct-1.09/lazarus/lazarus tct-1.09-netbsd/lazarus/lazarus
--- tct-1.09/lazarus/lazarus Wed Dec 12 13:42:43 2001
+++ tct-1.09-netbsd/lazarus/lazarus Thu Dec 27 14:12:08 2001
@@ -1,4 +1,4 @@
-#!/usr/bin/perl5
+#!/usr/pkg/bin/perl5.6.1
#
# Lazarus - tries to revive things that have died and gone into the
# binary spirit world... deleted files, data in memory, swap, etc.
diff -ru tct-1.09/lib/ostype.pl tct-1.09-netbsd/lib/ostype.pl
--- tct-1.09/lib/ostype.pl Sun Jul 30 19:39:20 2000
+++ tct-1.09-netbsd/lib/ostype.pl Thu Dec 27 13:38:22 2001
@@ -9,6 +9,7 @@
# Order does not matter, table is sorted.
%OS_INFO = (
+ "NETBSD1", "NetBSD.1",
"FREEBSD2", "FreeBSD.2",
"FREEBSD3", "FreeBSD.3",
"FREEBSD4", "FreeBSD.4",
diff -ru tct-1.09/src/aux/makedefs tct-1.09-netbsd/src/aux/makedefs
--- tct-1.09/src/aux/makedefs Thu Oct 4 15:34:08 2001
+++ tct-1.09-netbsd/src/aux/makedefs Thu Dec 27 13:36:45 2001
@@ -2,6 +2,8 @@
RELEASE=`(uname -r) 2>/dev/null`
case "$SYSTEM.$RELEASE" in
+ NetBSD.1*) DEFS="-DNETBSD1"
+ ;;
FreeBSD.2*) DEFS="-DFREEBSD2"
;;
FreeBSD.3*) DEFS="-DFREEBSD3"
diff -ru tct-1.09/src/file/makedefs tct-1.09-netbsd/src/file/makedefs
--- tct-1.09/src/file/makedefs Thu Oct 4 15:42:22 2001
+++ tct-1.09-netbsd/src/file/makedefs Thu Dec 27 13:36:45 2001
@@ -2,6 +2,8 @@
RELEASE=`(uname -r) 2>/dev/null`
case "$SYSTEM.$RELEASE" in
+ NetBSD.1*) DEFS="-DNETBSD1"
+ ;;
FreeBSD.2*) DEFS="-DFREEBSD2"
;;
FreeBSD.3*) DEFS="-DFREEBSD3"
diff -ru tct-1.09/src/fstools/ffs.c tct-1.09-netbsd/src/fstools/ffs.c
--- tct-1.09/src/fstools/ffs.c Sat Sep 15 16:45:56 2001
+++ tct-1.09-netbsd/src/fstools/ffs.c Thu Dec 27 13:36:45 2001
@@ -193,8 +193,13 @@
cg_num = INO_TO_CG(ffs->fs, inum);
if (cg == 0 || cg->cg_cgx != cg_num) {
cg = ffs_cgroup_lookup(ffs, cg_num);
- inosused = (unsigned char *) cg_inosused(cg);
- ibase = cg_num * ffs->fs->fs_ipg;
+ #if defined(NETBSD1)
+ inosused = (unsigned char *) cg_inosused(cg,0);
+ ibase = cg_num * ffs->fs->fs_ipg;
+ #else
+ inosused = (unsigned char *) cg_inosused(cg);
+ ibase = cg_num * ffs->fs->fs_ipg;
+ #endif
}
/*
@@ -290,7 +295,11 @@
cg_num = dtog(ffs->fs, addr);
if (cg == 0 || cg->cg_cgx != cg_num) {
cg = ffs_cgroup_lookup(ffs, cg_num);
- freeblocks = (unsigned char *) cg_blksfree(cg);
+ #if defined(NETBSD1)
+ freeblocks = (unsigned char *) cg_blksfree(cg,0);
+ #else
+ freeblocks = (unsigned char *) cg_blksfree(cg);
+ #endif
dbase = cgbase(ffs->fs, cg_num);
dmin = cgdmin(ffs->fs, cg_num);
sblock = cgsblock(ffs->fs, cg_num);
diff -ru tct-1.09/src/fstools/fs_tools.h tct-1.09-netbsd/src/fstools/fs_tools.h
--- tct-1.09/src/fstools/fs_tools.h Fri Sep 7 13:06:57 2001
+++ tct-1.09-netbsd/src/fstools/fs_tools.h Thu Dec 27 13:36:45 2001
@@ -179,6 +179,29 @@
#endif
/*
+ * NetBSD looks like BSD/OS 3.x.
+ */
+#if defined(NETBSD1)
+#define SUPPORTED
+#define HAVE_UFS_FFS
+#include <sys/vnode.h>
+#include <ufs/ufs/quota.h>
+#include <ufs/ufs/inode.h>
+#include <ufs/ufs/ufs_bswap.h>
+#include <ufs/ffs/fs.h>
+#define LSEEK lseek
+#define OFF_T off_t
+#define STRTOUL strtoul
+#define itod(fs,i) ino_to_fsba(fs,i)
+#define itoo(fs,i) ino_to_fsbo(fs,i)
+#define INOTIME(t) (t)
+#define DADDR_T daddr_t
+#define UFS_TYPE "ufs"
+#define DEF_FSTYPE UFS_TYPE
+#define INO_TO_CG ino_to_cg
+#endif
+
+ /*
* Linux 2.whatever. We'll see how stable the interfaces are.
*/
#if defined(LINUX2)
diff -ru tct-1.09/src/fstools/makedefs tct-1.09-netbsd/src/fstools/makedefs
--- tct-1.09/src/fstools/makedefs Thu Oct 4 15:44:26 2001
+++ tct-1.09-netbsd/src/fstools/makedefs Thu Dec 27 13:36:45 2001
@@ -2,6 +2,8 @@
RELEASE=`(uname -r) 2>/dev/null`
case "$SYSTEM.$RELEASE" in
+ NetBSD.1*) DEFS="-DNETBSD1"
+ ;;
FreeBSD.2*) DEFS="-DFREEBSD2"
;;
FreeBSD.3*) DEFS="-DFREEBSD3"
diff -ru tct-1.09/src/lastcomm/makedefs tct-1.09-netbsd/src/lastcomm/makedefs
--- tct-1.09/src/lastcomm/makedefs Thu Oct 4 15:45:44 2001
+++ tct-1.09-netbsd/src/lastcomm/makedefs Thu Dec 27 13:36:45 2001
@@ -2,6 +2,8 @@
RELEASE=`(uname -r) 2>/dev/null`
case "$SYSTEM.$RELEASE" in
+ NetBSD.1*) DEFS="-DNETBSD1"
+ ;;
FreeBSD.2*) DEFS="-DFREEBSD2"
;;
FreeBSD.4*) DEFS="-DFREEBSD3"
diff -ru tct-1.09/src/lastcomm/sys_defs.h tct-1.09-netbsd/src/lastcomm/sys_defs.h
--- tct-1.09/src/lastcomm/sys_defs.h Sun Jul 30 19:39:20 2000
+++ tct-1.09-netbsd/src/lastcomm/sys_defs.h Thu Dec 27 13:36:45 2001
@@ -7,7 +7,7 @@
*/
#if defined(FREEBSD2) || defined(FREEBSD3) || defined(FREEBSD4) \
|| defined(BSDI2) || defined(BSDI3) || defined(BSDI4) \
- || defined(OPENBSD2)
+ || defined(OPENBSD2) || defined(NETBSD1)
#define SUPPORTED
#define _PATH_ACCT "/var/account/acct"
#define HAVE_COMP_BLOCK_IO_COUNT
diff -ru tct-1.09/src/major_minor/makedefs tct-1.09-netbsd/src/major_minor/makedefs
--- tct-1.09/src/major_minor/makedefs Thu Oct 4 15:46:24 2001
+++ tct-1.09-netbsd/src/major_minor/makedefs Thu Dec 27 13:36:45 2001
@@ -2,6 +2,8 @@
RELEASE=`(uname -r) 2>/dev/null`
case "$SYSTEM.$RELEASE" in
+ NetBSD.1*) DEFS="-DNETBSD1"
+ ;;
FreeBSD.2*) DEFS="-DFREEBSD2"
;;
FreeBSD.3*) DEFS="-DFREEBSD3"
diff -ru tct-1.09/src/misc/makedefs tct-1.09-netbsd/src/misc/makedefs
--- tct-1.09/src/misc/makedefs Thu Oct 4 15:47:05 2001
+++ tct-1.09-netbsd/src/misc/makedefs Thu Dec 27 13:36:45 2001
@@ -2,6 +2,8 @@
RELEASE=`(uname -r) 2>/dev/null`
case "$SYSTEM.$RELEASE" in
+ NetBSD.1*) DEFS="-DNETBSD1"
+ ;;
FreeBSD.2*) DEFS="-DFREEBSD2"
;;
FreeBSD.3*) DEFS="-DFREEBSD3"
diff -ru tct-1.09/src/pcat/makedefs tct-1.09-netbsd/src/pcat/makedefs
--- tct-1.09/src/pcat/makedefs Thu Oct 4 15:31:47 2001
+++ tct-1.09-netbsd/src/pcat/makedefs Thu Dec 27 13:36:45 2001
@@ -2,6 +2,8 @@
RELEASE=`(uname -r) 2>/dev/null`
case "$SYSTEM.$RELEASE" in
+ NetBSD.1*) DEFS="-DNETBSD1"
+ ;;
FreeBSD.2*) DEFS="-DFREEBSD2"
;;
FreeBSD.3*) DEFS="-DFREEBSD3"
diff -ru tct-1.09/src/pcat/pcat.c tct-1.09-netbsd/src/pcat/pcat.c
--- tct-1.09/src/pcat/pcat.c Tue Sep 25 13:22:20 2001
+++ tct-1.09-netbsd/src/pcat/pcat.c Thu Dec 27 13:36:45 2001
@@ -176,6 +176,24 @@
#define PTRACE_ARG3_T caddr_t
#endif
+/*
+ * Ripped off from above OpenBSD code
+ */
+#if defined(NETBSD1)
+#define SUPPORTED
+#include <sys/param.h>
+#include <sys/user.h>
+#include <sys/sysctl.h>
+#include <kvm.h>
+#include <stddef.h>
+#define HAVE_PTRACE_MEM
+#define PTRACE_ATTACH PT_ATTACH
+#define PTRACE_DETACH PT_DETACH
+#define PTRACE_PEEKDATA PT_READ_D
+#define HAVE_BROKEN_CTOB
+#define PTRACE_ARG3_T caddr_t
+#endif
+
/*
* SunOS 4.x has no /proc, and ptrace() peeking the u area won't give us the
* process memory segment sizes. Instead we must grope process information
>Release-Note:
>Audit-Trail:
>Unformatted: