Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153492312
D4451.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D4451.diff
View Options
Index: head/sbin/sysctl/sysctl.8
===================================================================
--- head/sbin/sysctl/sysctl.8
+++ head/sbin/sysctl/sysctl.8
@@ -28,7 +28,7 @@
.\" From: @(#)sysctl.8 8.1 (Berkeley) 6/6/93
.\" $FreeBSD$
.\"
-.Dd February 12, 2015
+.Dd December 10, 2015
.Dt SYSCTL 8
.Os
.Sh NAME
@@ -36,13 +36,13 @@
.Nd get or set kernel state
.Sh SYNOPSIS
.Nm
-.Op Fl bdehiNnoRTqx
+.Op Fl bdehiNnoRTtqx
.Op Fl B Ar bufsize
.Op Fl f Ar filename
.Ar name Ns Op = Ns Ar value
.Ar ...
.Nm
-.Op Fl bdehNnoRTqx
+.Op Fl bdehNnoRTtqx
.Op Fl B Ar bufsize
.Fl a
.Sh DESCRIPTION
@@ -140,6 +140,8 @@
to standard error.
.It Fl T
Display only variables that are settable via loader (CTLFLAG_TUN).
+.It Fl t
+Print the type of the variable.
.It Fl W
Display only writable variables that are not statistical.
Useful for determining the set of runtime tunable sysctls.
Index: head/sbin/sysctl/sysctl.c
===================================================================
--- head/sbin/sysctl/sysctl.c
+++ head/sbin/sysctl/sysctl.c
@@ -72,7 +72,7 @@
static const char *conffile;
static int aflag, bflag, Bflag, dflag, eflag, hflag, iflag;
-static int Nflag, nflag, oflag, qflag, Tflag, Wflag, xflag;
+static int Nflag, nflag, oflag, qflag, tflag, Tflag, Wflag, xflag;
static int oidfmt(int *, int, char *, u_int *);
static int parsefile(const char *);
@@ -120,6 +120,9 @@
[CTLTYPE_S16] = "int16_t",
[CTLTYPE_S32] = "int32_t",
[CTLTYPE_S64] = "int64_t",
+ [CTLTYPE_NODE] = "node",
+ [CTLTYPE_STRING] = "string",
+ [CTLTYPE_OPAQUE] = "opaque",
};
static void
@@ -127,8 +130,8 @@
{
(void)fprintf(stderr, "%s\n%s\n",
- "usage: sysctl [-bdehiNnoqTWx] [ -B <bufsize> ] [-f filename] name[=value] ...",
- " sysctl [-bdehNnoqTWx] [ -B <bufsize> ] -a");
+ "usage: sysctl [-bdehiNnoqTtWx] [ -B <bufsize> ] [-f filename] name[=value] ...",
+ " sysctl [-bdehNnoqTtWx] [ -B <bufsize> ] -a");
exit(1);
}
@@ -142,7 +145,7 @@
setbuf(stdout,0);
setbuf(stderr,0);
- while ((ch = getopt(argc, argv, "AabB:def:hiNnoqTwWxX")) != -1) {
+ while ((ch = getopt(argc, argv, "AabB:def:hiNnoqtTwWxX")) != -1) {
switch (ch) {
case 'A':
/* compatibility */
@@ -184,6 +187,9 @@
case 'q':
qflag = 1;
break;
+ case 't':
+ tflag = 1;
+ break;
case 'T':
Tflag = 1;
break;
@@ -856,7 +862,7 @@
{
u_char buf[BUFSIZ], *val, *oval, *p;
char name[BUFSIZ], fmt[BUFSIZ];
- const char *sep, *sep1;
+ const char *sep, *sep1, *prntype;
int qoid[CTL_MAXNAME+2];
uintmax_t umv;
intmax_t mv;
@@ -902,12 +908,23 @@
else
sep = ": ";
- if (dflag) { /* just print description */
+ ctltype = (kind & CTLTYPE);
+ if (tflag || dflag) {
+ if (!nflag)
+ printf("%s%s", name, sep);
+ if (ctl_typename[ctltype] != NULL)
+ prntype = ctl_typename[ctltype];
+ else
+ prntype = "unknown";
+ if (tflag && dflag)
+ printf("%s%s", prntype, sep);
+ else if (tflag) {
+ printf("%s", prntype);
+ return (0);
+ }
qoid[1] = 5;
j = sizeof(buf);
i = sysctl(qoid, nlen + 2, buf, &j, 0, 0);
- if (!nflag)
- printf("%s%s", name, sep);
printf("%s", buf);
return (0);
}
@@ -925,7 +942,6 @@
warnx("malloc failed");
return (1);
}
- ctltype = (kind & CTLTYPE);
len = j;
i = sysctl(oid, nlen, val, &len, 0, 0);
if (i != 0 || (len == 0 && ctltype != CTLTYPE_STRING)) {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 11:15 AM (19 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31941847
Default Alt Text
D4451.diff (3 KB)
Attached To
Mode
D4451: Added -t option to display field types on sysctl(8).
Attached
Detach File
Event Timeline
Log In to Comment