- if(u.u_exdata.ux_tsize!=0 && (ip->i_flag&ITEXT)==0 && ip->i_count!=1) {
- register struct file *fp;
-
- for (fp = file; fp < fileNFILE; fp++)
- if (fp->f_inode == ip && (fp->f_flag&FWRITE)) {
- u.u_error = ETXTBSY;
- goto bad;
- }
- }
-
- /*
- * find text and data sizes
- * try them out for possible
- * exceed of max sizes
- */
-
- ts = clrnd(btoc(u.u_exdata.ux_tsize));
- ds = clrnd(btoc((u.u_exdata.ux_dsize+u.u_exdata.ux_bsize)));
- ss = clrnd(SSIZE + btoc(nargc));
- if (chksize(ts, ds, ss))
- goto bad;
- u.u_cdmap = zdmap;
- u.u_csmap = zdmap;
- if (swpexpand(ds, ss, &u.u_cdmap, &u.u_csmap) == NULL)
- goto bad;
-
- /*
- * At this point, committed to the new image!
- * Release virtual memory resources of old process, and
- * initialize the virtual memory of the new process.
- * If we resulted from vfork(), instead wakeup our
- * parent who will set SVFDONE when he has taken back
- * our resources.
- */
- u.u_prof.pr_scale = 0;
- if ((u.u_procp->p_flag & SVFORK) == 0)
- vrelvm();
- else {
- u.u_procp->p_flag &= ~SVFORK;
- u.u_procp->p_flag |= SKEEP;
- wakeup((caddr_t)u.u_procp);
- while ((u.u_procp->p_flag & SVFDONE) == 0)
- sleep((caddr_t)u.u_procp, PZERO - 1);
- u.u_procp->p_flag &= ~(SVFDONE|SKEEP);
- }
- u.u_procp->p_flag &= ~(SPAGI|SSEQL|SUANOM|SNUSIG);
- u.u_procp->p_flag |= pagi;
- u.u_dmap = u.u_cdmap;
- u.u_smap = u.u_csmap;
- vgetvm(ts, ds, ss);
-
- if (pagi == 0) {
- /*
- * Read in data segment.
- */
- u.u_base = (char *)ctob(ts);
- u.u_offset = sizeof(u.u_exdata)+u.u_exdata.ux_tsize;
- u.u_count = u.u_exdata.ux_dsize;
- readi(ip);
- }
- xalloc(ip, pagi);
- if (pagi && u.u_procp->p_textp)
- vinifod((struct fpte *)dptopte(u.u_procp, 0),
- PG_FTEXT, u.u_procp->p_textp->x_iptr,
- 1 + ts/CLSIZE, (int)btoc(u.u_exdata.ux_dsize));
-
- /* THIS SHOULD BE DONE AT A LOWER LEVEL, IF AT ALL */
- mtpr(TBIA, 0);
-
- /*
- * set SUID/SGID protections, if no tracing
- */
- if ((u.u_procp->p_flag&STRC)==0) {
-#ifndef MELB
- if(u.u_uid != 0)
-#endif
- {
- u.u_uid = uid;
- u.u_procp->p_uid = uid;
- }
- u.u_gid = gid;
- } else
- psignal(u.u_procp, SIGTRAP);
- u.u_tsize = ts;
- u.u_dsize = ds;
- u.u_ssize = ss;
-bad:
- return;