From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 14 10:34:51 2006 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5FE8F16A474; Wed, 14 Jun 2006 10:34:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from fw.zoral.com.ua (ll-227.216.82.212.sovam.net.ua [212.82.216.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2BC3043D78; Wed, 14 Jun 2006 10:34:34 +0000 (GMT) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by fw.zoral.com.ua (8.13.4/8.13.4) with ESMTP id k5EAYMcd054892 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 14 Jun 2006 13:34:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.13.6/8.13.6) with ESMTP id k5EAYMcN032711; Wed, 14 Jun 2006 13:34:22 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.13.6/8.13.6/Submit) id k5EAYLo7032710; Wed, 14 Jun 2006 13:34:21 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 14 Jun 2006 13:34:20 +0300 From: Konstantin Belousov To: Bruno Haible Message-ID: <20060614103420.GA86300@deviant.kiev.zoral.com.ua> References: <200606101822.46437.bruno@clisp.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="x+6KMIRAuhnl3hBn" Content-Disposition: inline In-Reply-To: <200606101822.46437.bruno@clisp.org> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: ClamAV version 0.88.2, clamav-milter version 0.88.2 on fw.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.3 X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on fw.zoral.com.ua Cc: Vasil Dimov , hackers@freebsd.org Subject: Re: valid VMA ranges and mincore() X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jun 2006 10:34:51 -0000 --x+6KMIRAuhnl3hBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Jun 10, 2006 at 06:22:46PM +0200, Bruno Haible wrote: > Proposal 1: Change mincore() to behave like the one on NetBSD, Linux, > Solaris. Please, evaluate the patch. If it does what you need, I will push it for review. Index: vm_mmap.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /usr/local/arch/ncvs/src/sys/vm/vm_mmap.c,v retrieving revision 1.205 diff -u -r1.205 vm_mmap.c --- vm_mmap.c 21 Apr 2006 07:17:25 -0000 1.205 +++ vm_mmap.c 14 Jun 2006 10:32:11 -0000 @@ -907,6 +907,40 @@ ++lastvecindex; } =20 + /* Mark unmapped areas of the queried address + * space with -1. + */ + for (addr =3D first_addr; addr < end; ) { + vm_offset_t saddr, eaddr; + + vm_map_lock_read(map); + if (vm_map_lookup_entry(map, addr, &entry)) { + addr =3D entry->end; + vm_map_unlock_read(map); + continue; + } + entry =3D entry->next; + if (entry->start < addr) { + /* past the last entry in the map */ + saddr =3D eaddr =3D end; + } else { + saddr =3D entry->start; + eaddr =3D entry->end; + } + vm_map_unlock_read(map); + + while (addr < saddr) { + vecindex =3D OFF_TO_IDX(addr - first_addr); + error =3D subyte(vec + vecindex, -1); + if (error) { + error =3D EFAULT; + goto done2; + } + addr +=3D PAGE_SIZE; + } + addr =3D eaddr; + } + /* * If the map has changed, due to the subyte, the previous * output may be invalid. --x+6KMIRAuhnl3hBn Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (FreeBSD) iD8DBQFEj+YsC3+MBN1Mb4gRAllsAJ9tTfcBapLXj9FhxrMu+Thz9Ia4VQCg21YU W8evbRThZZeWi827tB6T61g= =YmSo -----END PGP SIGNATURE----- --x+6KMIRAuhnl3hBn--