Improved killproc() log message and made it and the other similar message
tolerant of p_ucred being invalid. Starting using killproc() where appropriate.
This commit is contained in:
parent
66bb81b8ee
commit
d31b06efba
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_sig.c 8.7 (Berkeley) 4/18/94
|
||||
* $Id: kern_sig.c,v 1.16 1995/12/14 08:31:32 phk Exp $
|
||||
* $Id: kern_sig.c,v 1.17 1996/01/03 21:42:09 wollman Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
@ -73,8 +73,6 @@
|
||||
|
||||
static int coredump __P((struct proc *p));
|
||||
static int killpg1 __P((struct proc *cp, int signum, int pgid, int all));
|
||||
/* XXX killproc may be a supported interface, but it isn't used anywhere... */
|
||||
static void killproc __P((struct proc *p, char *why));
|
||||
static void stop __P((struct proc *));
|
||||
|
||||
/*
|
||||
@ -1150,9 +1148,8 @@ killproc(p, why)
|
||||
struct proc *p;
|
||||
char *why;
|
||||
{
|
||||
|
||||
log(LOG_ERR, "pid %d was killed: %s\n", p->p_pid, why);
|
||||
uprintf("sorry, pid %d was killed: %s\n", p->p_pid, why);
|
||||
log(LOG_ERR, "pid %d (%s), uid %d, was killed: %s\n", p->p_pid, p->p_comm,
|
||||
p->p_cred && p->p_ucred ? p->p_ucred->cr_uid : -1, why);
|
||||
psignal(p, SIGKILL);
|
||||
}
|
||||
|
||||
@ -1179,8 +1176,10 @@ sigexit(p, signum)
|
||||
* these messages.)
|
||||
* XXX : Todo, as well as euid, write out ruid too
|
||||
*/
|
||||
log(LOG_INFO, "pid %d: %s: uid %d: exited on signal %d\n",
|
||||
p->p_pid, p->p_comm, p->p_ucred->cr_uid, signum);
|
||||
log(LOG_INFO, "pid %d (%s), uid %d: exited on signal %d\n",
|
||||
p->p_pid, p->p_comm,
|
||||
p->p_cred && p->p_ucred ? p->p_ucred->cr_uid : -1,
|
||||
signum);
|
||||
if (coredump(p) == 0)
|
||||
signum |= WCOREFLAG;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_synch.c 8.6 (Berkeley) 1/21/94
|
||||
* $Id: kern_synch.c,v 1.16 1995/12/07 12:46:51 davidg Exp $
|
||||
* $Id: kern_synch.c,v 1.17 1996/01/03 21:42:12 wollman Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ktrace.h"
|
||||
@ -586,7 +586,7 @@ mi_switch()
|
||||
rlim = &p->p_rlimit[RLIMIT_CPU];
|
||||
if (s >= rlim->rlim_cur) {
|
||||
if (s >= rlim->rlim_max)
|
||||
psignal(p, SIGKILL);
|
||||
killproc(p, "exceeded maximum CPU limit");
|
||||
else {
|
||||
psignal(p, SIGXCPU);
|
||||
if (rlim->rlim_cur < rlim->rlim_max)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)signalvar.h 8.3 (Berkeley) 1/4/94
|
||||
* $Id: signalvar.h,v 1.7 1995/11/19 00:51:29 bde Exp $
|
||||
* $Id: signalvar.h,v 1.8 1995/12/14 08:32:34 phk Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SIGNALVAR_H_ /* tmp for user.h */
|
||||
@ -154,9 +154,10 @@ static int sigprop[NSIG + 1] = {
|
||||
void execsigs __P((struct proc *p));
|
||||
void gsignal __P((int pgid, int sig));
|
||||
int issig __P((struct proc *p));
|
||||
int issignal __P((struct proc *p));
|
||||
void killproc __P((struct proc *, char *));
|
||||
void pgsignal __P((struct pgrp *pgrp, int sig, int checkctty));
|
||||
void postsig __P((int sig));
|
||||
int issignal __P((struct proc *p));
|
||||
void psignal __P((struct proc *p, int sig));
|
||||
void setsigvec __P((struct proc *, int, struct sigaction *));
|
||||
void sigexit __P((struct proc *, int));
|
||||
|
@ -65,7 +65,7 @@
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $Id: vm_pageout.c,v 1.63 1995/12/14 09:55:09 phk Exp $
|
||||
* $Id: vm_pageout.c,v 1.64 1996/01/19 04:00:23 dyson Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -828,8 +828,7 @@ rescan1:
|
||||
}
|
||||
}
|
||||
if (bigproc != NULL) {
|
||||
printf("Process %lu killed by vm_pageout -- out of swap\n", (u_long) bigproc->p_pid);
|
||||
psignal(bigproc, SIGKILL);
|
||||
killproc(bigproc, "out of swap space");
|
||||
bigproc->p_estcpu = 0;
|
||||
bigproc->p_nice = PRIO_MIN;
|
||||
resetpriority(bigproc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user