The death of `options NODUMP'. Now the dump area can be dynamically
configured (and unconfigured) on the fly. A sysctl(3) MIB variable is provided to inspect and modify the dump device setting.
This commit is contained in:
parent
a0ad6a34d3
commit
448bf32842
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
|
||||
* $Id: autoconf.c,v 1.28 1995/05/11 02:50:11 wpaul Exp $
|
||||
* $Id: autoconf.c,v 1.29 1995/05/11 19:26:07 rgrimes Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -237,13 +237,36 @@ swapconf()
|
||||
}
|
||||
swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
|
||||
}
|
||||
if (dumplo == 0 && bdevsw[major(dumpdev)].d_psize)
|
||||
dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) -
|
||||
Maxmem*NBPG/512;
|
||||
if (dumplo < 0)
|
||||
dumplo = 0;
|
||||
if (dumpdev != NODEV) {
|
||||
if (dumplo == 0 && bdevsw[major(dumpdev)].d_psize)
|
||||
dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) -
|
||||
Maxmem*NBPG/512;
|
||||
if (dumplo < 0)
|
||||
dumplo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
setdumpdev(dev_t dev)
|
||||
{
|
||||
long newdumplo, psize;
|
||||
if (dev != NODEV && bdevsw[major(dev)].d_psize) {
|
||||
psize = bdevsw[major(dev)].d_psize(dev);
|
||||
newdumplo = bdevsw[major(dev)].d_psize(dev) - Maxmem*NBPG/512;
|
||||
if (newdumplo >= 0) {
|
||||
dumpdev = dev;
|
||||
dumplo = newdumplo;
|
||||
return 0;
|
||||
}
|
||||
return ENOSPC;
|
||||
} else {
|
||||
dumpdev = dev;
|
||||
dumplo = 0;
|
||||
return 0;
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
#define DOSWAP /* change swdevt and dumpdev */
|
||||
u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.124 1995/05/11 00:16:36 wollman Exp $
|
||||
* $Id: machdep.c,v 1.125 1995/05/11 19:26:08 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -905,11 +905,8 @@ boot(arghowto)
|
||||
unsigned long dumpmag = 0x8fca0101UL; /* magic number for savecore */
|
||||
int dumpsize = 0; /* also for savecore */
|
||||
|
||||
#ifdef DODUMP
|
||||
int dodump = 1;
|
||||
#else
|
||||
int dodump = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Doadump comes here after turning off memory management and
|
||||
* getting on the dump stack, either when called above, or by
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
|
||||
* $Id: autoconf.c,v 1.28 1995/05/11 02:50:11 wpaul Exp $
|
||||
* $Id: autoconf.c,v 1.29 1995/05/11 19:26:07 rgrimes Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -237,13 +237,36 @@ swapconf()
|
||||
}
|
||||
swp->sw_nblks = ctod(dtoc(swp->sw_nblks));
|
||||
}
|
||||
if (dumplo == 0 && bdevsw[major(dumpdev)].d_psize)
|
||||
dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) -
|
||||
Maxmem*NBPG/512;
|
||||
if (dumplo < 0)
|
||||
dumplo = 0;
|
||||
if (dumpdev != NODEV) {
|
||||
if (dumplo == 0 && bdevsw[major(dumpdev)].d_psize)
|
||||
dumplo = (*bdevsw[major(dumpdev)].d_psize)(dumpdev) -
|
||||
Maxmem*NBPG/512;
|
||||
if (dumplo < 0)
|
||||
dumplo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
setdumpdev(dev_t dev)
|
||||
{
|
||||
long newdumplo, psize;
|
||||
if (dev != NODEV && bdevsw[major(dev)].d_psize) {
|
||||
psize = bdevsw[major(dev)].d_psize(dev);
|
||||
newdumplo = bdevsw[major(dev)].d_psize(dev) - Maxmem*NBPG/512;
|
||||
if (newdumplo >= 0) {
|
||||
dumpdev = dev;
|
||||
dumplo = newdumplo;
|
||||
return 0;
|
||||
}
|
||||
return ENOSPC;
|
||||
} else {
|
||||
dumpdev = dev;
|
||||
dumplo = 0;
|
||||
return 0;
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
|
||||
#define DOSWAP /* change swdevt and dumpdev */
|
||||
u_long bootdev = 0; /* should be dev_t, but not until 32 bits */
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.124 1995/05/11 00:16:36 wollman Exp $
|
||||
* $Id: machdep.c,v 1.125 1995/05/11 19:26:08 rgrimes Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
@ -905,11 +905,8 @@ boot(arghowto)
|
||||
unsigned long dumpmag = 0x8fca0101UL; /* magic number for savecore */
|
||||
int dumpsize = 0; /* also for savecore */
|
||||
|
||||
#ifdef DODUMP
|
||||
int dodump = 1;
|
||||
#else
|
||||
int dodump = 0;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Doadump comes here after turning off memory management and
|
||||
* getting on the dump stack, either when called above, or by
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_sysctl.c 8.4 (Berkeley) 4/14/94
|
||||
* $Id: kern_sysctl.c,v 1.22 1995/02/20 19:42:35 guido Exp $
|
||||
* $Id: kern_sysctl.c,v 1.23 1995/03/16 18:12:37 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -52,6 +52,7 @@
|
||||
#include <sys/buf.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/conf.h>
|
||||
#include <vm/vm.h>
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
@ -192,6 +193,7 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
|
||||
struct proc *p;
|
||||
{
|
||||
int error, level, inthostid;
|
||||
dev_t ndumpdev;
|
||||
|
||||
/* all sysctl names at this level are terminal */
|
||||
if (namelen != 1 && !(name[0] == KERN_PROC || name[0] == KERN_PROF
|
||||
@ -293,6 +295,14 @@ kern_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
|
||||
case KERN_NTP_PLL:
|
||||
return (ntp_sysctl(name + 1, namelen - 1, oldp, oldlenp,
|
||||
newp, newlen, p));
|
||||
case KERN_DUMPDEV:
|
||||
ndumpdev = dumpdev;
|
||||
error = sysctl_struct(oldp, oldlenp, newp, newlen, &ndumpdev,
|
||||
sizeof ndumpdev);
|
||||
if (!error && ndumpdev != dumpdev) {
|
||||
error = setdumpdev(ndumpdev);
|
||||
}
|
||||
return error;
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.3 (Berkeley) 1/21/94
|
||||
* $Id: conf.h,v 1.11 1995/03/21 11:24:05 dufault Exp $
|
||||
* $Id: conf.h,v 1.12 1995/04/23 09:36:59 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -139,6 +139,7 @@ struct swdevt {
|
||||
|
||||
#ifdef KERNEL
|
||||
extern struct swdevt swdevt[];
|
||||
extern int setdumpdev __P((dev_t));
|
||||
|
||||
dev_t chrtoblk __P((dev_t dev));
|
||||
int isdisk __P((dev_t dev, int type));
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.3 (Berkeley) 1/21/94
|
||||
* $Id: conf.h,v 1.11 1995/03/21 11:24:05 dufault Exp $
|
||||
* $Id: conf.h,v 1.12 1995/04/23 09:36:59 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -139,6 +139,7 @@ struct swdevt {
|
||||
|
||||
#ifdef KERNEL
|
||||
extern struct swdevt swdevt[];
|
||||
extern int setdumpdev __P((dev_t));
|
||||
|
||||
dev_t chrtoblk __P((dev_t dev));
|
||||
int isdisk __P((dev_t dev, int type));
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)sysctl.h 8.1 (Berkeley) 6/2/93
|
||||
* $Id: sysctl.h,v 1.20 1995/02/20 19:42:40 guido Exp $
|
||||
* $Id: sysctl.h,v 1.21 1995/03/16 18:16:26 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_SYSCTL_H_
|
||||
@ -135,7 +135,8 @@ struct ctlname {
|
||||
#define KERN_BOOTFILE 26 /* string: name of booted kernel */
|
||||
#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */
|
||||
#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */
|
||||
#define KERN_MAXID 29 /* number of valid kern ids */
|
||||
#define KERN_DUMPDEV 29 /* dev_t: device to dump on */
|
||||
#define KERN_MAXID 30 /* number of valid kern ids */
|
||||
|
||||
#define CTL_KERN_NAMES { \
|
||||
{ 0, 0 }, \
|
||||
@ -167,6 +168,7 @@ struct ctlname {
|
||||
{ "bootfile", CTLTYPE_STRING }, \
|
||||
{ "maxfilesperproc", CTLTYPE_INT }, \
|
||||
{ "maxprocperuid", CTLTYPE_INT }, \
|
||||
{ "dumpdev", CTLTYPE_STRUCT }, /* we lie; don't print as int */ \
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user