Print this page
const-ify make segment ops structures
There is no reason to keep the segment ops structures writable.
patch lower-case-segops
*** 1481,1491 ****
* care about the actual size of the segment so we use the
* reserved size. If the segment's size is zero, there's
* something fishy going on so we ignore this segment.
*/
if (seg->s_ops != &segvn_ops ||
! SEGOP_GETVP(seg, seg->s_base, &mvp) != 0 ||
mvp == lastvp || mvp == NULL || mvp->v_type != VREG ||
(segsize = pr_getsegsize(seg, 1)) == 0)
continue;
eaddr = saddr + segsize;
--- 1481,1491 ----
* care about the actual size of the segment so we use the
* reserved size. If the segment's size is zero, there's
* something fishy going on so we ignore this segment.
*/
if (seg->s_ops != &segvn_ops ||
! segop_getvp(seg, seg->s_base, &mvp) != 0 ||
mvp == lastvp || mvp == NULL || mvp->v_type != VREG ||
(segsize = pr_getsegsize(seg, 1)) == 0)
continue;
eaddr = saddr + segsize;
*** 1883,1893 ****
i = 2;
for (seg = AS_SEGFIRST(as); seg != NULL; seg = AS_SEGNEXT(as, seg)) {
caddr_t eaddr = seg->s_base + pr_getsegsize(seg, 0);
caddr_t saddr, naddr;
void *tmp = NULL;
! extern struct seg_ops segspt_shmops;
for (saddr = seg->s_base; saddr < eaddr; saddr = naddr) {
uint_t prot;
size_t size;
int type;
--- 1883,1893 ----
i = 2;
for (seg = AS_SEGFIRST(as); seg != NULL; seg = AS_SEGNEXT(as, seg)) {
caddr_t eaddr = seg->s_base + pr_getsegsize(seg, 0);
caddr_t saddr, naddr;
void *tmp = NULL;
! extern const struct seg_ops segspt_shmops;
for (saddr = seg->s_base; saddr < eaddr; saddr = naddr) {
uint_t prot;
size_t size;
int type;
*** 1912,1922 ****
v[i].p_flags |= PF_X;
/*
* Figure out which mappings to include in the core.
*/
! type = SEGOP_GETTYPE(seg, saddr);
if (saddr == stkbase && size == stksize) {
if (!(content & CC_CONTENT_STACK))
goto exclude;
--- 1912,1922 ----
v[i].p_flags |= PF_X;
/*
* Figure out which mappings to include in the core.
*/
! type = segop_gettype(seg, saddr);
if (saddr == stkbase && size == stksize) {
if (!(content & CC_CONTENT_STACK))
goto exclude;
*** 1939,1960 ****
} else if (type & MAP_SHARED) {
if (shmgetid(p, saddr) != SHMID_NONE) {
if (!(content & CC_CONTENT_SHM))
goto exclude;
! } else if (SEGOP_GETVP(seg, seg->s_base,
&mvp) != 0 || mvp == NULL ||
mvp->v_type != VREG) {
if (!(content & CC_CONTENT_SHANON))
goto exclude;
} else {
if (!(content & CC_CONTENT_SHFILE))
goto exclude;
}
! } else if (SEGOP_GETVP(seg, seg->s_base, &mvp) != 0 ||
mvp == NULL || mvp->v_type != VREG) {
if (!(content & CC_CONTENT_ANON))
goto exclude;
} else if (prot == (PROT_READ | PROT_EXEC)) {
--- 1939,1960 ----
} else if (type & MAP_SHARED) {
if (shmgetid(p, saddr) != SHMID_NONE) {
if (!(content & CC_CONTENT_SHM))
goto exclude;
! } else if (segop_getvp(seg, seg->s_base,
&mvp) != 0 || mvp == NULL ||
mvp->v_type != VREG) {
if (!(content & CC_CONTENT_SHANON))
goto exclude;
} else {
if (!(content & CC_CONTENT_SHFILE))
goto exclude;
}
! } else if (segop_getvp(seg, seg->s_base, &mvp) != 0 ||
mvp == NULL || mvp->v_type != VREG) {
if (!(content & CC_CONTENT_ANON))
goto exclude;
} else if (prot == (PROT_READ | PROT_EXEC)) {