SCCS-vsn: sys/kern/kern_sig.c 7.19
SCCS-vsn: sys/kern/kern_exit.c 7.22
#include "param.h"
#include "systm.h"
#include "map.h"
#include "param.h"
#include "systm.h"
#include "map.h"
+#include "ioctl.h"
+#include "tty.h"
+#undef RETURN
+#include "syscontext.h"
#include "kernel.h"
#include "proc.h"
#include "buf.h"
#include "kernel.h"
#include "proc.h"
#include "buf.h"
#include "vm.h"
#include "file.h"
#include "vnode.h"
#include "vm.h"
#include "file.h"
#include "vnode.h"
-#include "ioctl.h"
-#include "tty.h"
#include "syslog.h"
#include "malloc.h"
#include "syslog.h"
#include "malloc.h"
/*
* Exit system call: pass back caller's arg
*/
/*
* Exit system call: pass back caller's arg
*/
+/* ARGSUSED */
+rexit(p, uap, retval)
+ struct proc *p;
+ struct args {
- uap = (struct a *)u.u_ap;
- exit(W_EXITCODE(uap->rval, 0));
+ RETURN (exit(p, W_EXITCODE(uap->rval, 0)));
* Wake up parent and init processes,
* and dispose of children.
*/
* Wake up parent and init processes,
* and dispose of children.
*/
+exit(p, rv)
+ struct proc *p;
int rv;
{
register int i;
int rv;
{
register int i;
- register struct proc *p, *q, *nq;
+ register struct proc *q, *nq;
register struct proc **pp;
#ifdef PGINPROF
vmsizmon();
#endif
register struct proc **pp;
#ifdef PGINPROF
vmsizmon();
#endif
MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage),
M_ZOMBIE, M_WAITOK);
p->p_flag &= ~(STRC|SULOCK);
MALLOC(p->p_ru, struct rusage *, sizeof(struct rusage),
M_ZOMBIE, M_WAITOK);
p->p_flag &= ~(STRC|SULOCK);
if ((p->p_flag & SVFORK) == 0) {
#ifdef MAPMEM
if (u.u_mmap)
if ((p->p_flag & SVFORK) == 0) {
#ifdef MAPMEM
if (u.u_mmap)
#endif
vrelvm();
} else {
#endif
vrelvm();
} else {
* using the pages which are about to be freed...
* vrelu will block memory allocation by raising ipl.
*/
* using the pages which are about to be freed...
* vrelu will block memory allocation by raising ipl.
*/
- vrelu(u.u_procp, 0);
- vrelpt(u.u_procp);
+ vrelu(p, 0);
+ vrelpt(p);
if (*p->p_prev = p->p_nxt) /* off allproc queue */
p->p_nxt->p_prev = p->p_prev;
if (p->p_nxt = zombproc) /* onto zombproc */
if (*p->p_prev = p->p_nxt) /* off allproc queue */
p->p_nxt->p_prev = p->p_prev;
if (p->p_nxt = zombproc) /* onto zombproc */
-owait()
-{
- register struct a {
+owait(p, uap, retval)
+ struct proc *p;
+ register struct args {
int pid;
int *status;
int options;
struct rusage *rusage;
int compat;
int pid;
int *status;
int options;
struct rusage *rusage;
int compat;
- } *uap = (struct a *)u.u_ap;
+ } *uap;
+ int *retval;
+{
if ((u.u_ar0[PS] & PSL_ALLCC) != PSL_ALLCC) {
uap->options = 0;
if ((u.u_ar0[PS] & PSL_ALLCC) != PSL_ALLCC) {
uap->options = 0;
uap->pid = WAIT_ANY;
uap->status = 0;
uap->compat = 1;
uap->pid = WAIT_ANY;
uap->status = 0;
uap->compat = 1;
+ RETURN (wait1(p, uap, retval));
-wait4()
-{
- register struct a {
+wait4(p, uap, retval)
+ struct proc *p;
+ struct args {
int pid;
int *status;
int options;
struct rusage *rusage;
int compat;
int pid;
int *status;
int options;
struct rusage *rusage;
int compat;
- } *uap = (struct a *)u.u_ap;
+ } *uap;
+ int *retval;
+{
+ RETURN (wait1(p, uap, retval));
}
#else
#define wait1 wait4
}
#else
#define wait1 wait4
* Look also for stopped (traced) children,
* and pass back status from them.
*/
* Look also for stopped (traced) children,
* and pass back status from them.
*/
-wait1()
-{
- register struct a {
+wait1(q, uap, retval)
+ register struct proc *q;
+ register struct args {
int pid;
int *status;
int options;
int pid;
int *status;
int options;
#ifdef COMPAT_43
int compat;
#endif
#ifdef COMPAT_43
int compat;
#endif
- } *uap = (struct a *)u.u_ap;
- register f;
- register struct proc *p, *q;
+ } *uap;
+ int retval[];
+{
+ register int f;
+ register struct proc *p;
if (uap->pid == 0)
uap->pid = -q->p_pgid;
#ifdef notyet
if (uap->options &~ (WUNTRACED|WNOHANG))
if (uap->pid == 0)
uap->pid = -q->p_pgid;
#ifdef notyet
if (uap->options &~ (WUNTRACED|WNOHANG))
continue;
f++;
if (p->p_stat == SZOMB) {
continue;
f++;
if (p->p_stat == SZOMB) {
- u.u_r.r_val1 = p->p_pid;
#ifdef COMPAT_43
if (uap->compat)
#ifdef COMPAT_43
if (uap->compat)
- u.u_r.r_val2 = p->p_xstat;
+ retval[1] = p->p_xstat;
else
#endif
if (uap->status) {
status = p->p_xstat; /* convert to int */
if (error = copyout((caddr_t)&status,
(caddr_t)uap->status, sizeof(status)))
else
#endif
if (uap->status) {
status = p->p_xstat; /* convert to int */
if (error = copyout((caddr_t)&status,
(caddr_t)uap->status, sizeof(status)))
}
if (uap->rusage && (error = copyout((caddr_t)p->p_ru,
(caddr_t)uap->rusage, sizeof (struct rusage))))
}
if (uap->rusage && (error = copyout((caddr_t)p->p_ru,
(caddr_t)uap->rusage, sizeof (struct rusage))))
pgrm(p); /* off pgrp */
p->p_xstat = 0;
ruadd(&u.u_cru, p->p_ru);
pgrm(p); /* off pgrp */
p->p_xstat = 0;
ruadd(&u.u_cru, p->p_ru);
p->p_flag = 0;
p->p_wchan = 0;
p->p_cursig = 0;
p->p_flag = 0;
p->p_wchan = 0;
p->p_cursig = 0;
}
if (p->p_stat == SSTOP && (p->p_flag & SWTED) == 0 &&
(p->p_flag & STRC || uap->options & WUNTRACED)) {
p->p_flag |= SWTED;
}
if (p->p_stat == SSTOP && (p->p_flag & SWTED) == 0 &&
(p->p_flag & STRC || uap->options & WUNTRACED)) {
p->p_flag |= SWTED;
- u.u_r.r_val1 = p->p_pid;
#ifdef COMPAT_43
if (uap->compat) {
#ifdef COMPAT_43
if (uap->compat) {
- u.u_r.r_val2 = W_STOPCODE(p->p_cursig);
+ retval[1] = W_STOPCODE(p->p_cursig);
(caddr_t)uap->status, sizeof(status));
} else
error = 0;
(caddr_t)uap->status, sizeof(status));
} else
error = 0;
if (uap->options & WNOHANG) {
if (uap->options & WNOHANG) {
- u.u_r.r_val1 = 0;
- return (0);
+ retval[0] = 0;
+ RETURN (0);
- if (error = tsleep((caddr_t)u.u_procp, PWAIT | PCATCH, "wait", 0))
- return (error);
+ if (error = tsleep((caddr_t)q, PWAIT | PCATCH, "wait", 0))
+ RETURN (error);
- register struct proc *p;
+ register struct proc *p = u.u_procp; /* XXX */
for (;;) {
mask = p->p_sig &~ p->p_sigmask;
if (p->p_flag&SVFORK)
for (;;) {
mask = p->p_sig &~ p->p_sigmask;
if (p->p_flag&SVFORK)
- } while (!procxmt() && p->p_flag&STRC);
+ } while (!procxmt(p) && p->p_flag&STRC);
/*
* If the traced bit got turned off,
/*
* If the traced bit got turned off,
if (core() == 0)
sig |= WCOREFLAG;
}
if (core() == 0)
sig |= WCOREFLAG;
}
- exit(W_EXITCODE(0, sig));
+ exit(p, W_EXITCODE(0, sig));
/* NOTREACHED */
} while (sig = CURSIG(p));
}
/* NOTREACHED */
} while (sig = CURSIG(p));
}
return (EFAULT);
}
#ifdef MAPMEM
return (EFAULT);
}
#ifdef MAPMEM
+ if (error = mmcore(p)) {
+ vput(vp);
+ return (error);
+ }
#endif
VATTR_NULL(&vattr);
vattr.va_size = 0;
#endif
VATTR_NULL(&vattr);
vattr.va_size = 0;