Add sysconf(3) knobs for recent additions.

This commit is contained in:
kleink 2003-02-02 20:33:05 +00:00
parent 2cd19ab0b2
commit 71d7654509
8 changed files with 182 additions and 17 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sysconf.3,v 1.21 2002/12/19 23:31:54 kleink Exp $
.\" $NetBSD: sysconf.3,v 1.22 2003/02/02 20:33:07 kleink Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -33,7 +33,7 @@
.\"
.\" @(#)sysconf.3 8.3 (Berkeley) 4/19/94
.\"
.Dd December 19, 2002
.Dd February 2, 2003
.Dt SYSCONF 3
.Os
.Sh NAME
@ -71,6 +71,13 @@ The maximum bytes of argument to
.It Li _SC_ATEXIT_MAX
The maxmimum number of functions that may be registered with
.Xr atexit 3 .
.It Li _SC_BARRIERS
The version of
.St -p1003.1
and its
Barriers
option to which the system attempts to conform,
otherwise \-1.
.It Li _SC_CHILD_MAX
The maximum number of simultaneous processes per user id.
.It Li _SC_CLK_TCK
@ -118,12 +125,47 @@ The maximum number of supplemental groups.
The maximum number of open files per process.
.It Li _SC_PAGESIZE
The size of a system page in bytes.
.It Li _SC_READER_WRITER_LOCKS
The version of
.St -p1003.1
and its
Read-Write Locks
option to which the system attempts to conform,
otherwise \-1.
.It Li _SC_SEMAPHORES
The version of
.St -p1003.1
and its
Semaphores
option to which the system attempts to conform,
otherwise \-1.
.It Li _SC_SPIN_LOCKS
The version of
.St -p1003.1
and its
Spin Locks
option to which the system attempts to conform,
otherwise \-1.
.It Li _SC_STREAM_MAX
The minimum maximum number of streams that a process may have open
at any one time.
.It Li _SC_SYNCHRONIZED_IO
Return 1 if the Synchronized I/O Option is available on this system,
otherwise \-1.
.It Li _SC_THREADS
The version of
.St -p1003.1
and its
Threads
option to which the system attempts to conform,
otherwise \-1.
.It Li _SC_TIMERS
The version of
.St -p1003.1
and its
Timers
option to which the system attempts to conform,
otherwise \-1.
.It Li _SC_TZNAME_MAX
The minimum maximum number of types supported for the name of a
timezone.

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysconf.c,v 1.17 2002/12/19 23:31:54 kleink Exp $ */
/* $NetBSD: sysconf.c,v 1.18 2003/02/02 20:33:07 kleink Exp $ */
/*-
* Copyright (c) 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94";
#else
__RCSID("$NetBSD: sysconf.c,v 1.17 2002/12/19 23:31:54 kleink Exp $");
__RCSID("$NetBSD: sysconf.c,v 1.18 2003/02/02 20:33:07 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -173,12 +173,39 @@ sysconf(name)
mib[0] = CTL_KERN;
mib[1] = KERN_MONOTONIC_CLOCK;
goto yesno;
case _SC_SEMAPHORES:
mib[0] = CTL_KERN;
mib[1] = KERN_POSIX_SEMAPHORES;
goto yesno;
case _SC_TIMERS:
mib[0] = CTL_KERN;
mib[1] = KERN_POSIX_TIMERS;
goto yesno;
/* 1003.1c */
case _SC_LOGIN_NAME_MAX:
mib[0] = CTL_KERN;
mib[1] = KERN_LOGIN_NAME_MAX;
break;
case _SC_THREADS:
mib[0] = CTL_KERN;
mib[1] = KERN_POSIX_THREADS;
goto yesno;
/* 1003.1j */
case _SC_BARRIERS:
mib[0] = CTL_KERN;
mib[1] = KERN_POSIX_BARRIERS;
goto yesno;
case _SC_SPIN_LOCKS:
mib[0] = CTL_KERN;
mib[1] = KERN_POSIX_SPIN_LOCKS;
goto yesno;
/* Historical; Threads option in 1003.1-2001 */
case _SC_READER_WRITER_LOCKS:
mib[0] = CTL_KERN;
mib[1] = KERN_POSIX_READER_WRITER_LOCKS;
goto yesno;
/* 1003.2 */
case _SC_BC_BASE_MAX:

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sysctl.3,v 1.107 2003/01/02 00:22:32 jschauma Exp $
.\" $NetBSD: sysctl.3,v 1.108 2003/02/02 20:33:07 kleink Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -33,7 +33,7 @@
.\"
.\" @(#)sysctl.3 8.4 (Berkeley) 5/9/95
.\"
.Dd December 19, 2002
.Dd February 2, 2003
.Dt SYSCTL 3
.Os
.Sh NAME
@ -271,7 +271,7 @@ The types of data currently available are process information,
system vnodes, the open file entries, routing table entries,
virtual memory statistics, load average history, and clock rate
information.
.Bl -column "KERNXCHOWNXRESTRICTEDXXX" "struct clockrateXXX" -offset indent
.Bl -column "KERNXCHOWNXRESTRICTEDXXXXXX" "struct clockrateXXX" -offset indent
.It Sy Pa Second level name Type Changeable
.It KERN\_ARGMAX integer no
.It KERN\_AUTONICETIME integer yes
@ -313,6 +313,12 @@ information.
.It KERN\_OSREV integer no
.It KERN\_OSTYPE string no
.It KERN\_POSIX1 integer no
.It KERN\_POSIX\_BARRIERS integer no
.It KERN\_POSIX\_READER\_WRITER\_LOCKS integer no
.It KERN\_POSIX\_SEMAPHORES integer no
.It KERN\_POSIX\_SPIN\_LOCKS integer no
.It KERN\_POSIX\_THREADS integer no
.It KERN\_POSIX\_TIMERS integer no
.It KERN\_PROC struct kinfo_proc no
.It KERN\_PROC2 struct kinfo_proc2 no
.It KERN\_PROC\_ARGS string no
@ -525,6 +531,48 @@ The maximum number of bytes in a pathname.
.It Li KERN_POSIX1
The version of ISO/IEC 9945 (POSIX 1003.1) with which the system
attempts to comply.
.It Li KERN_POSIX_BARRIERS
The version of
.St -p1003.1
and its
Barriers
option to which the system attempts to conform,
otherwise 0.
.It Li KERN_POSIX_READER_WRITER_LOCKS
The version of
.St -p1003.1
and its
Read-Write Locks
option to which the system attempts to conform,
otherwise 0.
.It Li KERN_POSIX_SEMAPHORES
The version of
.St -p1003.1
and its
Semaphores
option to which the system attempts to conform,
otherwise 0.
.It Li KERN_POSIX_SPIN_LOCKS
The version of
.St -p1003.1
and its
Spin Locks
option to which the system attempts to conform,
otherwise 0.
.It Li KERN_POSIX_THREADS
The version of
.St -p1003.1
and its
Threads
option to which the system attempts to conform,
otherwise 0.
.It Li KERN_POSIX_TIMERS
The version of
.St -p1003.1
and its
Timers
option to which the system attempts to conform,
otherwise 0.
.It Li KERN_PROC
Return the entire process table, or a subset of it.
An array of

