Subject: Re: lsof and struct bufq_state
To: john heasley <heas@shrubbery.net>
From: Ron Roskens <roskens@colltech.com>
List: current-users
Date: 09/11/2002 16:23:16
I don't know if its "proper" for a user util to define _KERNEL, but since
lsof is groveling around inside kernel space, it needs it more for all the
types to be defined.

Change dlsof.h so that the code around "include <sys/buf.h>" looks like this:

# if   defined(NETBSDV)
#  if  __NetBSD_Version__>=106050000
#define        _KERNEL
struct buf;    /* to satisfy a function prototype in buf.h */
#  endif
#include <sys/buf.h>
#  if  __NetBSD_Version__>=106050000
#undef _KERNEL
#  endif
# endif        /* defined(NETBSDV) */

On Wed, 11 Sep 2002, john heasley wrote:

> Date: Wed, 11 Sep 2002 21:13:30 +0000
> From: john heasley <heas@shrubbery.net>
> To: current-users@netbsd.org
> Subject: lsof and struct bufq_state
>
> from sources of yesterday, lsof build fails thusly
>
> cc -O2  -DNETBSDV=1060 -DHASGETBOOTFILE -DHASNFSPROTO -DHASIPv6 -DHASFDESCFS=1 -DHASFDLINK -DHASNULLFS -DHASPROCFS -DHAS9660FS -DHASMSDOSFS -DHASKERNFS -DHASNCVPID -DHASI_FFS -DHASEXT2FS -DHASI_E2FS -DHASNFSVATTRP -DUVM -I/home/pkgsrc/sysutils/lsof/work/lsof_4.64/lsof_4.64_src/dialects/n+obsd/include -DHAS_UVM_INCL -DHAS_ADVLOCK_ARGS -DHASCWDINFO -DHAS_SYS_PIPEH -DLSOF_VSTR=\"1.6G\" -I/usr/include -I/sys -O  -c dvch.c
> In file included from ../dlsof.h:176,
>                  from ../lsof.h:172,
>                  from dvch.c:43:
> /usr/include/ufs/mfs/mfsnode.h:47: field `mfs_buflist' has incomplete type
> *** Error code 1
>
> because struct mfsnod has the member
>
>         struct  bufq_state mfs_buflist; /* list of I/O requests */
>
> defined in sys/buf.h and enclosed in _KERNEL.  is it proper to define
> _KERNEL in a user util to get to these definitions?
>
>