From nobody@FreeBSD.org  Wed Oct 24 21:16:33 2012
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id 8E583EBE
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Oct 2012 21:16:33 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 5C7B08FC14
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Oct 2012 21:16:33 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.5/8.14.5) with ESMTP id q9OLGX1f050972
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 24 Oct 2012 21:16:33 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.5/8.14.5/Submit) id q9OLGXIo050971;
	Wed, 24 Oct 2012 21:16:33 GMT
	(envelope-from nobody)
Message-Id: <201210242116.q9OLGXIo050971@red.freebsd.org>
Date: Wed, 24 Oct 2012 21:16:33 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [patch] emulators/open-vm-tools: fix signage bugs with clang
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         173038
>Category:       ports
>Synopsis:       [patch] emulators/open-vm-tools: fix signage bugs with clang
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    swills
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 24 21:20:00 UTC 2012
>Closed-Date:    Sat Oct 19 16:41:25 CEST 2013
>Last-Modified:  Sat Oct 19 14:50:00 UTC 2013
>Originator:     Garrett Cooper
>Release:        10-CURRENT
>Organization:
EMC Isilon
>Environment:
FreeBSD fallout-atf-current.local 10.0-CURRENT FreeBSD 10.0-CURRENT #3: Mon Oct 22 10:30:54 PDT 2012     root@fallout-atf-current.local:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
There are a number of bugs found by clang dealing with signed quantities that cause the build to fail. These are easy to fix and have already been fixed on the upstream git master, but it would be nice to have the fixes in ports as well.
>How-To-Repeat:
cd /usr/ports/emulators/open-vm-tools-nox11
make all CC=clang CXX=clang++ CPP=clang-cpp
>Fix:


Patch attached with submission follows:

