Subject: netstat problem with ksyms.
To: NetBSD-current Discussion List <current-users@netbsd.org>
From: Chavdar Ivanov <ci4ic4@gmail.com>
List: current-users
Date: 05/27/2006 13:13:12
Hi,

It seems if one has

pseudo-device   ksyms                   # /dev/ksyms

in one's kernel, netstat refuses to play:

# netstat
netstat: no namelist

If I take just the above line from the kernel definition, it works
fine. The ktruss output shows opening of /dev/ksyms if the option is
enabled, but fails further:

...
 12117      1 netstat  open("/dev/kmem", 0, 0)     =3D 5
 12117      1 netstat  fcntl(0x5, 0x2, 0x1)        =3D 0
 12117      1 netstat  open("/dev/drum", 0, 0)     =3D 6
 12117      1 netstat  fcntl(0x6, 0x2, 0x1)        =3D 0
 12117      1 netstat  open("/dev/ksyms", 0, 0)    =3D 7
 12117      1 netstat  fcntl(0x7, 0x2, 0x1)        =3D 0
 12117      1 netstat  close(0x7)                  =3D 0
 12117      1 netstat  getgid()                    =3D 0, 2
 12117      1 netstat  setgid(0)                   =3D 0
 12117      1 netstat  open("/dev/ksyms", 0, 0)    =3D 7
 12117      1 netstat  fcntl(0x7, 0x2, 0x1)        =3D 0
 12117      1 netstat  pread(0x7, 0xbfbfaf90, 0x20, 0, 0, 0) =3D 32
       "\^?ELF\^A\0\0\0\0\0\0\0\0\0\0\0\^B\0\0\0\^A\0\0\0\0\0\0\0004\0\0\0"
 12117      1 netstat  __fstat30(0x7, 0xbfbfdf40)  =3D 0
 12117      1 netstat  pread(0x7, 0xbfbfdf00, 0x34, 0, 0, 0) =3D 52
       "\^?ELF\^A\0\0\0\0\0\0\0\0\0\0\0\^B\0\0\0\^A\0\0\0\0\0\0\0004\0\0\0t=
\0"
 12117      1 netstat  close(0x7)                  =3D 0
 12117      1 netstat  write(0x2, 0xbfbfd6d0, 0x9) =3D 9
       "netstat: "
 12117      1 netstat  write(0x2, 0xbfbfd6f0, 0xb) =3D 11
       "no namelist"
 12117      1 netstat  write(0x2, 0x8068f5b, 0x1)  =3D 1
       "\n"
 12117      1 netstat  exit(0x1)
.....

Obviously with no ksyms in the kernel, it cannot open /dev/ksyms and
carries on it's work.

Any ideas?

(BTW this is -current from yesterday, i386).