cvs commit: src/usr.bin/netstat Makefile bpf.c inet.c pfkey.c route.c sctp.c

Jeremy Chadwick koitsu at
Wed Sep 10 03:56:29 UTC 2008

On Tue, Sep 09, 2008 at 10:31:46PM -0400, Mike Tancsa wrote:
> Hi,
>         The change below seems to make netstat -B on RELENG_7 coredump
> netstat -B
> specifically,
> -               printf("%5d %6s %7s %9lu %9lu %9lu %5d %5d %s\n",
> +               printf("%5d %6s %7s %9ju %9ju %9ju %5d %5d %s\n",
> ...
> Not sure if its a netstat issue or a libc issue as it works fine in HEAD

The commit:;r2=;f=h


The variables being printed (bd_rcount, bd_dcount and bd_fcount) are all
u_long on RELENG_7 i386 and amd64.  See include/net/bpfdesc.h.

%lu = unsigned long     (i386 returns 4, amd64 returns 8)
%ju = unsigned intmax_t (i386 returns 8, amd64 returns 8)

The segfault reason should be obvious here; u_long != unsigned intmax_t
on i386.  This is specific to i386 (which I see you're using from the
gdb output); it works fine on amd64.

The commit should be backed out or re-worked to work on i386, or more
bpf-related pieces from HEAD need to be MFC'd.

The reason it might work in HEAD (did you test HEAD i386 or HEAD amd64?)
is that HEAD might have the variables in bpfdesc.h declared as something
like unsigned intmax_t, which might be a better solution, but MFC'ing
that could break things.

| Jeremy Chadwick                                jdc at |
| Parodius Networking              |
| UNIX Systems Administrator                  Mountain View, CA, USA |
| Making life hard for others since 1977.              PGP: 4BD6C0CB |

More information about the freebsd-stable mailing list