-/* kern_proc.c 4.3 %G% */
+/* kern_proc.c 4.8 %G% */
#include "../h/param.h"
#include "../h/systm.h"
again:
if(access(ip, IEXEC))
goto bad;
+ if((u.u_procp->p_flag&STRC) && access(ip, IREAD))
+ goto bad;
if((ip->i_mode & IFMT) != IFREG ||
(ip->i_mode & (IEXEC|(IEXEC>>3)|(IEXEC>>6))) == 0) {
u.u_error = EACCES;
ne = 0;
nc = 0;
uap = (struct execa *)u.u_ap;
- if ((bno = malloc(argmap, ctod(clrnd((int) btoc(NCARGS))))) == 0) {
+ if ((bno = rmalloc(argmap, ctod(clrnd((int) btoc(NCARGS))))) == 0) {
swkill(u.u_procp, "exece");
goto bad;
}
if (bno % CLSIZE)
- panic("execa malloc");
+ panic("execa rmalloc");
if (uap->argp) for (;;) {
ap = NULL;
if (na == 1 && indir) {
if (bp)
brelse(bp);
if (bno)
- mfree(argmap, ctod(clrnd((int) btoc(NCARGS))), bno);
+ rmfree(argmap, ctod(clrnd((int) btoc(NCARGS))), bno);
iput(ip);
}
if(u.u_exdata.ux_tsize!=0 && (ip->i_flag&ITEXT)==0 && ip->i_count!=1) {
register struct file *fp;
- for (fp = file; fp < &file[NFILE]; fp++)
+ for (fp = file; fp < fileNFILE; fp++)
if (fp->f_inode == ip && (fp->f_flag&FWRITE)) {
u.u_error = ETXTBSY;
goto bad;
{
register int (**rp)();
register i;
+#ifdef UCBIPC
+ register struct port *pt;
+#endif UCBIPC
long sigmask;
for(rp = &u.u_signal[0], sigmask = 1L; rp < &u.u_signal[NSIG];
u.u_ar0[PC] = u.u_exdata.ux_entloc + 2; /* skip over entry mask */
for(i=0; i<NOFILE; i++) {
if (u.u_pofile[i]&EXCLOSE) {
+#ifndef UCBIPC
closef(u.u_ofile[i]);
u.u_ofile[i] = NULL;
+#else UCBIPC
+ if (u.u_pofile[i]&ISPORT) {
+ pt = u.u_oport[i];
+ if (--pt->pt_count == 0)
+ ptclose(pt);
+ u.u_pofile[i] &= ~ISPORT;
+ u.u_oport[i] = NULL;
+ } else {
+ closef(u.u_ofile[i]);
+ u.u_ofile[i] = NULL;
+ }
+#endif UCBIPC
u.u_pofile[i] &= ~EXCLOSE;
}
}
register int i;
register struct proc *p, *q;
register struct file *f;
+#ifdef UCBIPC
+ register struct port *pt;
+#endif UCBIPC
register int x;
#ifdef PGINPROF
p->p_flag &= ~SVFDONE;
}
for(i=0; i<NOFILE; i++) {
+#ifndef UCBIPC
f = u.u_ofile[i];
u.u_ofile[i] = NULL;
closef(f);
+#else UCBIPC
+ if (u.u_pofile[i]&ISPORT) {
+ pt = u.u_oport[i];
+ if (--pt->pt_count == 0)
+ ptclose(pt);
+ u.u_oport[i] = NULL;
+ } else {
+ f = u.u_ofile[i];
+ u.u_ofile[i] = NULL;
+ closef(f);
+ }
+#endif UCBIPC
}
plock(u.u_cdir);
iput(u.u_cdir);
((struct xproc *)p)->xp_xstat = rv; /* overlay */
((struct xproc *)p)->xp_vm = u.u_vm; /* overlay */
vmsadd(&((struct xproc *)p)->xp_vm, &u.u_cvm);
- for(q = &proc[0]; q < &proc[NPROC]; q++)
+ for(q = proc; q < procNPROC; q++)
if(q->p_pptr == p) {
q->p_pptr = &proc[1];
q->p_ppid = 1;
f = 0;
loop:
- for(p = &proc[0]; p < &proc[NPROC]; p++)
+ for(p = proc; p < procNPROC; p++)
if(p->p_pptr == u.u_procp) {
f++;
if(p->p_stat == SZOMB) {
a = 0;
p2 = NULL;
- for(p1 = &proc[0]; p1 < &proc[NPROC]; p1++) {
+ for(p1 = proc; p1 < procNPROC; p1++) {
if (p1->p_stat==NULL && p2==NULL)
p2 = p1;
else {
a++;
}
}
-
/*
* Disallow if
* No processes at all;
* not su and too many procs owned; or
* not su and would take last slot.
*/
- if (p2==NULL || (u.u_uid!=0 && (p2>=&proc[NPROC-5] || a>MAXUPRC))) {
+ if (p2==NULL || (u.u_uid!=0 && (p2==procNPROC-1 || a>MAXUPRC))) {
u.u_error = EAGAIN;
if (!isvfork) {
(void) vsexpand(0, &u.u_cdmap, 1);