Learn how to print out kern.dumpdev as a name.
This commit is contained in:
parent
83f9dfab4d
commit
55678a2eb9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=8479
@ -40,7 +40,7 @@ static char copyright[] =
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "From: @(#)sysctl.c 8.1 (Berkeley) 6/6/93"; */
|
/*static char sccsid[] = "From: @(#)sysctl.c 8.1 (Berkeley) 6/6/93"; */
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: sysctl.c,v 1.3 1995/02/09 23:16:17 wollman Exp $";
|
"$Id: sysctl.c,v 1.4 1995/02/16 00:28:42 wollman Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -111,6 +111,7 @@ int Aflag, aflag, nflag, wflag;
|
|||||||
#define CLOCK 0x00000001
|
#define CLOCK 0x00000001
|
||||||
#define BOOTTIME 0x00000002
|
#define BOOTTIME 0x00000002
|
||||||
#define CONSDEV 0x00000004
|
#define CONSDEV 0x00000004
|
||||||
|
#define DUMPDEV 0x00000008
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
@ -274,6 +275,9 @@ parse(string, flags)
|
|||||||
case KERN_BOOTTIME:
|
case KERN_BOOTTIME:
|
||||||
special |= BOOTTIME;
|
special |= BOOTTIME;
|
||||||
break;
|
break;
|
||||||
|
case KERN_DUMPDEV:
|
||||||
|
special |= DUMPDEV;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -391,12 +395,17 @@ parse(string, flags)
|
|||||||
fprintf(stdout, "%d\n", btp->tv_sec);
|
fprintf(stdout, "%d\n", btp->tv_sec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (special & CONSDEV) {
|
if (special & (CONSDEV | DUMPDEV)) {
|
||||||
dev_t dev = *(dev_t *)buf;
|
dev_t dev = *(dev_t *)buf;
|
||||||
|
|
||||||
|
if ((special & DUMPDEV) && dev == NODEV && !nflag) {
|
||||||
|
printf("%s = disabled\n", string);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!nflag)
|
if (!nflag)
|
||||||
fprintf(stdout, "%s = %s\n", string,
|
fprintf(stdout, "%s = %s\n", string,
|
||||||
devname(dev, S_IFCHR));
|
devname(dev,
|
||||||
|
(special & CONSDEV) ? S_IFCHR : S_IFBLK));
|
||||||
else
|
else
|
||||||
fprintf(stdout, "0x%x\n", dev);
|
fprintf(stdout, "0x%x\n", dev);
|
||||||
return;
|
return;
|
||||||
|
@ -40,7 +40,7 @@ static char copyright[] =
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
/*static char sccsid[] = "From: @(#)sysctl.c 8.1 (Berkeley) 6/6/93"; */
|
/*static char sccsid[] = "From: @(#)sysctl.c 8.1 (Berkeley) 6/6/93"; */
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: sysctl.c,v 1.3 1995/02/09 23:16:17 wollman Exp $";
|
"$Id: sysctl.c,v 1.4 1995/02/16 00:28:42 wollman Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -111,6 +111,7 @@ int Aflag, aflag, nflag, wflag;
|
|||||||
#define CLOCK 0x00000001
|
#define CLOCK 0x00000001
|
||||||
#define BOOTTIME 0x00000002
|
#define BOOTTIME 0x00000002
|
||||||
#define CONSDEV 0x00000004
|
#define CONSDEV 0x00000004
|
||||||
|
#define DUMPDEV 0x00000008
|
||||||
|
|
||||||
int
|
int
|
||||||
main(argc, argv)
|
main(argc, argv)
|
||||||
@ -274,6 +275,9 @@ parse(string, flags)
|
|||||||
case KERN_BOOTTIME:
|
case KERN_BOOTTIME:
|
||||||
special |= BOOTTIME;
|
special |= BOOTTIME;
|
||||||
break;
|
break;
|
||||||
|
case KERN_DUMPDEV:
|
||||||
|
special |= DUMPDEV;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -391,12 +395,17 @@ parse(string, flags)
|
|||||||
fprintf(stdout, "%d\n", btp->tv_sec);
|
fprintf(stdout, "%d\n", btp->tv_sec);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (special & CONSDEV) {
|
if (special & (CONSDEV | DUMPDEV)) {
|
||||||
dev_t dev = *(dev_t *)buf;
|
dev_t dev = *(dev_t *)buf;
|
||||||
|
|
||||||
|
if ((special & DUMPDEV) && dev == NODEV && !nflag) {
|
||||||
|
printf("%s = disabled\n", string);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!nflag)
|
if (!nflag)
|
||||||
fprintf(stdout, "%s = %s\n", string,
|
fprintf(stdout, "%s = %s\n", string,
|
||||||
devname(dev, S_IFCHR));
|
devname(dev,
|
||||||
|
(special & CONSDEV) ? S_IFCHR : S_IFBLK));
|
||||||
else
|
else
|
||||||
fprintf(stdout, "0x%x\n", dev);
|
fprintf(stdout, "0x%x\n", dev);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user