From owner-svn-src-stable-10@FreeBSD.ORG Sat Apr 4 07:52:14 2015 Return-Path: Delivered-To: svn-src-stable-10@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 00882E5D; Sat, 4 Apr 2015 07:52:13 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DF2F065D; Sat, 4 Apr 2015 07:52:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t347qDQA093146; Sat, 4 Apr 2015 07:52:13 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t347qDbI093145; Sat, 4 Apr 2015 07:52:13 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201504040752.t347qDbI093145@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 4 Apr 2015 07:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r281064 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 04 Apr 2015 07:52:14 -0000 Author: kib Date: Sat Apr 4 07:52:12 2015 New Revision: 281064 URL: https://svnweb.freebsd.org/changeset/base/281064 Log: MFC r258056 (by alc): Eliminate the gratuitous use of mmap(2) flags from the implementation of kern_shmat(). Use a simpler approach to determine whether to pass VMFS_NO_SPACE or VMFS_OPTIMAL_SPACE to vm_map_find(). Modified: stable/10/sys/kern/sysv_shm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/sysv_shm.c ============================================================================== --- stable/10/sys/kern/sysv_shm.c Sat Apr 4 06:24:03 2015 (r281063) +++ stable/10/sys/kern/sysv_shm.c Sat Apr 4 07:52:12 2015 (r281064) @@ -342,7 +342,7 @@ kern_shmat(td, shmid, shmaddr, shmflg) int shmflg; { struct proc *p = td->td_proc; - int i, flags; + int i; struct shmid_kernel *shmseg; struct shmmap_state *shmmap_s = NULL; vm_offset_t attach_va; @@ -402,9 +402,7 @@ kern_shmat(td, shmid, shmaddr, shmflg) prot = VM_PROT_READ; if ((shmflg & SHM_RDONLY) == 0) prot |= VM_PROT_WRITE; - flags = MAP_ANON | MAP_SHARED; if (shmaddr) { - flags |= MAP_FIXED; if (shmflg & SHM_RND) { attach_va = (vm_offset_t)shmaddr & ~(SHMLBA-1); } else if (((vm_offset_t)shmaddr & (SHMLBA-1)) == 0) { @@ -426,7 +424,7 @@ kern_shmat(td, shmid, shmaddr, shmflg) vm_object_reference(shmseg->object); rv = vm_map_find(&p->p_vmspace->vm_map, shmseg->object, - 0, &attach_va, size, 0, (flags & MAP_FIXED) ? VMFS_NO_SPACE : + 0, &attach_va, size, 0, shmaddr != NULL ? VMFS_NO_SPACE : VMFS_OPTIMAL_SPACE, prot, prot, MAP_INHERIT_SHARE); if (rv != KERN_SUCCESS) { vm_object_deallocate(shmseg->object);