Index: emulators/open-vm-tools/files/patch-hgfsserver-hgfsserver.c
===================================================================
--- emulators/open-vm-tools/files/patch-hgfsserver-hgfsserver.c	(revision 0)
+++ emulators/open-vm-tools/files/patch-hgfsserver-hgfsserver.c	(working copy)
@@ -0,0 +1,11 @@
+--- lib/hgfsServer/hgfsServer.c.orig	2012-10-24 13:19:29.622218256 -0700
++++ lib/hgfsServer/hgfsServer.c	2012-10-24 13:19:46.272229169 -0700
+@@ -3557,7 +3557,7 @@
+     * delimiter on copy. Allow 0 length drives so that hidden feature "" can
+     * work.
+     */
+-   if (pathLength < 0 || pathLength >= sizeof p.mountPoint) {
++   if (pathLength >= sizeof p.mountPoint) {
+       LOG(4, ("%s: could not get the volume name\n", __FUNCTION__));
+ 
+       return FALSE;
Index: emulators/open-vm-tools/files/patch-hgfsserver-hgfsserverlinux.c
===================================================================
--- emulators/open-vm-tools/files/patch-hgfsserver-hgfsserverlinux.c	(revision 0)
+++ emulators/open-vm-tools/files/patch-hgfsserver-hgfsserverlinux.c	(working copy)
@@ -0,0 +1,11 @@
+--- ./work/open-vm-tools-8.6.0-425873/lib/hgfsServer/hgfsServerLinux.c.orig	2012-10-24 13:36:24.027191970 -0700
++++ ./work/open-vm-tools-8.6.0-425873/lib/hgfsServer/hgfsServerLinux.c	2012-10-24 13:36:32.935195764 -0700
+@@ -551,7 +551,7 @@
+ 
+    arraySize = ARRAYSIZE(HgfsServerOpenFlags);
+ 
+-   if (flagsIn < 0 || flagsIn >= arraySize) {
++   if (flagsIn >= arraySize) {
+       Log("%s: Invalid HgfsOpenFlags %d\n", __FUNCTION__, flagsIn);
+ 
+       return FALSE;


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->swills 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Wed Oct 24 21:20:08 UTC 2012 
Responsible-Changed-Why:  
Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173038 
State-Changed-From-To: open->closed 
State-Changed-By: tijl 
State-Changed-When: Sat Oct 19 16:40:55 CEST 2013 
State-Changed-Why:  
Committed in r330878. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=173038 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/173038: commit references a PR
Date: Sat, 19 Oct 2013 14:40:11 +0000 (UTC)

 Author: tijl
 Date: Sat Oct 19 14:39:55 2013
 New Revision: 330878
 URL: http://svnweb.freebsd.org/changeset/ports/330878
 
 Log:
   - Fix build with clang and recent kernel API changes.
   - Use new style LIB_DEPENDS.
   
   PR:		173038, 174290, 180499
   Submitted by:	Garrett Cooper <yaneurabeya@gmail.com>
   Approved by:	swills (maintainer)
 
 Added:
   head/emulators/open-vm-tools/files/patch-checkvm.c   (contents, props changed)
   head/emulators/open-vm-tools/files/patch-dndLinux.c   (contents, props changed)
   head/emulators/open-vm-tools/files/patch-hgfsProto.h   (contents, props changed)
   head/emulators/open-vm-tools/files/patch-hgfsserver.c   (contents, props changed)
   head/emulators/open-vm-tools/files/patch-hgfsserverlinux.c   (contents, props changed)
   head/emulators/open-vm-tools/files/patch-vmblock-vfsops.c   (contents, props changed)
   head/emulators/open-vm-tools/files/patch-vmhgfs-os.c   (contents, props changed)
   head/emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c   (contents, props changed)
 Modified:
   head/emulators/open-vm-tools/Makefile
   head/emulators/open-vm-tools/files/patch-vmmemctl-os.c   (contents, props changed)
 Directory Properties:
   head/emulators/open-vm-tools/distinfo   (props changed)
   head/emulators/open-vm-tools/files/patch-appUtilX11.c   (props changed)
   head/emulators/open-vm-tools/files/patch-arch   (props changed)
   head/emulators/open-vm-tools/files/patch-freebsd-8   (props changed)
   head/emulators/open-vm-tools/files/patch-freebsd-9   (props changed)
   head/emulators/open-vm-tools/files/patch-getpwnam   (props changed)
   head/emulators/open-vm-tools/files/patch-guestApp.c   (props changed)
   head/emulators/open-vm-tools/files/patch-hgfsmounter-Makefile.in   (props changed)
   head/emulators/open-vm-tools/files/patch-hostinfoPosix.c   (props changed)
   head/emulators/open-vm-tools/files/patch-libguestlib-Makefile   (props changed)
   head/emulators/open-vm-tools/files/patch-modules-Makefile.in   (props changed)
   head/emulators/open-vm-tools/files/patch-net_compat.h   (props changed)
   head/emulators/open-vm-tools/files/patch-scripts-Makefile   (props changed)
   head/emulators/open-vm-tools/files/patch-scripts-network   (props changed)
   head/emulators/open-vm-tools/files/patch-services-Makefile   (props changed)
   head/emulators/open-vm-tools/files/patch-util_misc.c   (props changed)
   head/emulators/open-vm-tools/files/patch-vm_basic_types.h   (props changed)
   head/emulators/open-vm-tools/files/patch-vmblock-vnops.c   (props changed)
   head/emulators/open-vm-tools/files/patch-vmhgfs-Makefile   (props changed)
   head/emulators/open-vm-tools/files/patch-vmhgfs-kernelStubs.h   (props changed)
   head/emulators/open-vm-tools/files/patch-vmhgfs-state.c   (props changed)
   head/emulators/open-vm-tools/files/patch-vmhgfs-vnopscommon.c   (props changed)
   head/emulators/open-vm-tools/files/patch-vmtoolsd-Makefile.in   (props changed)
   head/emulators/open-vm-tools/files/patch-wrapper-Makefile.am   (props changed)
   head/emulators/open-vm-tools/files/pkg-message.in   (props changed)
   head/emulators/open-vm-tools/files/vmware-guestd.in   (props changed)
   head/emulators/open-vm-tools/files/vmware-kmod.in   (props changed)
   head/emulators/open-vm-tools/pkg-descr   (props changed)
   head/emulators/open-vm-tools/pkg-plist   (props changed)
 
 Modified: head/emulators/open-vm-tools/Makefile
 ==============================================================================
 --- head/emulators/open-vm-tools/Makefile	Sat Oct 19 14:39:12 2013	(r330877)
 +++ head/emulators/open-vm-tools/Makefile	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -3,7 +3,7 @@
  
  PORTNAME=		open-vm-tools
  PORTVERSION=		${BUILD_VER}
 -PORTREVISION=		3
 +PORTREVISION=		4
  PORTEPOCH=		1
  CATEGORIES=		emulators kld
  MASTER_SITES=		SF/${PORTNAME}/${PORTNAME}/stable-8.6.x
 @@ -21,6 +21,7 @@ BUILD_VER=		425873
  WRKSRC=			${WRKDIR}/open-vm-tools-${RELEASE_VER}-${BUILD_VER}
  GNU_CONFIGURE=		yes
  USES=			pkgconfig
 +USE_GNOME=		glib20
  USE_LDCONFIG=		yes
  CPPFLAGS+=		-Wno-deprecated-declarations
  
 @@ -28,26 +29,24 @@ SSP_UNSAFE=		kernel module does not supp
  
  CONFIGURE_ARGS+=	--without-procps --sysconfdir=${LOCALBASE}/etc
  .if defined(WITHOUT_X11)
 -LIB_DEPENDS+=		glib-2.0:${PORTSDIR}/devel/glib20
  CONFIGURE_ARGS+=	--without-x --without-gtk2 --without-gtkmm
  PLIST_SUB+=		X11="@comment "
  CONFLICTS=		open-vm-tools-[0-9]*
  .else
  .if !defined(WITHOUT_LIBNOTIFY)
 -LIB_DEPENDS+=		notify.4:${PORTSDIR}/devel/libnotify
 +LIB_DEPENDS+=		libnotify.so:${PORTSDIR}/devel/libnotify
  .endif
  .if defined(WITH_UNITY)
  CONFIGURE_ENV+=		CUSTOM_URIPARSER_CPPFLAGS="-I${LOCALBASE}/include/uriparser"
 -LIB_DEPENDS+=		uriparser.1:${PORTSDIR}/net/uriparser
 +LIB_DEPENDS+=		liburiparser.so:${PORTSDIR}/net/uriparser
  .else
  CONFIGURE_ARGS+=	--disable-unity
  .endif
 -LIB_DEPENDS+=		gtkmm-2.4:${PORTSDIR}/x11-toolkits/gtkmm24
  CONFIGURE_ARGS+=	--with-x
  LDFLAGS+=		-L${LOCALBASE}/lib
  USE_XORG=		x11 ice sm xext xineramaproto xinerama xrandr xrender \
  			xtst
 -USE_GNOME=		gtk20 glib20
 +USE_GNOME+=		gtk20 gtkmm24
  PLIST_SUB+=		X11=""
  CONFLICTS=		open-vm-tools-nox11-[0-9]*
  .endif
 @@ -65,13 +64,13 @@ SUB_FILES=		pkg-message
  .if defined(WITHOUT_DNET)
  CONFIGURE_ARGS+=	--without-dnet
  .else
 -LIB_DEPENDS+=		dnet:${PORTSDIR}/net/libdnet
 +LIB_DEPENDS+=		libdnet.so:${PORTSDIR}/net/libdnet
  .endif
  
  .if defined(WITHOUT_ICU)
  CONFIGURE_ARGS+=	--without-icu
  .else
 -LIB_DEPENDS+=		icuuc:${PORTSDIR}/devel/icu
 +LIB_DEPENDS+=		libicuuc.so:${PORTSDIR}/devel/icu
  .endif
  
  USE_RC_SUBR=		vmware-guestd vmware-kmod
 
 Added: head/emulators/open-vm-tools/files/patch-checkvm.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/emulators/open-vm-tools/files/patch-checkvm.c	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -0,0 +1,47 @@
 +--- checkvm/checkvm.c.orig
 ++++ checkvm/checkvm.c
 +@@ -56,7 +56,7 @@
 +     uint32       val
 + )
 + {
 +-  __asm__ volatile("out%L0 (%%dx)" : :"a" (val), "d" (port));
 ++  __asm__ volatile("outl %%eax, %%dx" : :"a" (val), "d" (port));
 + }
 + 
 + static __inline__ uint32
 +@@ -66,7 +66,7 @@
 + {
 +   uint32 ret;
 + 
 +-  __asm__ volatile("in%L0 (%%dx)" : "=a" (ret) : "d" (port));
 ++  __asm__ volatile("inl %%dx, %%eax" : "=a" (ret) : "d" (port));
 +   return ret;
 + }
 + 
 +@@ -79,7 +79,7 @@
 + {
 +    uint32 eax, ebx, ecx, edx;
 +    
 +-   __asm__ volatile("inl (%%dx)" :
 ++   __asm__ volatile("inl %%dx, %%eax" :
 +    	            "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
 + 		    "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETVERSION),
 + 		    "2"(BDOOR_PORT) : "memory");
 +@@ -96,7 +96,7 @@
 + {
 +    uint32 eax, ebx, ecx, edx;
 +    
 +-   __asm__ volatile("inl (%%dx)" :
 ++   __asm__ volatile("inl %%dx, %%eax" :
 +    	            "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
 + 		    "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETHWVERSION),
 + 		    "2"(BDOOR_PORT) : "memory");
 +@@ -112,7 +112,7 @@
 + {
 +    uint32 eax, ebx, ecx, edx;
 +    
 +-   __asm__ volatile("inl (%%dx)" :
 ++   __asm__ volatile("inl %%dx, %%eax" :
 +    		    "=a"(eax), "=c"(ecx), "=d"(edx), "=b"(ebx) :
 + 		    "0"(BDOOR_MAGIC), "1"(BDOOR_CMD_GETSCREENSIZE),
 + 		    "2"(BDOOR_PORT) : "memory");
 
 Added: head/emulators/open-vm-tools/files/patch-dndLinux.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/emulators/open-vm-tools/files/patch-dndLinux.c	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -0,0 +1,11 @@
 +--- services/plugins/dndcp/dnd/dndLinux.c.orig
 ++++ services/plugins/dndcp/dnd/dndLinux.c
 +@@ -455,7 +455,7 @@
 + DnD_CheckBlockFuse(int blockFd)                    // IN
 + {
 +    char buf[sizeof(VMBLOCK_FUSE_READ_RESPONSE)];
 +-   size_t size;
 ++   ssize_t size;
 + 
 +    size = read(blockFd, buf, sizeof(VMBLOCK_FUSE_READ_RESPONSE));
 +    if (size < 0) {
 
 Added: head/emulators/open-vm-tools/files/patch-hgfsProto.h
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/emulators/open-vm-tools/files/patch-hgfsProto.h	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -0,0 +1,22 @@
 +--- lib/include/hgfsProto.h.orig
 ++++ lib/include/hgfsProto.h
 +@@ -148,6 +148,9 @@
 +    HGFS_OP_SET_EAS_V4,            /* Add or modify extended attributes. */
 + 
 +    HGFS_OP_MAX,                   /* Dummy op, must be last in enum */
 ++
 ++/* If a V4 packet is being processed as a legacy packet it will have this opcode. */
 ++   HGFS_V4_LEGACY_OPCODE = 0xff,
 + } HgfsOp;
 + 
 + 
 +@@ -155,9 +158,6 @@
 + #define HGFS_VERSION_OLD           (1 << 0)
 + #define HGFS_VERSION_3             (1 << 1)
 + 
 +-/* If a V4 packet is being processed as a legacy packet it will have this opcode. */
 +-#define HGFS_V4_LEGACY_OPCODE      0xff
 +-
 + /* XXX: Needs change when VMCI is supported. */
 + #define HGFS_REQ_PAYLOAD_SIZE_V3(hgfsReq) (sizeof *hgfsReq + sizeof(HgfsRequest))
 + #define HGFS_REP_PAYLOAD_SIZE_V3(hgfsRep) (sizeof *hgfsRep + sizeof(HgfsReply))
 
 Added: head/emulators/open-vm-tools/files/patch-hgfsserver.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/emulators/open-vm-tools/files/patch-hgfsserver.c	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -0,0 +1,11 @@
 +--- lib/hgfsServer/hgfsServer.c.orig
 ++++ lib/hgfsServer/hgfsServer.c
 +@@ -3557,7 +3557,7 @@
 +     * delimiter on copy. Allow 0 length drives so that hidden feature "" can
 +     * work.
 +     */
 +-   if (pathLength < 0 || pathLength >= sizeof p.mountPoint) {
 ++   if (pathLength >= sizeof p.mountPoint) {
 +       LOG(4, ("%s: could not get the volume name\n", __FUNCTION__));
 + 
 +       return FALSE;
 
 Added: head/emulators/open-vm-tools/files/patch-hgfsserverlinux.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/emulators/open-vm-tools/files/patch-hgfsserverlinux.c	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -0,0 +1,11 @@
 +--- lib/hgfsServer/hgfsServerLinux.c.orig
 ++++ lib/hgfsServer/hgfsServerLinux.c
 +@@ -551,7 +551,7 @@
 + 
 +    arraySize = ARRAYSIZE(HgfsServerOpenFlags);
 + 
 +-   if (flagsIn < 0 || flagsIn >= arraySize) {
 ++   if (flagsIn >= arraySize) {
 +       Log("%s: Invalid HgfsOpenFlags %d\n", __FUNCTION__, flagsIn);
 + 
 +       return FALSE;
 
 Added: head/emulators/open-vm-tools/files/patch-vmblock-vfsops.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/emulators/open-vm-tools/files/patch-vmblock-vfsops.c	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -0,0 +1,11 @@
 +--- modules/freebsd/vmblock/vfsops.c.orig
 ++++ modules/freebsd/vmblock/vfsops.c
 +@@ -236,7 +236,7 @@
 +     */
 +    MNT_ILOCK(mp);
 +    mp->mnt_flag |= lowerrootvp->v_mount->mnt_flag & MNT_LOCAL;
 +-#if __FreeBSD_version >= 600000
 ++#if __FreeBSD_version >= 600000 && __FreeBSD_version < 1000021
 +    mp->mnt_kern_flag |= lowerrootvp->v_mount->mnt_kern_flag & MNTK_MPSAFE;
 + #endif
 +    MNT_IUNLOCK(mp);
 
 Added: head/emulators/open-vm-tools/files/patch-vmhgfs-os.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/emulators/open-vm-tools/files/patch-vmhgfs-os.c	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -0,0 +1,11 @@
 +--- modules/freebsd/vmhgfs/os.c.orig
 ++++ modules/freebsd/vmhgfs/os.c
 +@@ -647,7 +647,7 @@
 + 		 OS_THREAD_T *newThread)   // OUT
 + {
 +    return compat_kthread_create(function, parameter,
 +-                                newThread, 0, 0, threadName);
 ++                                newThread, 0, 0, "%s", threadName);
 + }
 + 
 + 
 
 Added: head/emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c
 ==============================================================================
 --- /dev/null	00:00:00 1970	(empty, because file is newly added)
 +++ head/emulators/open-vm-tools/files/patch-vmhgfs-vfsops.c	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -0,0 +1,12 @@
 +--- modules/freebsd/vmhgfs/vfsops.c.orig
 ++++ modules/freebsd/vmhgfs/vfsops.c
 +@@ -201,7 +201,9 @@
 +     * structures, not oplocks/leases with the VM's host.)
 +     */
 ++#if __FreeBSD_version < 1000021
 +    MNT_ILOCK(mp);
 +    mp->mnt_kern_flag |= MNTK_MPSAFE;
 +    MNT_IUNLOCK(mp);
 ++#endif
 + 
 +    /* Get a new unique filesystem ID */
 
 Modified: head/emulators/open-vm-tools/files/patch-vmmemctl-os.c
 ==============================================================================
 --- head/emulators/open-vm-tools/files/patch-vmmemctl-os.c	Sat Oct 19 14:39:12 2013	(r330877)
 +++ head/emulators/open-vm-tools/files/patch-vmmemctl-os.c	Sat Oct 19 14:39:55 2013	(r330878)
 @@ -1,12 +1,56 @@
 ---- modules/freebsd/vmmemctl/os.c.orig	2011-09-21 14:25:15.000000000 -0400
 -+++ modules/freebsd/vmmemctl/os.c	2012-06-20 09:44:40.434083000 -0400
 -@@ -344,12 +344,22 @@
 +--- modules/freebsd/vmmemctl/os.c.orig	2011-09-21 20:25:15.000000000 +0200
 ++++ modules/freebsd/vmmemctl/os.c	2013-10-19 11:01:27.000000000 +0200
 +@@ -37,9 +37,11 @@
 + #include <sys/param.h>
 + #include <sys/systm.h>
 + #include <sys/kernel.h>
 ++#include <sys/lock.h>
 + #include <sys/malloc.h>
 + #include <sys/module.h>
 + #include <sys/conf.h>
 ++#include <sys/rwlock.h>
 + #include <sys/sysctl.h>
 + 
 + #include <vm/vm.h>
 +@@ -264,14 +266,23 @@
 +    p->size = (p->size + sizeof(unsigned long) - 1) & 
 +                          ~(sizeof(unsigned long) - 1);
 + 
 ++#if __FreeBSD_version >= 1000042
 ++   p->bitmap = (unsigned long *)kmem_malloc(kernel_arena, p->size,
 ++                         M_WAITOK | M_ZERO);
 ++#else
 +    p->bitmap = (unsigned long *)kmem_alloc(kernel_map, p->size);
 ++#endif
 + }
 + 
 + 
 + static void
 + os_pmap_free(os_pmap *p) // IN
 + {
 ++#if __FreeBSD_version >= 1000042
 ++   kmem_free(kernel_arena, (vm_offset_t)p->bitmap, p->size);
 ++#else
 +    kmem_free(kernel_map, (vm_offset_t)p->bitmap, p->size);
 ++#endif
 +    p->size = 0;
 +    p->bitmap = NULL;
 + }
 +@@ -344,12 +355,31 @@
      os_state *state = &global_state;
      os_pmap *pmap = &state->pmap;
   
  -   if ( !vm_page_lookup(state->vmobject, page->pindex) ) {
  -      return;
 +-   }
 + 
 +-   os_pmap_putindex(pmap, page->pindex);
 +-   vm_page_free(page);
 ++#if __FreeBSD_version > 1000029
 ++   VM_OBJECT_WLOCK(state->vmobject);
 ++#else
  +   VM_OBJECT_LOCK(state->vmobject);
 ++#endif
  +   if ( vm_page_lookup(state->vmobject, page->pindex) ) {
  +   	os_pmap_putindex(pmap, page->pindex);
  +#if __FreeBSD_version >= 900000
 @@ -20,31 +64,44 @@
  +#else
  +	vm_page_unlock_queues();
  +#endif
 -    }
 --
 --   os_pmap_putindex(pmap, page->pindex);
 --   vm_page_free(page);
 ++   }
 ++#if __FreeBSD_version > 1000029
 ++   VM_OBJECT_WUNLOCK(state->vmobject);
 ++#else
  +   VM_OBJECT_UNLOCK(state->vmobject);
 ++#endif
   }
   
   
 -@@ -361,8 +371,11 @@
 +@@ -361,8 +391,19 @@
      os_state *state = &global_state;
      os_pmap *pmap = &state->pmap;
   
 ++#if __FreeBSD_version > 1000029
 ++   VM_OBJECT_WLOCK(state->vmobject);
 ++#else
  +   VM_OBJECT_LOCK(state->vmobject);
 ++#endif
  +
      pindex = os_pmap_getindex(pmap);
      if (pindex == (vm_pindex_t)-1) {
 ++#if __FreeBSD_version > 1000029
 ++      VM_OBJECT_WUNLOCK(state->vmobject);
 ++#else
  +      VM_OBJECT_UNLOCK(state->vmobject);
 ++#endif
         return NULL;
      }
   
 -@@ -383,6 +396,7 @@
 +@@ -383,6 +424,11 @@
      if (!page) {
         os_pmap_putindex(pmap, pindex);
      }
 ++#if __FreeBSD_version > 1000029
 ++   VM_OBJECT_WUNLOCK(state->vmobject);
 ++#else
  +   VM_OBJECT_UNLOCK(state->vmobject);
 ++#endif
   
      return page;
   }
 _______________________________________________
 svn-ports-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-ports-all
 To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
 
>Unformatted:
