Print this page
patch as-lock-macro-simplification

*** 1750,1771 **** * All other lwps have already stopped and are in an orderly state. */ ASSERT(p == ttoproc(curthread)); prstop(0, 0); ! AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER); nphdrs = prnsegs(as, 0) + 2; /* two CORE note sections */ /* * Count the number of section headers we're going to need. */ nshdrs = 0; if (content & (CC_CONTENT_CTF | CC_CONTENT_SYMTAB)) { (void) process_scns(content, p, credp, NULL, NULL, NULL, 0, NULL, &nshdrs); } ! AS_LOCK_EXIT(as, &as->a_lock); ASSERT(nshdrs == 0 || nshdrs > 1); /* * The core file contents may required zero section headers, but if --- 1750,1771 ---- * All other lwps have already stopped and are in an orderly state. */ ASSERT(p == ttoproc(curthread)); prstop(0, 0); ! AS_LOCK_ENTER(as, RW_WRITER); nphdrs = prnsegs(as, 0) + 2; /* two CORE note sections */ /* * Count the number of section headers we're going to need. */ nshdrs = 0; if (content & (CC_CONTENT_CTF | CC_CONTENT_SYMTAB)) { (void) process_scns(content, p, credp, NULL, NULL, NULL, 0, NULL, &nshdrs); } ! AS_LOCK_EXIT(as); ASSERT(nshdrs == 0 || nshdrs > 1); /* * The core file contents may required zero section headers, but if
*** 1877,1887 **** stkbase = p->p_usrstack - p->p_stksize; stksize = p->p_stksize; mutex_exit(&p->p_lock); ! AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER); 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; --- 1877,1887 ---- stkbase = p->p_usrstack - p->p_stksize; stksize = p->p_stksize; mutex_exit(&p->p_lock); ! AS_LOCK_ENTER(as, RW_WRITER); 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;
*** 1977,1987 **** exclude: i++; } ASSERT(tmp == NULL); } ! AS_LOCK_EXIT(as, &as->a_lock); if (overflow || i != nphdrs) { if (ntries++ == 0) { kmem_free(bigwad, bigsize); overflow = 0; --- 1977,1987 ---- exclude: i++; } ASSERT(tmp == NULL); } ! AS_LOCK_EXIT(as); if (overflow || i != nphdrs) { if (ntries++ == 0) { kmem_free(bigwad, bigsize); overflow = 0;
*** 2126,2143 **** if (nphdrs >= PN_XNUM) bigwad->shdr[0].sh_info = nphdrs; if (nshdrs > 1) { ! AS_LOCK_ENTER(as, &as->a_lock, RW_WRITER); if ((error = process_scns(content, p, credp, vp, &bigwad->shdr[0], nshdrs, rlimit, &doffset, NULL)) != 0) { ! AS_LOCK_EXIT(as, &as->a_lock); goto done; } ! AS_LOCK_EXIT(as, &as->a_lock); } if ((error = core_write(vp, UIO_SYSSPACE, soffset, &bigwad->shdr[0], shdrsz, rlimit, credp)) != 0) goto done; --- 2126,2143 ---- if (nphdrs >= PN_XNUM) bigwad->shdr[0].sh_info = nphdrs; if (nshdrs > 1) { ! AS_LOCK_ENTER(as, RW_WRITER); if ((error = process_scns(content, p, credp, vp, &bigwad->shdr[0], nshdrs, rlimit, &doffset, NULL)) != 0) { ! AS_LOCK_EXIT(as); goto done; } ! AS_LOCK_EXIT(as); } if ((error = core_write(vp, UIO_SYSSPACE, soffset, &bigwad->shdr[0], shdrsz, rlimit, credp)) != 0) goto done;