Print this page
patch lower-case-segops


  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 
  23 /*
  24  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  29 /*        All Rights Reserved   */
  30 
  31 
  32 #pragma ident   "%Z%%M% %I%     %E% SMI"
  33 
  34 #include <sys/param.h>
  35 #include <sys/inttypes.h>
  36 #include <sys/types.h>
  37 #include <sys/sysmacros.h>
  38 #include <sys/systm.h>
  39 #include <sys/user.h>
  40 #include <sys/errno.h>
  41 #include <sys/vfs.h>
  42 #include <sys/vnode.h>
  43 #include <sys/file.h>
  44 #include <sys/proc.h>
  45 #include <sys/session.h>
  46 #include <sys/var.h>
  47 #include <sys/utsname.h>
  48 #include <sys/utssys.h>
  49 #include <sys/ustat.h>
  50 #include <sys/statvfs.h>
  51 #include <sys/kmem.h>
  52 #include <sys/debug.h>
  53 #include <sys/pathname.h>


 525                 /* Now we can drop p_lock again */
 526                 mutex_exit(&prp->p_lock);
 527 
 528                 /*
 529                  * now we want to walk a processes memory mappings.
 530                  * to do this we need to grab the prp->p_as lock.  (you
 531                  * can't hold p_lock when grabbing the prp->p_as lock.)
 532                  */
 533                 if (prp->p_as != &kas) {
 534                         struct seg      *seg;
 535                         struct as       *as = prp->p_as;
 536 
 537                         AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
 538                         for (seg = AS_SEGFIRST(as); seg;
 539                             seg = AS_SEGNEXT(as, seg)) {
 540                                 /*
 541                                  * if we can't get a backing vnode for this
 542                                  * segment then skip it
 543                                  */
 544                                 vp = NULL;
 545                                 if ((SEGOP_GETVP(seg, seg->s_base, &vp)) ||
 546                                     (vp == NULL))
 547                                         continue;
 548 
 549                                 /*
 550                                  * if the target file (fvp) is not a device
 551                                  * and corrosponds to the root of a filesystem
 552                                  * (cvfsp), then check if it contains the
 553                                  * vnode backing this segment (vp).
 554                                  */
 555                                 if (contained && (vp->v_vfsp == cvfsp)) {
 556                                         use_flag |= F_MAP;
 557                                         break;
 558                                 }
 559 
 560                                 /*
 561                                  * if the target file (fvp) is not a device,
 562                                  * check if it matches the the vnode backing
 563                                  * this segment (vp).
 564                                  */
 565                                 if (!fvp_isdev && VN_CMP(fvp, vp)) {




  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 
  23 /*
  24  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
  25  * Use is subject to license terms.
  26  */
  27 
  28 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  29 /*        All Rights Reserved   */
  30 
  31 


  32 #include <sys/param.h>
  33 #include <sys/inttypes.h>
  34 #include <sys/types.h>
  35 #include <sys/sysmacros.h>
  36 #include <sys/systm.h>
  37 #include <sys/user.h>
  38 #include <sys/errno.h>
  39 #include <sys/vfs.h>
  40 #include <sys/vnode.h>
  41 #include <sys/file.h>
  42 #include <sys/proc.h>
  43 #include <sys/session.h>
  44 #include <sys/var.h>
  45 #include <sys/utsname.h>
  46 #include <sys/utssys.h>
  47 #include <sys/ustat.h>
  48 #include <sys/statvfs.h>
  49 #include <sys/kmem.h>
  50 #include <sys/debug.h>
  51 #include <sys/pathname.h>


 523                 /* Now we can drop p_lock again */
 524                 mutex_exit(&prp->p_lock);
 525 
 526                 /*
 527                  * now we want to walk a processes memory mappings.
 528                  * to do this we need to grab the prp->p_as lock.  (you
 529                  * can't hold p_lock when grabbing the prp->p_as lock.)
 530                  */
 531                 if (prp->p_as != &kas) {
 532                         struct seg      *seg;
 533                         struct as       *as = prp->p_as;
 534 
 535                         AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
 536                         for (seg = AS_SEGFIRST(as); seg;
 537                             seg = AS_SEGNEXT(as, seg)) {
 538                                 /*
 539                                  * if we can't get a backing vnode for this
 540                                  * segment then skip it
 541                                  */
 542                                 vp = NULL;
 543                                 if ((segop_getvp(seg, seg->s_base, &vp)) ||
 544                                     (vp == NULL))
 545                                         continue;
 546 
 547                                 /*
 548                                  * if the target file (fvp) is not a device
 549                                  * and corrosponds to the root of a filesystem
 550                                  * (cvfsp), then check if it contains the
 551                                  * vnode backing this segment (vp).
 552                                  */
 553                                 if (contained && (vp->v_vfsp == cvfsp)) {
 554                                         use_flag |= F_MAP;
 555                                         break;
 556                                 }
 557 
 558                                 /*
 559                                  * if the target file (fvp) is not a device,
 560                                  * check if it matches the the vnode backing
 561                                  * this segment (vp).
 562                                  */
 563                                 if (!fvp_isdev && VN_CMP(fvp, vp)) {