View File

@ -1,4 +1,4 @@
.\" $NetBSD: sysctl.8,v 1.85 2003/02/01 00:42:03 kleink Exp $
.\" $NetBSD: sysctl.8,v 1.86 2003/02/02 20:33:05 kleink Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@ -33,7 +33,7 @@
.\"
.\" @(#)sysctl.8 8.1 (Berkeley) 6/6/93
.\"
.Dd February 1, 2003
.Dd February 2, 2003
.Dt SYSCTL 8
.Os
.Sh NAME
@ -230,6 +230,12 @@ privilege can change the value.
.It kern.pipe.nbigpipes integer no
.It kern.pipe.kvasize integer no
.It kern.posix1version integer no
.It kern.posix_barriers integer no
.It kern.posix_reader_writer_locks integer no
.It kern.posix_semaphores integer no
.It kern.posix_spin_locks integer no
.It kern.posix_timers integer no
.It kern.posix_threads integer no
.It kern.proc2 struct no
.It kern.proc_args string yes
.It kern.rawpartition integer no

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_sysctl.c,v 1.123 2003/01/18 10:06:31 thorpej Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.124 2003/02/02 20:33:09 kleink Exp $ */
/*-
* Copyright (c) 1982, 1986, 1989, 1993
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.123 2003/01/18 10:06:31 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.124 2003/02/02 20:33:09 kleink Exp $");
#include "opt_ddb.h"
#include "opt_insecure.h"
@ -636,6 +636,22 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
}
return (error);
}
case KERN_POSIX_THREADS: /* XXX _POSIX_VERSION */
return (sysctl_rdint(oldp, oldlenp, newp, 200112));
case KERN_POSIX_SEMAPHORES: /* XXX _POSIX_VERSION */
#ifdef P1003_1B_SEMAPHORE
return (sysctl_rdint(oldp, oldlenp, newp, 200112));
#else
return (sysctl_rdint(oldp, oldlenp, newp, 0));
#endif
case KERN_POSIX_BARRIERS: /* XXX _POSIX_VERSION */
return (sysctl_rdint(oldp, oldlenp, newp, 200112));
case KERN_POSIX_TIMERS: /* XXX _POSIX_VERSION */
return (sysctl_rdint(oldp, oldlenp, newp, 200112));
case KERN_POSIX_SPIN_LOCKS: /* XXX _POSIX_VERSION */
return (sysctl_rdint(oldp, oldlenp, newp, 200112));
case KERN_POSIX_READER_WRITER_LOCKS: /* XXX _POSIX_VERSION */
return (sysctl_rdint(oldp, oldlenp, newp, 200112));
default:
return (EOPNOTSUPP);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sysctl.h,v 1.88 2003/01/18 09:53:21 thorpej Exp $ */
/* $NetBSD: sysctl.h,v 1.89 2003/02/02 20:33:08 kleink Exp $ */
/*
* Copyright (c) 1989, 1993
@ -189,7 +189,13 @@ struct ctlname {
#define KERN_LABELOFFSET 63 /* int: offset of label within sector */
#define KERN_LWP 64 /* struct: lwp entries */
#define KERN_FORKFSLEEP 65 /* int: sleep length on failed fork */
#define KERN_MAXID 66 /* number of valid kern ids */
#define KERN_POSIX_THREADS 66 /* int: POSIX Threads option */
#define KERN_POSIX_SEMAPHORES 67 /* int: POSIX Semaphores option */
#define KERN_POSIX_BARRIERS 68 /* int: POSIX Barriers option */
#define KERN_POSIX_TIMERS 69 /* int: POSIX Timers option */
#define KERN_POSIX_SPIN_LOCKS 70 /* int: POSIX Spin Locks option */
#define KERN_POSIX_READER_WRITER_LOCKS 71 /* int: POSIX R/W Locks option */
#define KERN_MAXID 72 /* number of valid kern ids */
#define CTL_KERN_NAMES { \
@ -259,6 +265,12 @@ struct ctlname {
{ "labeloffset", CTLTYPE_INT }, \
{ "lwp", CTLTYPE_STRUCT }, \
{ "forkfsleep", CTLTYPE_INT }, \
{ "posix_threads", CTLTYPE_INT }, \
{ "posix_semaphores", CTLTYPE_INT }, \
{ "posix_barriers", CTLTYPE_INT }, \
{ "posix_timers", CTLTYPE_INT }, \
{ "posix_spin_locks", CTLTYPE_INT }, \
{ "posix_reader_writer_locks", CTLTYPE_INT }, \
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: unistd.h,v 1.24 2003/01/31 11:54:48 kleink Exp $ */
/* $NetBSD: unistd.h,v 1.25 2003/02/02 20:33:08 kleink Exp $ */
/*
* Copyright (c) 1989, 1993
@ -95,7 +95,7 @@
#define _POSIX_TIMERS 200112L
/* spin locks */
#define _POSIX_SPIN_LOCKS 200112L
/* reader/writer locks */
/* read/write locks */
#define _POSIX_READER_WRITER_LOCKS 200112L
/* XPG4.2 shared memory */
#define _XOPEN_SHM 0
@ -173,6 +173,12 @@
#define _SC_MONOTONIC_CLOCK 38
#define _SC_CLK_TCK 39 /* New, variable version */
#define _SC_ATEXIT_MAX 40
#define _SC_THREADS 41
#define _SC_SEMAPHORES 42
#define _SC_BARRIERS 43
#define _SC_TIMERS 44
#define _SC_SPIN_LOCKS 45
#define _SC_READER_WRITER_LOCKS 46
/* configurable system strings */
#define _CS_PATH 1

View File

@ -1,4 +1,4 @@
/* $NetBSD: getconf.c,v 1.19 2002/12/19 23:31:57 kleink Exp $ */
/* $NetBSD: getconf.c,v 1.20 2003/02/02 20:33:10 kleink Exp $ */
/*-
* Copyright (c) 1996, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: getconf.c,v 1.19 2002/12/19 23:31:57 kleink Exp $");
__RCSID("$NetBSD: getconf.c,v 1.20 2003/02/02 20:33:10 kleink Exp $");
#endif /* not lint */
#include <err.h>
@ -140,12 +140,20 @@ const struct conf_variable conf_table[] =
{ "_POSIX_MEMLOCK_RANGE", SYSCONF, _SC_MEMLOCK_RANGE },
{ "_POSIX_MEMORY_PROTECTION", SYSCONF, _SC_MEMORY_PROTECTION },
{ "_POSIX_MONOTONIC_CLOCK", SYSCONF, _SC_MONOTONIC_CLOCK },
{ "_POSIX_SEMAPHORES", SYSCONF, _SC_SEMAPHORES },
{ "_POSIX_SYNCHRONIZED_IO", SYSCONF, _SC_SYNCHRONIZED_IO },
{ "_POSIX_TIMERS", SYSCONF, _SC_TIMERS },
{ "_POSIX_SYNC_IO", PATHCONF, _PC_SYNC_IO },
/* POSIX.1c Configurable System Variables */
{ "LOGIN_NAME_MAX", SYSCONF, _SC_LOGIN_NAME_MAX },
{ "_POSIX_THREADS", SYSCONF, _SC_THREADS },
/* POSIX.1j Configurable System Variables */
{ "_POSIX_BARRIERS", SYSCONF, _SC_BARRIERS },
{ "_POSIX_READER_WRITER_LOCKS", SYSCONF, _SC_READER_WRITER_LOCKS },
{ "_POSIX_SPIN_LOCKS", SYSCONF, _SC_SPIN_LOCKS },
/* XPG4.2 Configurable System Variables */
{ "IOV_MAX", SYSCONF, _SC_IOV_MAX },