Subject: Top V3.3
To: NetBSD - Amiga <amiga@sun-lamp.cs.berkeley.edu>
From: Ron Roskens <garion@mermaid.micro.umn.edu>
List: amiga-dev
Date: 07/13/1994 09:02:33
A few days ago someone posted asking why top wouldn't compile. I've got a 
patch that will allow you to compile top. It runs, but there is a segmentation
fault that occurs when you quit.

System:
NetBSD reality 0.9C NetBSD 0.9C (GENERIC) #9: Tue Jun 21 01:21:46 EDT 1994
chopps@burbclave.emich.edu:/usr/src/sys/arch/amiga/compile/GENERIC amiga

Binaries are the one cut by chris.

I created a file called m_netbsd.c in the machine sub-directory.

diff m_netbsd.c m_bsd44.c
28c28
< #include <sys/sysctl.h>
---
> /* #include <sys/sysctl.h> */
45c45
< #define VMUNIX        "/netbsd"
---
> #define VMUNIX        "/vmunix"
68c68
< /* #define weighted_cpu(pct, pp) (PP((pp), p_time) == 0 ? 0.0 : \
---
> #define weighted_cpu(pct, pp) (PP((pp), p_time) == 0 ? 0.0 : \
70,71d69
<  * Hack for the current time... */
< #define weighted_cpu(pct,pp) ( 0.0 )
378c376
<           (show_system || ((PP(pp, p_flag) & P_SYSTEM) == 0)))
---
>           (show_system || ((PP(pp, p_flag) & SSYS) == 0)))
429c427
<     if ((PP(pp, p_flag) & P_INMEM) == 0) {
---
>     if ((PP(pp, p_flag) & SLOAD) == 0) {
458c456
<           PP(pp, p_priority) - PZERO,
---
>           PP(pp, p_pri) - PZERO,
594c592
<               if ((result = PP(p2, p_priority) - PP(p1, p_priority)) == 0)
---
>               if ((result = PP(p2, p_pri) - PP(p1, p_pri)) == 0)

Output from gdb when top was run then quit:

Program received signal SIGSEGV (11), Segmentation fault
0xa302 in __do_global_dtors ()
(gdb) bt
#0  0xa302 in __do_global_dtors ()
#1  0x1c322 in exit ()
#2  0x374c in quit (status=0) at top.c:911
#3  0x3256 in main (argc=1, argv=0xdfffcd0) at top.c:656

Apparently, this function __do_global_dtors() is located in the libgcc.a.

Does anyone have any clues as where to go further??

Thanks,

Ron Roskens

------------------------------------------------------------------------------