Subject: Re: systat can't read /dev/ksyms
To: None <current-users@netbsd.org>
From: walt <wa1ter@myrealbox.com>
List: current-users
Date: 08/03/2003 12:59:46
Jaromir Dolecek wrote:
> Okay, there are several issues.
> 
> Yes, you indeed absolutely have to have the booted kernel
> as file /netbsd if you want the kernel growellers (xosview,
> systat etc) to work, and the file must not be gzipped.
> 
> The sysinst coredumping was a bug in sysinst code, where
> it used some Curses library function before curses context
> would be initialized if the initial symbol lookup failed.
> This exactly happened if the booted kernel would be gzipped,
> or when systat would be run like 'systat -N /netbsd.gz'.
> I checked in a fix for this one to -current,
> src/usr.bin/systat/main.c rev. 1.34.

Thanks.  Things are better but not quite right, even now.

Systat no longer segfaults but I still see this:
# systat
systat: no namelist

This is the last few lines from 'ktruss systat':
    298 systat   open("/dev/mem", 0, 0)             = 3
    298 systat   fcntl(0x3, 0x2, 0x1)               = 0
    298 systat   __fstat13(0x3, 0xbfbff2b8)         = 0
    298 systat   open("/dev/kmem", 0, 0)            = 4
    298 systat   fcntl(0x4, 0x2, 0x1)               = 0
    298 systat   open("/dev/drum", 0, 0)            = 5
    298 systat   fcntl(0x5, 0x2, 0x1)               = 0
    298 systat   open("/dev/ksyms", 0, 0)           = 6
    298 systat   fcntl(0x6, 0x2, 0x1)               = 0
    298 systat   getgid                             = 0
    298 systat   setegid(0)                         = 0
    298 systat   pread(0x6, 0xbfbfc2e8, 0x20, 0, 0) Err#6 ENXIO
    298 systat   __fstat13(0x6, 0xbfbff2a8)         = 0
    298 systat   pread(0x6, 0xbfbff274, 0x34, 0, 0) Err#6 ENXIO
    298 systat   write(0x2, 0xbfbfea18, 0x8)        = 8
        "systat: "
    298 systat   write(0x2, 0xbfbfea48, 0xb)        = 11
        "no namelist"
    298 systat   write(0x2, 0xbfbfea18, 0x1)        = 1

You can see that systat fails to read from /dev/ksyms and
then closes without attempting to read the symbols from
/netbsd.

But if I use the -N flag I can see systat open /netbsd
to read the symbols and it never does attempt to read
/dev/ksyms (just like the old behavior in -STABLE.)

The problem /dev/ksyms is still a mystery to me.
You can see the file opens okay but can't be read.
===========================================

The next problem is xosview, which complains about missing
kernel symbols also (but it does the same in -STABLE):
# xosview
xosview: kvm_nlist() lookup failed for symbol '_ifnet'.
xosview: kvm_nlist() lookup failed for symbol '_ifnet'.
xosview: kvm_nlist() lookup failed for symbol '_disklist'.
xosview: kvm_nlist() lookup failed for symbol '_disklist'.
xosview: kvm_nlist() lookup failed for symbol '_disklist'.
xosview: kvm_nlist() lookup failed for symbol '_disklist'.
xosview: kvm_nlist() lookup failed for symbol '_disklist'.
xosview: kvm_nlist() lookup failed for symbol '_intrcnt'.
xosview: kvm_nlist() lookup failed for symbol '_eintrcnt'.
xosview: The kernel does not seem to have the symbols needed for the DiskMeter.
   (A 1.2 kernel or above is probably needed)
The DiskMeter has been disabled.

xosview: safe_kvm_read() was attempted on EA 0

If I call the program this way: 'xosview -net -disk -int' it
works okay (but still complains about the missing symbols),
otherwise it flashes up on the screen for less than a second
and quits with no other messages.

In -STABLE, xosview complains about missing symbols but works
well anyway.  (Actually, in -STABLE, it does NOT complain about
those last two 'intrcnt' symbols.)

Do you see different behavior that what I'm describing?