lsof build failed under FreeBSD 7.2-STABLE AMD64

Erik Trulsson ertr1013 at student.uu.se
Sun Nov 1 19:48:43 UTC 2009


[lsof maintainer added to Cc:]

On Sun, Nov 01, 2009 at 12:10:07PM -0600, Larry Rosenman wrote:
> Are your system sources current?  and do they match the running system?
> 
> it compiles file for me on:

But if you update your FreeBSD system to the very latest (or at least after
Oct 29) it will not compile fine for you either.

The following commit to 7-stable broke lsof compilation:

  Author: jhb
  Date: Thu Oct 29 15:10:38 2009
  New Revision: 198595
  URL: http://svn.freebsd.org/changeset/base/198595
 
  Log:
    MFC 196615:
    Extend the device pager to support different memory attributes on different
    pages in an object.
    - Add a new variant of d_mmap() currently called d_mmap2() which accepts
      an additional in/out parameter that is the memory attribute to use for
      the requested page.
    - A driver either uses d_mmap() or d_mmap2() for all requests but not
    - both.
      The current implementation uses a flag in the cdevsw (D_MMAP2) to indicate
      that the driver provides a d_mmap2() handler instead of d_mmap().  This
      is done to make the change ABI compatible with existing drivers and
      MFC'able to 7 and 8.
 
The lsof source code contains code to handle the problem for -CURRENT. The
following part from dialects/freebsd/dlsof.h is the relevant part which
describes the problem and contains a solution for 9-CURRENT.

  #  if   FREEBSDV>=9000
  /*
   * The FreeBSD 9 and above d_mmap2_t function typedef in <sys/conf.h> needs
   * the definition of vm_memattr_t for a pointer, but that definition is only
   * available under _KERNEL in <sys/types.h>.  Defining _KERNEL before
   * including <sys/types.h> causes many compilation problems, so this
   * expedient (hack) is used.
   */
  #define vm_memattr_t    void
  #  endif        /* FREEBSDV>=9000 */

  #include <sys/conf.h>

  #  if   FREEBSDV>=9000
  #undef  vm_memattr_t
  #  endif        /* FREEBSDV>=9000 */
 

The 'if FREEBSDV>=9000' parts need to be mofified to make it work for older
releases too now that the d_mmap2_t function has been MFC'd.






-- 
<Insert your favourite quote here.>
Erik Trulsson
ertr1013 at student.uu.se


More information about the freebsd-ports mailing list