Subject: Re: tailing of /kern/msgbuf
To: None <hubertf@gmx.de>
From: Chavdar Ivanov <ci4ic4@gmail.com>
List: netbsd-users
Date: 08/22/2005 14:59:53
On 3.99.7:
....
root@loan8> cd /kern
root@loan8> tail msgbuf
tail: msgbuf: File too large
.....
at least no crash... less and cat display it fine.=20

2005/8/22, Hubert Feyrer <hubertf@gmx.de>:
> In article <FFENIJPEMNGOKCCHNAKLOEBPIIAA.Scott.Burns@Netcontech.Com> you =
wrote:
> > I am using NetBSD/i386 V2.0.2 and frequently on my servers if I try:
> >
> > cd /kern
> > tail msgbuf
> >
> > I receive a: "Segmentation fault"
> >
> > Not 100% of the time, but more than not.
> >
> > Has this been observed before ? I can't find mention of it.
>=20
> Poking it seems that the mmap() in forward.c:305 returns a 0 pointer (see
> below0, which seems pretty strange to me. I can understand why mmap()
> would not work on this kind of file, but I'd argue that tail(1) should
> fall back to just open(2) and maybe lseek(2) and read(2) then.
>=20
> Looking at other implementations (source) may be interesting...
>=20
>=20
>  - Hubert
>=20
>=20
>=20
> (gdb) run /kern/msgbuf
> The program being debugged has been started already.
> Start it from the beginning? (y or n) y
>=20
> Starting program: /usr/cvs/src-current/usr.bin/tail/obj/tail /kern/msgbuf
>=20
> Breakpoint 1, rlines (fp=3D0x4810a340, off=3D10, sbp=3D0xbfbff3a0)
>     at /usr/src/usr.bin/tail/forward.c:304
> 304             while (off) {
> (gdb) p off
> $9 =3D 10
> (gdb) p mmap_size
> $10 =3D 16368
> (gdb) p mmap_offset
> $11 =3D 0
> (gdb) step
> 305                     start =3D mmap(NULL, (size_t)mmap_size, PROT_READ=
,
> (gdb)
> 307                     if (start =3D=3D MAP_FAILED) {
> (gdb) p start
> $12 =3D 0x0
> (gdb) print *start
> Error accessing memory address 0x0: Invalid argument.
> (gdb)
>