projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed bug in 2.6 caused by bizarre semantics of .am directive
[unix-history]
/
usr
/
src
/
sys
/
kern
/
kern_proc.c
diff --git
a/usr/src/sys/kern/kern_proc.c
b/usr/src/sys/kern/kern_proc.c
index
22a7a27
..
879bd93
100644
(file)
--- a/
usr/src/sys/kern/kern_proc.c
+++ b/
usr/src/sys/kern/kern_proc.c
@@
-1,4
+1,4
@@
-/* kern_proc.c 3.
1
1 %G% */
+/* kern_proc.c 3.
2
1 %G% */
#include "../h/param.h"
#include "../h/systm.h"
#include "../h/param.h"
#include "../h/systm.h"
@@
-17,6
+17,8
@@
#include "../h/vm.h"
#include "../h/text.h"
#include "../h/psl.h"
#include "../h/vm.h"
#include "../h/text.h"
#include "../h/psl.h"
+#include "../h/vlimit.h"
+#include "../h/file.h"
/*
* exec system call, with and without environments.
/*
* exec system call, with and without environments.
@@
-61,7
+63,7
@@
exece()
ne = 0;
nc = 0;
uap = (struct execa *)u.u_ap;
ne = 0;
nc = 0;
uap = (struct execa *)u.u_ap;
- if ((bno = malloc(
swap
map, ctod(clrnd((int) btoc(NCARGS))))) == 0) {
+ if ((bno = malloc(
arg
map, ctod(clrnd((int) btoc(NCARGS))))) == 0) {
swkill(u.u_procp, "exece");
goto bad;
}
swkill(u.u_procp, "exece");
goto bad;
}
@@
-99,8
+101,8
@@
exece()
if ((nc&BMASK) == 0) {
if (bp)
bdwrite(bp);
if ((nc&BMASK) == 0) {
if (bp)
bdwrite(bp);
- bp = getblk(
swap
dev,
- (daddr_t)(dbtofsb(
swplo+
bno)+(nc>>BSHIFT)));
+ bp = getblk(
arg
dev,
+ (daddr_t)(dbtofsb(bno)+(nc>>BSHIFT)));
cp = bp->b_un.b_addr;
}
nc++;
cp = bp->b_un.b_addr;
}
nc++;
@@
-114,7
+116,7
@@
exece()
if (getxfile(ip, nc) || u.u_error) {
badarg:
for (c = 0; c < nc; c += BSIZE)
if (getxfile(ip, nc) || u.u_error) {
badarg:
for (c = 0; c < nc; c += BSIZE)
- if (bp = baddr(
swapdev, dbtofsb(swplo+
bno)+(c>>BSHIFT))) {
+ if (bp = baddr(
argdev, dbtofsb(
bno)+(c>>BSHIFT))) {
bp->b_flags |= B_AGE; /* throw away */
bp->b_flags &= ~B_DELWRI; /* cancel io */
brelse(bp);
bp->b_flags |= B_AGE; /* throw away */
bp->b_flags &= ~B_DELWRI; /* cancel io */
brelse(bp);
@@
-145,8
+147,8
@@
badarg:
if ((nc&BMASK) == 0) {
if (bp)
brelse(bp);
if ((nc&BMASK) == 0) {
if (bp)
brelse(bp);
- bp = bread(
swap
dev,
- (daddr_t)(dbtofsb(
swplo+
bno)+(nc>>BSHIFT)));
+ bp = bread(
arg
dev,
+ (daddr_t)(dbtofsb(bno)+(nc>>BSHIFT)));
bp->b_flags |= B_AGE; /* throw away */
bp->b_flags &= ~B_DELWRI; /* cancel io */
cp = bp->b_un.b_addr;
bp->b_flags |= B_AGE; /* throw away */
bp->b_flags &= ~B_DELWRI; /* cancel io */
cp = bp->b_un.b_addr;
@@
-162,7
+164,7
@@
bad:
if (bp)
brelse(bp);
if (bno)
if (bp)
brelse(bp);
if (bno)
- mfree(
swap
map, ctod(clrnd((int) btoc(NCARGS))), bno);
+ mfree(
arg
map, ctod(clrnd((int) btoc(NCARGS))), bno);
iput(ip);
}
iput(ip);
}
@@
-176,7
+178,7
@@
register struct inode *ip;
{
register sep;
register size_t ts, ds, ss;
{
register sep;
register size_t ts, ds, ss;
-
register
int overlay;
+ int overlay;
int pagi = 0;
/*
int pagi = 0;
/*
@@
-241,8
+243,13
@@
register struct inode *ip;
goto bad;
}
if(u.u_exdata.ux_tsize!=0 && (ip->i_flag&ITEXT)==0 && ip->i_count!=1) {
goto bad;
}
if(u.u_exdata.ux_tsize!=0 && (ip->i_flag&ITEXT)==0 && ip->i_count!=1) {
- u.u_error = ETXTBSY;
- goto bad;
+ register struct file *fp;
+
+ for (fp = file; fp < &file[NFILE]; fp++)
+ if (fp->f_inode == ip && (fp->f_flag&FWRITE)) {
+ u.u_error = ETXTBSY;
+ goto bad;
+ }
}
/*
}
/*
@@
-315,7
+322,7
@@
register struct inode *ip;
1 + ts/CLSIZE, (int)btoc(u.u_exdata.ux_dsize));
/* THIS SHOULD BE DONE AT A LOWER LEVEL, IF AT ALL */
1 + ts/CLSIZE, (int)btoc(u.u_exdata.ux_dsize));
/* THIS SHOULD BE DONE AT A LOWER LEVEL, IF AT ALL */
- mtpr(TBIA,
1
);
+ mtpr(TBIA,
0
);
/*
* set SUID/SGID protections, if no tracing
/*
* set SUID/SGID protections, if no tracing
@@
-439,7
+446,6
@@
exit(rv)
else
p->p_siga1 = 0;
(void) spl0();
else
p->p_siga1 = 0;
(void) spl0();
- rate.v_pgin -= p->p_aveflt;
p->p_aveflt = 0;
for(i=0; i<NSIG; i++)
u.u_signal[i] = SIG_IGN;
p->p_aveflt = 0;
for(i=0; i<NSIG; i++)
u.u_signal[i] = SIG_IGN;
@@
-468,11
+474,13
@@
exit(rv)
plock(u.u_rdir);
iput(u.u_rdir);
}
plock(u.u_rdir);
iput(u.u_rdir);
}
+ u.u_limit[LIM_FSIZE] = INFINITY;
acct();
vrelpt(u.u_procp);
vrelu(u.u_procp, 0);
multprog--;
acct();
vrelpt(u.u_procp);
vrelu(u.u_procp, 0);
multprog--;
- spl7(); /* clock will get mad because of overlaying */
+/* spl7(); /* clock will get mad because of overlaying */
+ noproc = 1;
p->p_stat = SZOMB;
i = PIDHASH(p->p_pid);
x = p - proc;
p->p_stat = SZOMB;
i = PIDHASH(p->p_pid);
x = p - proc;
@@
-498,7
+506,7
@@
done:
/*
* Traced processes are killed
* since their existence means someone is screwing up.
/*
* Traced processes are killed
* since their existence means someone is screwing up.
- *
Trac
ed processes are sent a hangup and a continue.
+ *
Stopp
ed processes are sent a hangup and a continue.
* This is designed to be ``safe'' for setuid
* processes since they must be willing to tolerate
* hangups anyways.
* This is designed to be ``safe'' for setuid
* processes since they must be willing to tolerate
* hangups anyways.
@@
-512,11
+520,10
@@
done:
}
/*
* Protect this process from future
}
/*
* Protect this process from future
- * tty signals, and clear TSTP/TTIN/TTOU if pending.
+ * tty signals, clear TSTP/TTIN/TTOU if pending,
+ * and set SDETACH bit on procs.
*/
*/
- q->p_pgrp = q->p_pid;
-#define bit(a) (1<<(a-1))
- q->p_sig &= ~(bit(SIGTSTP)|bit(SIGTTIN)|bit(SIGTTOU));
+ spgrp(q, -1);
}
wakeup((caddr_t)p->p_pptr);
psignal(p->p_pptr, SIGCHLD);
}
wakeup((caddr_t)p->p_pptr);
psignal(p->p_pptr, SIGCHLD);
@@
-685,6
+692,10
@@
sbreak()
if (n < 0)
n = 0;
d = clrnd(n - u.u_dsize);
if (n < 0)
n = 0;
d = clrnd(n - u.u_dsize);
+ if (ctob(u.u_dsize+d) > u.u_limit[LIM_DATA]) {
+ u.u_error = ENOMEM;
+ return;
+ }
if (chksize(u.u_tsize, u.u_dsize+d, u.u_ssize))
return;
if (swpexpand(u.u_dsize+d, u.u_ssize, &u.u_dmap, &u.u_smap)==0)
if (chksize(u.u_tsize, u.u_dsize+d, u.u_ssize))
return;
if (swpexpand(u.u_dsize+d, u.u_ssize, &u.u_dmap, &u.u_smap)==0)