Print this page
patch lower-case-segops

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/proc/prioctl.c
          +++ new/usr/src/uts/common/fs/proc/prioctl.c
↓ open down ↓ 3138 lines elided ↑ open up ↑
3139 3139                   * space lock in order to avoid a deadlock with
3140 3140                   * the clock thread.  The process will not
3141 3141                   * disappear and its address space will not
3142 3142                   * change because it is marked P_PR_LOCK.
3143 3143                   */
3144 3144                  mutex_exit(&p->p_lock);
3145 3145                  AS_LOCK_ENTER(as, &as->a_lock, RW_READER);
3146 3146                  seg = as_segat(as, va);
3147 3147                  if (seg != NULL &&
3148 3148                      seg->s_ops == &segvn_ops &&
3149      -                    SEGOP_GETVP(seg, va, &xvp) == 0 &&
     3149 +                    segop_getvp(seg, va, &xvp) == 0 &&
3150 3150                      xvp != NULL &&
3151 3151                      xvp->v_type == VREG) {
3152 3152                          VN_HOLD(xvp);
3153 3153                  } else {
3154 3154                          error = EINVAL;
3155 3155                  }
3156 3156                  AS_LOCK_EXIT(as, &as->a_lock);
3157 3157                  mutex_enter(&p->p_lock);
3158 3158          } else if ((xvp = p->p_exec) == NULL) {
3159 3159                  error = EINVAL;
↓ open down ↓ 384 lines elided ↑ open up ↑
3544 3544  
3545 3545                  for (saddr = seg->s_base; saddr < eaddr; saddr = naddr) {
3546 3546                          prot = pr_getprot(seg, 0, &tmp, &saddr, &naddr, eaddr);
3547 3547                          if (saddr == naddr)
3548 3548                                  continue;
3549 3549  
3550 3550                          mp = pr_iol_newbuf(iolhead, sizeof (*mp));
3551 3551  
3552 3552                          mp->pr_vaddr = saddr;
3553 3553                          mp->pr_size = naddr - saddr;
3554      -                        mp->pr_off = SEGOP_GETOFFSET(seg, saddr);
     3554 +                        mp->pr_off = segop_getoffset(seg, saddr);
3555 3555                          mp->pr_mflags = 0;
3556 3556                          if (prot & PROT_READ)
3557 3557                                  mp->pr_mflags |= MA_READ;
3558 3558                          if (prot & PROT_WRITE)
3559 3559                                  mp->pr_mflags |= MA_WRITE;
3560 3560                          if (prot & PROT_EXEC)
3561 3561                                  mp->pr_mflags |= MA_EXEC;
3562      -                        if (SEGOP_GETTYPE(seg, saddr) & MAP_SHARED)
     3562 +                        if (segop_gettype(seg, saddr) & MAP_SHARED)
3563 3563                                  mp->pr_mflags |= MA_SHARED;
3564 3564                          if (seg == brkseg)
3565 3565                                  mp->pr_mflags |= MA_BREAK;
3566 3566                          else if (seg == stkseg)
3567 3567                                  mp->pr_mflags |= MA_STACK;
3568 3568                          mp->pr_pagesize = PAGESIZE;
3569 3569                  }
3570 3570                  ASSERT(tmp == NULL);
3571 3571          } while ((seg = AS_SEGNEXT(as, seg)) != NULL);
3572 3572  
↓ open down ↓ 31 lines elided ↑ open up ↑
3604 3604  
3605 3605                  for (saddr = seg->s_base; saddr < eaddr; saddr = naddr) {
3606 3606                          prot = pr_getprot(seg, 0, &tmp, &saddr, &naddr, eaddr);
3607 3607                          if (saddr == naddr)
3608 3608                                  continue;
3609 3609  
3610 3610                          mp = pr_iol_newbuf(iolhead, sizeof (*mp));
3611 3611  
3612 3612                          mp->pr_vaddr = (caddr32_t)(uintptr_t)saddr;
3613 3613                          mp->pr_size = (size32_t)(naddr - saddr);
3614      -                        mp->pr_off = (off32_t)SEGOP_GETOFFSET(seg, saddr);
     3614 +                        mp->pr_off = (off32_t)segop_getoffset(seg, saddr);
3615 3615                          mp->pr_mflags = 0;
3616 3616                          if (prot & PROT_READ)
3617 3617                                  mp->pr_mflags |= MA_READ;
3618 3618                          if (prot & PROT_WRITE)
3619 3619                                  mp->pr_mflags |= MA_WRITE;
3620 3620                          if (prot & PROT_EXEC)
3621 3621                                  mp->pr_mflags |= MA_EXEC;
3622      -                        if (SEGOP_GETTYPE(seg, saddr) & MAP_SHARED)
     3622 +                        if (segop_gettype(seg, saddr) & MAP_SHARED)
3623 3623                                  mp->pr_mflags |= MA_SHARED;
3624 3624                          if (seg == brkseg)
3625 3625                                  mp->pr_mflags |= MA_BREAK;
3626 3626                          else if (seg == stkseg)
3627 3627                                  mp->pr_mflags |= MA_STACK;
3628 3628                          mp->pr_pagesize = PAGESIZE;
3629 3629                  }
3630 3630                  ASSERT(tmp == NULL);
3631 3631          } while ((seg = AS_SEGNEXT(as, seg)) != NULL);
3632 3632  
↓ open down ↓ 113 lines elided ↑ open up ↑
3746 3746                                  continue;
3747 3747                          npage = len / PAGESIZE;
3748 3748                          next = (uintptr_t)(pmp + 1) + roundlong(npage);
3749 3749                          /*
3750 3750                           * It's possible that the address space can change
3751 3751                           * subtlely even though we're holding as->a_lock
3752 3752                           * due to the nondeterminism of page_exists() in
3753 3753                           * the presence of asychronously flushed pages or
3754 3754                           * mapped files whose sizes are changing.
3755 3755                           * page_exists() may be called indirectly from
3756      -                         * pr_getprot() by a SEGOP_INCORE() routine.
     3756 +                         * pr_getprot() by a segop_incore() routine.
3757 3757                           * If this happens we need to make sure we don't
3758 3758                           * overrun the buffer whose size we computed based
3759 3759                           * on the initial iteration through the segments.
3760 3760                           * Once we've detected an overflow, we need to clean
3761 3761                           * up the temporary memory allocated in pr_getprot()
3762 3762                           * and retry. If there's a pending signal, we return
3763 3763                           * EINTR so that this thread can be dislodged if
3764 3764                           * a latent bug causes us to spin indefinitely.
3765 3765                           */
3766 3766                          if (next > (uintptr_t)buf + size) {
↓ open down ↓ 5 lines elided ↑ open up ↑
3772 3772                                  if (ISSIG(curthread, JUSTLOOKING))
3773 3773                                          return (EINTR);
3774 3774  
3775 3775                                  goto again;
3776 3776                          }
3777 3777  
3778 3778                          php->pr_nmap++;
3779 3779                          php->pr_npage += npage;
3780 3780                          pmp->pr_vaddr = saddr;
3781 3781                          pmp->pr_npage = npage;
3782      -                        pmp->pr_off = SEGOP_GETOFFSET(seg, saddr);
     3782 +                        pmp->pr_off = segop_getoffset(seg, saddr);
