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
Berkeley copyright
[unix-history]
/
usr
/
src
/
sys
/
kern
/
kern_fork.c
diff --git
a/usr/src/sys/kern/kern_fork.c
b/usr/src/sys/kern/kern_fork.c
index
c483432
..
d6e2f1c
100644
(file)
--- a/
usr/src/sys/kern/kern_fork.c
+++ b/
usr/src/sys/kern/kern_fork.c
@@
-1,23
+1,29
@@
-/* kern_fork.c 6.2 84/05/22 */
+/*
+ * Copyright (c) 1982, 1986 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ * @(#)kern_fork.c 7.3 (Berkeley) %G%
+ */
#include "../machine/reg.h"
#include "../machine/pte.h"
#include "../machine/psl.h"
#include "../machine/reg.h"
#include "../machine/pte.h"
#include "../machine/psl.h"
-#include "
../h/
param.h"
-#include "
../h/
systm.h"
-#include "
../h/
map.h"
-#include "
../h/
dir.h"
-#include "
../h/
user.h"
-#include "
../h/
kernel.h"
-#include "
../h/
proc.h"
-#include "
../h/
inode.h"
-#include "
../h/
seg.h"
-#include "
../h/
vm.h"
-#include "
../h/
text.h"
-#include "
../h/
file.h"
-#include "
../h/
acct.h"
-#include "
../h/
quota.h"
+#include "param.h"
+#include "systm.h"
+#include "map.h"
+#include "dir.h"
+#include "user.h"
+#include "kernel.h"
+#include "proc.h"
+#include "inode.h"
+#include "seg.h"
+#include "vm.h"
+#include "text.h"
+#include "file.h"
+#include "acct.h"
+#include "quota.h"
/*
* fork system call.
/*
* fork system call.
@@
-67,8
+73,8
@@
fork1(isvfork)
if (p2==NULL || (u.u_uid!=0 && (p2->p_nxt == NULL || a>MAXUPRC))) {
u.u_error = EAGAIN;
if (!isvfork) {
if (p2==NULL || (u.u_uid!=0 && (p2->p_nxt == NULL || a>MAXUPRC))) {
u.u_error = EAGAIN;
if (!isvfork) {
- (void) vsexpand(0, &u.u_cdmap, 1);
- (void) vsexpand(0, &u.u_csmap, 1);
+ (void) vsexpand(
(size_t)
0, &u.u_cdmap, 1);
+ (void) vsexpand(
(size_t)
0, &u.u_csmap, 1);
}
goto out;
}
}
goto out;
}
@@
-76,7
+82,7
@@
fork1(isvfork)
if (newproc(isvfork)) {
u.u_r.r_val1 = p1->p_pid;
u.u_r.r_val2 = 1; /* child */
if (newproc(isvfork)) {
u.u_r.r_val1 = p1->p_pid;
u.u_r.r_val2 = 1; /* child */
- u.u_start = time
.tv_sec
;
+ u.u_start = time;
u.u_acflag = AFORK;
return;
}
u.u_acflag = AFORK;
return;
}
@@
-113,6
+119,7
@@
retry:
}
if (mpid >= pidchecked) {
int doingzomb = 0;
}
if (mpid >= pidchecked) {
int doingzomb = 0;
+
pidchecked = 30000;
/*
* Scan the proc table to check whether this pid
pidchecked = 30000;
/*
* Scan the proc table to check whether this pid
@@
-122,15
+129,16
@@
retry:
rpp = allproc;
again:
for (; rpp != NULL; rpp = rpp->p_nxt) {
rpp = allproc;
again:
for (; rpp != NULL; rpp = rpp->p_nxt) {
- if (rpp->p_pid
==mpid || rpp->p_pgrp==
mpid) {
+ if (rpp->p_pid
== mpid || rpp->p_pgrp->pg_id ==
mpid) {
mpid++;
if (mpid >= pidchecked)
goto retry;
}
mpid++;
if (mpid >= pidchecked)
goto retry;
}
- if (
(rpp->p_pid > mpid) && (pidchecked > rpp->p_pid)
)
+ if (
rpp->p_pid > mpid && pidchecked > rpp->p_pid
)
pidchecked = rpp->p_pid;
pidchecked = rpp->p_pid;
- if ((rpp->p_pgrp > mpid) && (pidchecked > rpp->p_pgrp))
- pidchecked = rpp->p_pgrp;
+ if (rpp->p_pgrp->pg_id > mpid &&
+ pidchecked > rpp->p_pgrp->pg_id)
+ pidchecked = rpp->p_pgrp->pg_id;
}
if (!doingzomb) {
doingzomb = 1;
}
if (!doingzomb) {
doingzomb = 1;
@@
-154,6
+162,10
@@
again:
#ifdef QUOTA
rpp->p_quota = rip->p_quota;
rpp->p_quota->q_cnt++;
#ifdef QUOTA
rpp->p_quota = rip->p_quota;
rpp->p_quota->q_cnt++;
+#endif
+#if defined(tahoe)
+ rpp->p_ckey = rip->p_ckey;
+ rpp->p_dkey = 0;
#endif
rpp->p_stat = SIDL;
timerclear(&rpp->p_realtimer.it_value);
#endif
rpp->p_stat = SIDL;
timerclear(&rpp->p_realtimer.it_value);
@@
-165,6
+177,8
@@
again:
rpp->p_ndx = rpp - proc;
rpp->p_uid = rip->p_uid;
rpp->p_pgrp = rip->p_pgrp;
rpp->p_ndx = rpp - proc;
rpp->p_uid = rip->p_uid;
rpp->p_pgrp = rip->p_pgrp;
+ rpp->p_pgrpnxt = rip->p_pgrpnxt;
+ rip->p_pgrpnxt = rpp;
rpp->p_nice = rip->p_nice;
rpp->p_textp = isvfork ? 0 : rip->p_textp;
rpp->p_pid = mpid;
rpp->p_nice = rip->p_nice;
rpp->p_textp = isvfork ? 0 : rip->p_textp;
rpp->p_pid = mpid;
@@
-209,7
+223,7
@@
again:
/*
* Increase reference counts on shared objects.
*/
/*
* Increase reference counts on shared objects.
*/
- for (n = 0; n <
NOFILE
; n++) {
+ for (n = 0; n <
= u.u_lastfile
; n++) {
fp = u.u_ofile[n];
if (fp == NULL)
continue;
fp = u.u_ofile[n];
if (fp == NULL)
continue;
@@
-230,7
+244,7
@@
again:
/*
* Make child runnable and add to run queue.
*/
/*
* Make child runnable and add to run queue.
*/
- (void) spl
6
();
+ (void) spl
clock
();
rpp->p_stat = SRUN;
setrq(rpp);
(void) spl0();
rpp->p_stat = SRUN;
setrq(rpp);
(void) spl0();