Belatedly back out rev. 1.20.
This commit is contained in:
parent
f7597900e9
commit
2d730c265e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=53561
@ -40,14 +40,14 @@
|
|||||||
.Nd get or set kernel state
|
.Nd get or set kernel state
|
||||||
.Sh SYNOPSIS
|
.Sh SYNOPSIS
|
||||||
.Nm sysctl
|
.Nm sysctl
|
||||||
.Op Fl bdn
|
.Op Fl bn
|
||||||
.Ar name ...
|
.Ar name ...
|
||||||
.Nm sysctl
|
.Nm sysctl
|
||||||
.Op Fl bn
|
.Op Fl bn
|
||||||
.Fl w
|
.Fl w
|
||||||
.Ar name=value ...
|
.Ar name=value ...
|
||||||
.Nm sysctl
|
.Nm sysctl
|
||||||
.Op Fl bdn
|
.Op Fl bn
|
||||||
.Fl aAX
|
.Fl aAX
|
||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
@ -85,9 +85,6 @@ set psize=`sysctl -n hw.pagesize`
|
|||||||
Force the value of the variable(s) to be output in raw, binary
|
Force the value of the variable(s) to be output in raw, binary
|
||||||
format. No names are printed and no terminating newlines are output.
|
format. No names are printed and no terminating newlines are output.
|
||||||
This is mostly useful with a single variable.
|
This is mostly useful with a single variable.
|
||||||
.It Fl d
|
|
||||||
Display the description rather than the value of the requested
|
|
||||||
variable(s).
|
|
||||||
.It Fl w Ar name=value ...
|
.It Fl w Ar name=value ...
|
||||||
Set the MIB
|
Set the MIB
|
||||||
.Ar name
|
.Ar name
|
||||||
|
@ -58,7 +58,7 @@ static const char rcsid[] =
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static int Aflag, aflag, bflag, dflag, nflag, wflag, Xflag;
|
static int Aflag, aflag, bflag, nflag, wflag, Xflag;
|
||||||
|
|
||||||
static int oidfmt(int *, int, char *, u_int *);
|
static int oidfmt(int *, int, char *, u_int *);
|
||||||
static void parse(char *);
|
static void parse(char *);
|
||||||
@ -71,11 +71,11 @@ usage(void)
|
|||||||
{
|
{
|
||||||
|
|
||||||
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
|
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n%s\n",
|
||||||
"usage: sysctl [-bdn] variable ...",
|
"usage: sysctl [-bn] variable ...",
|
||||||
" sysctl [-bn] -w variable=value ...",
|
" sysctl [-bn] -w variable=value ...",
|
||||||
" sysctl [-bdn] -a",
|
" sysctl [-bn] -a",
|
||||||
" sysctl [-bdn] -A",
|
" sysctl [-bn] -A",
|
||||||
" sysctl [-bdn] -X");
|
" sysctl [-bn] -X");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,12 +86,11 @@ main(int argc, char **argv)
|
|||||||
setbuf(stdout,0);
|
setbuf(stdout,0);
|
||||||
setbuf(stderr,0);
|
setbuf(stderr,0);
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "AabdnwX")) != -1) {
|
while ((ch = getopt(argc, argv, "AabnwX")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'A': Aflag = 1; break;
|
case 'A': Aflag = 1; break;
|
||||||
case 'a': aflag = 1; break;
|
case 'a': aflag = 1; break;
|
||||||
case 'b': bflag = 1; break;
|
case 'b': bflag = 1; break;
|
||||||
case 'd': dflag = 1; break;
|
|
||||||
case 'n': nflag = 1; break;
|
case 'n': nflag = 1; break;
|
||||||
case 'w': wflag = 1; break;
|
case 'w': wflag = 1; break;
|
||||||
case 'X': Xflag = Aflag = 1; break;
|
case 'X': Xflag = Aflag = 1; break;
|
||||||
@ -101,7 +100,7 @@ main(int argc, char **argv)
|
|||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
if (wflag && (Aflag || aflag || dflag))
|
if (wflag && (Aflag || aflag))
|
||||||
usage();
|
usage();
|
||||||
if (Aflag || aflag)
|
if (Aflag || aflag)
|
||||||
exit (sysctl_all(0, 0));
|
exit (sysctl_all(0, 0));
|
||||||
@ -356,18 +355,6 @@ show_var(int *oid, int nlen)
|
|||||||
if (i || !j)
|
if (i || !j)
|
||||||
err(1, "sysctl name %d %d %d", i, j, errno);
|
err(1, "sysctl name %d %d %d", i, j, errno);
|
||||||
|
|
||||||
if (dflag) {
|
|
||||||
qoid[1] = 5;
|
|
||||||
j = sizeof descr;
|
|
||||||
i = sysctl(qoid, nlen + 2, descr, &j, 0, 0);
|
|
||||||
if (i || !j)
|
|
||||||
err(1, "sysctl name %d %d %d", i, j, errno);
|
|
||||||
if (!nflag)
|
|
||||||
printf("%s: ", name);
|
|
||||||
printf("%s", descr[0] ? descr : "[no description]");
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* find an estimate of how much we need for this var */
|
/* find an estimate of how much we need for this var */
|
||||||
j = 0;
|
j = 0;
|
||||||
i = sysctl(oid, nlen, 0, &j, 0, 0);
|
i = sysctl(oid, nlen, 0, &j, 0, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user