3783 3783                          pmp->pr_mflags = 0;
3784 3784                          if (prot & PROT_READ)
3785 3785                                  pmp->pr_mflags |= MA_READ;
3786 3786                          if (prot & PROT_WRITE)
3787 3787                                  pmp->pr_mflags |= MA_WRITE;
3788 3788                          if (prot & PROT_EXEC)
3789 3789                                  pmp->pr_mflags |= MA_EXEC;
3790      -                        if (SEGOP_GETTYPE(seg, saddr) & MAP_SHARED)
     3790 +                        if (segop_gettype(seg, saddr) & MAP_SHARED)
3791 3791                                  pmp->pr_mflags |= MA_SHARED;
3792 3792                          pmp->pr_pagesize = PAGESIZE;
3793 3793                          hat_getstat(as, saddr, len, hatid,
3794 3794                              (char *)(pmp + 1), HAT_SYNC_ZERORM);
3795 3795                          pmp = (prasmap_t *)next;
3796 3796                  }
3797 3797                  ASSERT(tmp == NULL);
3798 3798          } while ((seg = AS_SEGNEXT(as, seg)) != NULL);
3799 3799  
3800 3800          AS_LOCK_EXIT(as, &as->a_lock);
↓ open down ↓ 52 lines elided ↑ open up ↑
3853 3853                                  continue;
3854 3854                          npage = len / PAGESIZE;
3855 3855                          next = (uintptr_t)(pmp + 1) + round4(npage);
3856 3856                          /*
3857 3857                           * It's possible that the address space can change
3858 3858                           * subtlely even though we're holding as->a_lock
3859 3859                           * due to the nondeterminism of page_exists() in
3860 3860                           * the presence of asychronously flushed pages or
3861 3861                           * mapped files whose sizes are changing.
3862 3862                           * page_exists() may be called indirectly from
3863      -                         * pr_getprot() by a SEGOP_INCORE() routine.
     3863 +                         * pr_getprot() by a segop_incore() routine.
3864 3864                           * If this happens we need to make sure we don't
3865 3865                           * overrun the buffer whose size we computed based
3866 3866                           * on the initial iteration through the segments.
3867 3867                           * Once we've detected an overflow, we need to clean
3868 3868                           * up the temporary memory allocated in pr_getprot()
3869 3869                           * and retry. If there's a pending signal, we return
3870 3870                           * EINTR so that this thread can be dislodged if
3871 3871                           * a latent bug causes us to spin indefinitely.
3872 3872                           */
3873 3873                          if (next > (uintptr_t)buf + size) {
↓ open down ↓ 5 lines elided ↑ open up ↑
3879 3879                                  if (ISSIG(curthread, JUSTLOOKING))
3880 3880                                          return (EINTR);
3881 3881  
3882 3882                                  goto again;
3883 3883                          }
3884 3884  
3885 3885                          php->pr_nmap++;
3886 3886                          php->pr_npage += npage;
3887 3887                          pmp->pr_vaddr = (uint32_t)(uintptr_t)saddr;
3888 3888                          pmp->pr_npage = (uint32_t)npage;
3889      -                        pmp->pr_off = (int32_t)SEGOP_GETOFFSET(seg, saddr);
     3889 +                        pmp->pr_off = (int32_t)segop_getoffset(seg, saddr);
3890 3890                          pmp->pr_mflags = 0;
3891 3891                          if (prot & PROT_READ)
3892 3892                                  pmp->pr_mflags |= MA_READ;
3893 3893                          if (prot & PROT_WRITE)
3894 3894                                  pmp->pr_mflags |= MA_WRITE;
3895 3895                          if (prot & PROT_EXEC)
3896 3896                                  pmp->pr_mflags |= MA_EXEC;
3897      -                        if (SEGOP_GETTYPE(seg, saddr) & MAP_SHARED)
     3897 +                        if (segop_gettype(seg, saddr) & MAP_SHARED)
3898 3898                                  pmp->pr_mflags |= MA_SHARED;
3899 3899                          pmp->pr_pagesize = PAGESIZE;
3900 3900                          hat_getstat(as, saddr, len, hatid,
3901 3901                              (char *)(pmp + 1), HAT_SYNC_ZERORM);
3902 3902                          pmp = (ioc_prasmap32_t *)next;
3903 3903                  }
3904 3904                  ASSERT(tmp == NULL);
3905 3905          } while ((seg = AS_SEGNEXT(as, seg)) != NULL);
3906 3906  
3907 3907          AS_LOCK_EXIT(as, &as->a_lock);
↓ open down ↓ 31 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX