summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2013-04-15 16:47:14 +0000
committerguenther <guenther@openbsd.org>2013-04-15 16:47:14 +0000
commit76f6ae9a6afa3383d54ba401e15eefa62eddda45 (patch)
tree4eebafac91e1b8d98c953fbaffe2e626ebbbdbcf
parentImplement fdatasync() as a wrapper around fsync() (diff)
downloadwireguard-openbsd-76f6ae9a6afa3383d54ba401e15eefa62eddda45.tar.xz
wireguard-openbsd-76f6ae9a6afa3383d54ba401e15eefa62eddda45.zip
Remove CTL_USER hierarchy from sysctl()
(Use sysconf() or confstr() instead) ok miod@ millert@
-rw-r--r--lib/libc/gen/sysctl.3119
-rw-r--r--lib/libc/gen/sysctl.c133
-rw-r--r--sbin/sysctl/sysctl.828
-rw-r--r--sbin/sysctl/sysctl.c6
-rw-r--r--sys/sys/sysctl.h55
-rw-r--r--usr.bin/kdump/kdump.c6
6 files changed, 14 insertions, 333 deletions
diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3
index e9081dc2805..e9b513dcf39 100644
--- a/lib/libc/gen/sysctl.3
+++ b/lib/libc/gen/sysctl.3
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.3,v 1.218 2013/04/06 03:46:51 tedu Exp $
+.\" $OpenBSD: sysctl.3,v 1.219 2013/04/15 16:47:14 guenther Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -27,7 +27,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: April 6 2013 $
+.Dd $Mdocdate: April 15 2013 $
.Dt SYSCTL 3
.Os
.Sh NAME
@@ -128,7 +128,6 @@ listed here, and described in separate sections below.
.It Dv CTL_KERN Ta "sys/sysctl.h" Ta "High kernel limits"
.It Dv CTL_MACHDEP Ta "sys/sysctl.h" Ta "Machine dependent"
.It Dv CTL_NET Ta "sys/socket.h" Ta "Networking"
-.It Dv CTL_USER Ta "sys/sysctl.h" Ta "User-level"
.It Dv CTL_VFS Ta "ufs/ffs/ffs_extern.h" Ta "Virtual file system"
.It Dv CTL_VM Ta "uvm/uvm_param.h" Ta "Virtual memory"
.El
@@ -145,22 +144,6 @@ len = sizeof(maxproc);
if (sysctl(mib, 2, &maxproc, &len, NULL, 0) == -1)
err(1, "sysctl");
.Ed
-.Pp
-To retrieve the standard search path for the system utilities:
-.Bd -literal -offset indent
-int mib[2];
-size_t len;
-char *p;
-
-mib[0] = CTL_USER;
-mib[1] = USER_CS_PATH;
-if (sysctl(mib, 2, NULL, &len, NULL, 0) == -1)
- err(1, "sysctl");
-if ((p = malloc(len)) == NULL)
- err(1, NULL);
-if (sysctl(mib, 2, p, &len, NULL, 0) == -1)
- err(1, "sysctl");
-.Ed
.Ss CTL_DDB
Integer information and settable variables are available for the
.Dv CTL_DDB level ,
@@ -1929,104 +1912,6 @@ If set to 1, enable PIPEX processing.
The default is 0.
.El
.El
-.Ss CTL_USER
-The string and integer information available for the
-.Dv CTL_USER
-level is detailed below.
-The changeable column shows whether a process with appropriate
-privileges may change the value.
-.Bl -column "USER_POSIX2_CHAR_TERM" "integer" "Changeable" -offset indent
-.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
-.It Dv USER_BC_BASE_MAX Ta "integer" Ta "no"
-.It Dv USER_BC_DIM_MAX Ta "integer" Ta "no"
-.It Dv USER_BC_SCALE_MAX Ta "integer" Ta "no"
-.It Dv USER_BC_STRING_MAX Ta "integer" Ta "no"
-.It Dv USER_COLL_WEIGHTS_MAX Ta "integer" Ta "no"
-.It Dv USER_CS_PATH Ta "string" Ta "no"
-.It Dv USER_EXPR_NEST_MAX Ta "integer" Ta "no"
-.It Dv USER_LINE_MAX Ta "integer" Ta "no"
-.It Dv USER_POSIX2_C_BIND Ta "integer" Ta "no"
-.It Dv USER_POSIX2_C_DEV Ta "integer" Ta "no"
-.It Dv USER_POSIX2_CHAR_TERM Ta "integer" Ta "no"
-.It Dv USER_POSIX2_FORT_DEV Ta "integer" Ta "no"
-.It Dv USER_POSIX2_FORT_RUN Ta "integer" Ta "no"
-.It Dv USER_POSIX2_LOCALEDEF Ta "integer" Ta "no"
-.It Dv USER_POSIX2_SW_DEV Ta "integer" Ta "no"
-.It Dv USER_POSIX2_UPE Ta "integer" Ta "no"
-.It Dv USER_POSIX2_VERSION Ta "integer" Ta "no"
-.It Dv USER_RE_DUP_MAX Ta "integer" Ta "no"
-.It Dv USER_STREAM_MAX Ta "integer" Ta "no"
-.It Dv USER_TZNAME_MAX Ta "integer" Ta "no"
-.El
-.Bl -tag -width "123456"
-.It Dv USER_BC_BASE_MAX
-The maximum ibase/obase values in the
-.Xr bc 1
-utility.
-.It Dv USER_BC_DIM_MAX
-The maximum array size in the
-.Xr bc 1
-utility.
-.It Dv USER_BC_SCALE_MAX
-The maximum scale value in the
-.Xr bc 1
-utility.
-.It Dv USER_BC_STRING_MAX
-The maximum string length in the
-.Xr bc 1
-utility.
-.It Dv USER_COLL_WEIGHTS_MAX
-The maximum number of weights that can be assigned to any entry of
-the
-.Dv LC_COLLATE
-order keyword in the locale definition file.
-.It Dv USER_CS_PATH
-Return a value for the
-.Ev PATH
-environment variable that finds all the standard utilities.
-.It Dv USER_EXPR_NEST_MAX
-The maximum number of expressions that can be nested within
-parentheses by the
-.Xr expr 1
-utility.
-.It Dv USER_LINE_MAX
-The maximum length in bytes of a text-processing utility's input
-line.
-.It Dv USER_POSIX2_C_BIND
-Return 1 if the system's C-language development facilities support the
-C-Language Bindings Option, otherwise 0.
-.It Dv USER_POSIX2_C_DEV
-Return 1 if the system supports the C-Language Development Utilities Option,
-otherwise 0.
-.It Dv USER_POSIX2_CHAR_TERM
-Return 1 if the system supports at least one terminal type capable of
-all operations described in POSIX 1003.2, otherwise 0.
-.It Dv USER_POSIX2_FORT_DEV
-Return 1 if the system supports the FORTRAN Development Utilities Option,
-otherwise 0.
-.It Dv USER_POSIX2_FORT_RUN
-Return 1 if the system supports the FORTRAN Runtime Utilities Option,
-otherwise 0.
-.It Dv USER_POSIX2_LOCALEDEF
-Return 1 if the system supports the creation of locales, otherwise 0.
-.It Dv USER_POSIX2_SW_DEV
-Return 1 if the system supports the Software Development Utilities Option,
-otherwise 0.
-.It Dv USER_POSIX2_UPE
-Return 1 if the system supports the User Portability Utilities Option,
-otherwise 0.
-.It Dv USER_POSIX2_VERSION
-The version of POSIX 1003.2 with which the system attempts to comply.
-.It Dv USER_RE_DUP_MAX
-The maximum number of repeated occurrences of a regular expression
-permitted when using interval notation.
-.It Dv USER_STREAM_MAX
-The maximum number of streams that a process may have open
-at any one time.
-.It Dv USER_TZNAME_MAX
-The minimum maximum number of types supported for the name of a
-time zone.
-.El
.Ss CTL_VFS
The string and integer information available for the
.Dv CTL_VFS
diff --git a/lib/libc/gen/sysctl.c b/lib/libc/gen/sysctl.c
index 386317cc6ec..941ae1aafd5 100644
--- a/lib/libc/gen/sysctl.c
+++ b/lib/libc/gen/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.7 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: sysctl.c,v 1.8 2013/04/15 16:47:14 guenther Exp $ */
/*-
* Copyright (c) 1993
* The Regents of the University of California. All rights reserved.
@@ -31,140 +31,11 @@
#include <sys/param.h>
#include <sys/sysctl.h>
-#include <errno.h>
-#include <limits.h>
-#include <paths.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-
int __sysctl(int *, u_int, void *, size_t *, void *, size_t);
int
sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen)
{
- if (name[0] != CTL_USER)
- return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen));
-
- if (newp != NULL) {
- errno = EPERM;
- return (-1);
- }
- if (namelen != 2) {
- errno = EINVAL;
- return (-1);
- }
-
- switch (name[1]) {
- case USER_CS_PATH:
- if (oldp && *oldlenp < sizeof(_PATH_STDPATH))
- return (ENOMEM);
- *oldlenp = sizeof(_PATH_STDPATH);
- if (oldp != NULL)
- memmove(oldp, _PATH_STDPATH, sizeof(_PATH_STDPATH));
- return (0);
- }
-
- if (oldp && *oldlenp < sizeof(int))
- return (ENOMEM);
- *oldlenp = sizeof(int);
- if (oldp == NULL)
- return (0);
-
- switch (name[1]) {
- case USER_BC_BASE_MAX:
- *(int *)oldp = BC_BASE_MAX;
- return (0);
- case USER_BC_DIM_MAX:
- *(int *)oldp = BC_DIM_MAX;
- return (0);
- case USER_BC_SCALE_MAX:
- *(int *)oldp = BC_SCALE_MAX;
- return (0);
- case USER_BC_STRING_MAX:
- *(int *)oldp = BC_STRING_MAX;
- return (0);
- case USER_COLL_WEIGHTS_MAX:
- *(int *)oldp = COLL_WEIGHTS_MAX;
- return (0);
- case USER_EXPR_NEST_MAX:
- *(int *)oldp = EXPR_NEST_MAX;
- return (0);
- case USER_LINE_MAX:
- *(int *)oldp = LINE_MAX;
- return (0);
- case USER_RE_DUP_MAX:
- *(int *)oldp = RE_DUP_MAX;
- return (0);
- case USER_POSIX2_VERSION:
- *(int *)oldp = _POSIX2_VERSION;
- return (0);
- case USER_POSIX2_C_BIND:
-#ifdef POSIX2_C_BIND
- *(int *)oldp = 1;
-#else
- *(int *)oldp = 0;
-#endif
- return (0);
- case USER_POSIX2_C_DEV:
-#ifdef POSIX2_C_DEV
- *(int *)oldp = 1;
-#else
- *(int *)oldp = 0;
-#endif
- return (0);
- case USER_POSIX2_CHAR_TERM:
-#ifdef POSIX2_CHAR_TERM
- *(int *)oldp = 1;
-#else
- *(int *)oldp = 0;
-#endif
- return (0);
- case USER_POSIX2_FORT_DEV:
-#ifdef POSIX2_FORT_DEV
- *(int *)oldp = 1;
-#else
- *(int *)oldp = 0;
-#endif
- return (0);
- case USER_POSIX2_FORT_RUN:
-#ifdef POSIX2_FORT_RUN
- *(int *)oldp = 1;
-#else
- *(int *)oldp = 0;
-#endif
- return (0);
- case USER_POSIX2_LOCALEDEF:
-#ifdef POSIX2_LOCALEDEF
- *(int *)oldp = 1;
-#else
- *(int *)oldp = 0;
-#endif
- return (0);
- case USER_POSIX2_SW_DEV:
-#ifdef POSIX2_SW_DEV
- *(int *)oldp = 1;
-#else
- *(int *)oldp = 0;
-#endif
- return (0);
- case USER_POSIX2_UPE:
-#ifdef POSIX2_UPE
- *(int *)oldp = 1;
-#else
- *(int *)oldp = 0;
-#endif
- return (0);
- case USER_STREAM_MAX:
- *(int *)oldp = FOPEN_MAX;
- return (0);
- case USER_TZNAME_MAX:
- *(int *)oldp = NAME_MAX;
- return (0);
- default:
- errno = EINVAL;
- return (-1);
- }
- /* NOTREACHED */
+ return (__sysctl(name, namelen, oldp, oldlenp, newp, newlen));
}
diff --git a/sbin/sysctl/sysctl.8 b/sbin/sysctl/sysctl.8
index 06f699e055d..41f703a58f3 100644
--- a/sbin/sysctl/sysctl.8
+++ b/sbin/sysctl/sysctl.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: sysctl.8,v 1.167 2013/04/06 03:47:07 tedu Exp $
+.\" $OpenBSD: sysctl.8,v 1.168 2013/04/15 16:47:14 guenther Exp $
.\" $NetBSD: sysctl.8,v 1.4 1995/09/30 07:12:49 thorpej Exp $
.\"
.\" Copyright (c) 1993
@@ -30,7 +30,7 @@
.\"
.\" @(#)sysctl.8 8.2 (Berkeley) 5/9/95
.\"
-.Dd $Mdocdate: April 6 2013 $
+.Dd $Mdocdate: April 15 2013 $
.Dt SYSCTL 8
.Os
.Sh NAME
@@ -360,26 +360,6 @@ and a few require a kernel compiled with non-standard
.It machdep.led_blink Ta integer Ta yes
.It machdep.ceccerrs Ta integer Ta no
.It machdep.cecclast Ta quad Ta no
-.It user.cs_path Ta string Ta no
-.It user.bc_base_max Ta integer Ta no
-.It user.bc_dim_max Ta integer Ta no
-.It user.bc_scale_max Ta integer Ta no
-.It user.bc_string_max Ta integer Ta no
-.It user.coll_weights_max Ta integer Ta no
-.It user.expr_nest_max Ta integer Ta no
-.It user.line_max Ta integer Ta no
-.It user.re_dup_max Ta integer Ta no
-.It user.posix2_version Ta integer Ta no
-.It user.posix2_c_bind Ta integer Ta no
-.It user.posix2_c_dev Ta integer Ta no
-.It user.posix2_char_term Ta integer Ta no
-.It user.posix2_fort_dev Ta integer Ta no
-.It user.posix2_fort_run Ta integer Ta no
-.It user.posix2_localedef Ta integer Ta no
-.It user.posix2_sw_dev Ta integer Ta no
-.It user.posix2_upe Ta integer Ta no
-.It user.stream_max Ta integer Ta no
-.It user.tzname_max Ta integer Ta no
.It ddb.radix Ta integer Ta yes
.It ddb.max_width Ta integer Ta yes
.It ddb.max_line Ta integer Ta yes
@@ -426,8 +406,8 @@ flag lists all the filesystems compiled into the running kernel.
.Sh FILES
.Bl -tag -width <uvm/uvm_swap_encrypt.h> -compact
.It Aq Pa sys/sysctl.h
-definitions for top level identifiers, second level kernel and hardware
-identifiers, and user level identifiers
+definitions for top level identifiers and second level kernel and hardware
+identifiers
.It Aq Pa dev/rndvar.h
definitions for
.Xr random 4
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index bdf297f91ac..990b2261b10 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.187 2013/03/29 01:35:37 tedu Exp $ */
+/* $OpenBSD: sysctl.c,v 1.188 2013/04/15 16:47:14 guenther Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -113,7 +113,6 @@ struct ctlname vmname[] = CTL_VM_NAMES;
struct ctlname fsname[] = CTL_FS_NAMES;
struct ctlname netname[] = CTL_NET_NAMES;
struct ctlname hwname[] = CTL_HW_NAMES;
-struct ctlname username[] = CTL_USER_NAMES;
struct ctlname debugname[CTL_DEBUG_MAXID];
struct ctlname kernmallocname[] = CTL_KERN_MALLOC_NAMES;
struct ctlname forkstatname[] = CTL_KERN_FORKSTAT_NAMES;
@@ -152,7 +151,7 @@ struct list secondlevel[] = {
#else
{ 0, 0 }, /* CTL_MACHDEP */
#endif
- { username, USER_MAXID }, /* CTL_USER_NAMES */
+ { 0, 0 }, /* was CTL_USER */
{ ddbname, DBCTL_MAXID }, /* CTL_DDB_NAMES */
{ 0, 0 }, /* CTL_VFS */
};
@@ -678,7 +677,6 @@ parse(char *string, int flags)
}
return;
- case CTL_USER:
case CTL_DDB:
break;
diff --git a/sys/sys/sysctl.h b/sys/sys/sysctl.h
index 16e489c0700..c50efc1d384 100644
--- a/sys/sys/sysctl.h
+++ b/sys/sys/sysctl.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.h,v 1.133 2013/04/11 04:30:59 tedu Exp $ */
+/* $OpenBSD: sysctl.h,v 1.134 2013/04/15 16:47:14 guenther Exp $ */
/* $NetBSD: sysctl.h,v 1.16 1996/04/09 20:55:36 cgd Exp $ */
/*
@@ -79,7 +79,7 @@ struct ctlname {
#define CTL_DEBUG 5 /* debugging parameters */
#define CTL_HW 6 /* generic cpu/io */
#define CTL_MACHDEP 7 /* machine dependent */
-#define CTL_USER 8 /* user-level */
+/*define gap 8 was CTL_USER: removed 2013-04 */
#define CTL_DDB 9 /* DDB user interface, see db_var.h */
#define CTL_VFS 10 /* VFS sysctl's */
#define CTL_MAXID 11 /* number of valid top-level ids */
@@ -93,7 +93,7 @@ struct ctlname {
{ "debug", CTLTYPE_NODE }, \
{ "hw", CTLTYPE_NODE }, \
{ "machdep", CTLTYPE_NODE }, \
- { "user", CTLTYPE_NODE }, \
+ { "gap", 0 }, \
{ "ddb", CTLTYPE_NODE }, \
{ "vfs", CTLTYPE_NODE }, \
}
@@ -821,55 +821,6 @@ struct kinfo_file2 {
}
/*
- * CTL_USER definitions
- */
-#define USER_CS_PATH 1 /* string: _CS_PATH */
-#define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */
-#define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */
-#define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */
-#define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */
-#define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */
-#define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */
-#define USER_LINE_MAX 8 /* int: LINE_MAX */
-#define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */
-#define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */
-#define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */
-#define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */
-#define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */
-#define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */
-#define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */
-#define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */
-#define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */
-#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */
-#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */
-#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
-#define USER_MAXID 21 /* number of valid user ids */
-
-#define CTL_USER_NAMES { \
- { 0, 0 }, \
- { "cs_path", CTLTYPE_STRING }, \
- { "bc_base_max", CTLTYPE_INT }, \
- { "bc_dim_max", CTLTYPE_INT }, \
- { "bc_scale_max", CTLTYPE_INT }, \
- { "bc_string_max", CTLTYPE_INT }, \
- { "coll_weights_max", CTLTYPE_INT }, \
- { "expr_nest_max", CTLTYPE_INT }, \
- { "line_max", CTLTYPE_INT }, \
- { "re_dup_max", CTLTYPE_INT }, \
- { "posix2_version", CTLTYPE_INT }, \
- { "posix2_c_bind", CTLTYPE_INT }, \
- { "posix2_c_dev", CTLTYPE_INT }, \
- { "posix2_char_term", CTLTYPE_INT }, \
- { "posix2_fort_dev", CTLTYPE_INT }, \
- { "posix2_fort_run", CTLTYPE_INT }, \
- { "posix2_localedef", CTLTYPE_INT }, \
- { "posix2_sw_dev", CTLTYPE_INT }, \
- { "posix2_upe", CTLTYPE_INT }, \
- { "stream_max", CTLTYPE_INT }, \
- { "tzname_max", CTLTYPE_INT }, \
-}
-
-/*
* CTL_DEBUG definitions
*
* Second level identifier specifies which debug variable.
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index d62332fbae7..2cae4eb98d9 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kdump.c,v 1.77 2012/12/25 09:35:51 guenther Exp $ */
+/* $OpenBSD: kdump.c,v 1.78 2013/04/15 16:47:14 guenther Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -904,7 +904,6 @@ static struct ctlname vmname[] = CTL_VM_NAMES;
static struct ctlname fsname[] = CTL_FS_NAMES;
static struct ctlname netname[] = CTL_NET_NAMES;
static struct ctlname hwname[] = CTL_HW_NAMES;
-static struct ctlname username[] = CTL_USER_NAMES;
static struct ctlname debugname[CTL_DEBUG_MAXID];
static struct ctlname kernmallocname[] = CTL_KERN_MALLOC_NAMES;
static struct ctlname forkstatname[] = CTL_KERN_FORKSTAT_NAMES;
@@ -974,9 +973,6 @@ kresolvsysctl(int depth, int *top, int idx)
SETNAME(machdepname);
break;
#endif
- case CTL_USER:
- SETNAME(username);
- break;
case CTL_DDB:
SETNAME(ddbname);
break;