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
clean up stream flow control, give correct name for accept;
[unix-history]
/
usr
/
src
/
sys
/
kern
/
kern_exit.c
diff --git
a/usr/src/sys/kern/kern_exit.c
b/usr/src/sys/kern/kern_exit.c
index
2435042
..
8cf160b
100644
(file)
--- a/
usr/src/sys/kern/kern_exit.c
+++ b/
usr/src/sys/kern/kern_exit.c
@@
-1,4
+1,10
@@
-/* kern_exit.c 6.6 85/03/12 */
+/*
+ * Copyright (c) 1982 Regents of the University of California.
+ * All rights reserved. The Berkeley software License Agreement
+ * specifies the terms and conditions for redistribution.
+ *
+ * @(#)kern_exit.c 6.11 (Berkeley) %G%
+ */
#include "../machine/reg.h"
#include "../machine/psl.h"
#include "../machine/reg.h"
#include "../machine/psl.h"
@@
-16,6
+22,7
@@
#include "file.h"
#include "mbuf.h"
#include "inode.h"
#include "file.h"
#include "mbuf.h"
#include "inode.h"
+#include "syslog.h"
/*
* Exit system call: pass back caller's arg
/*
* Exit system call: pass back caller's arg
@@
-71,13
+78,15
@@
exit(rv)
sleep((caddr_t)p, PZERO - 1);
p->p_flag &= ~SVFDONE;
}
sleep((caddr_t)p, PZERO - 1);
p->p_flag &= ~SVFDONE;
}
- for (i = 0; i <
NOFILE
; i++) {
+ for (i = 0; i <
= u.u_lastfile
; i++) {
struct file *f;
f = u.u_ofile[i];
struct file *f;
f = u.u_ofile[i];
- u.u_ofile[i] = NULL;
- u.u_pofile[i] = 0;
- closef(f);
+ if (f) {
+ u.u_ofile[i] = NULL;
+ u.u_pofile[i] = 0;
+ closef(f);
+ }
}
ilock(u.u_cdir);
iput(u.u_cdir);
}
ilock(u.u_cdir);
iput(u.u_cdir);
@@
-114,12
+123,16
@@
exit(rv)
}
panic("exit");
}
}
panic("exit");
}
- if (p->p_pid == 1)
- panic("init died");
+ if (p->p_pid == 1) {
+ if (p->p_dsize == 0) {
+ printf("Can't exec /etc/init\n");
+ for (;;)
+ ;
+ } else
+ panic("init died");
+ }
done:
p->p_xstat = rv;
done:
p->p_xstat = rv;
-if (m == 0)
-panic("exit: m_getclr");
p->p_ru = mtod(m, struct rusage *);
*p->p_ru = u.u_ru;
ruadd(p->p_ru, &u.u_cru);
p->p_ru = mtod(m, struct rusage *);
*p->p_ru = u.u_ru;
ruadd(p->p_ru, &u.u_cru);
@@
-156,7
+169,7
@@
panic("exit: m_getclr");
* Protect this process from future
* tty signals, clear TSTP/TTIN/TTOU if pending.
*/
* Protect this process from future
* tty signals, clear TSTP/TTIN/TTOU if pending.
*/
- (void) spgrp(q
, -1
);
+ (void) spgrp(q);
}
p->p_cptr = NULL;
psignal(p->p_pptr, SIGCHLD);
}
p->p_cptr = NULL;
psignal(p->p_pptr, SIGCHLD);
@@
-204,11
+217,13
@@
loop:
u.u_r.r_val1 = p->p_pid;
u.u_r.r_val2 = p->p_xstat;
p->p_xstat = 0;
u.u_r.r_val1 = p->p_pid;
u.u_r.r_val2 = p->p_xstat;
p->p_xstat = 0;
- if (ru)
+ if (ru
&& p->p_ru
)
*ru = *p->p_ru;
*ru = *p->p_ru;
- ruadd(&u.u_cru, p->p_ru);
- (void) m_free(dtom(p->p_ru));
- p->p_ru = 0;
+ if (p->p_ru) {
+ ruadd(&u.u_cru, p->p_ru);
+ (void) m_free(dtom(p->p_ru));
+ p->p_ru = 0;
+ }
p->p_stat = NULL;
p->p_pid = 0;
p->p_ppid = 0;
p->p_stat = NULL;
p->p_pid = 0;
p->p_ppid = 0;
@@
-252,8
+267,7
@@
loop:
}
if (setjmp(&u.u_qsave)) {
p = u.u_procp;
}
if (setjmp(&u.u_qsave)) {
p = u.u_procp;
- if ((u.u_sigintr & sigmask(p->p_cursig)) != 0 ||
- (p->p_flag & SOUSIG) != 0)
+ if ((u.u_sigintr & sigmask(p->p_cursig)) != 0)
return(EINTR);
u.u_eosys = RESTARTSYS;
return (0);
return(EINTR);
u.u_eosys = RESTARTSYS;
return (0);