Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add compile-time and run-time feature test knobs for the 100...



details:   https://anonhg.NetBSD.org/src/rev/a36128b0ca85
branches:  trunk
changeset: 473980:a36128b0ca85
user:      kleink <kleink%NetBSD.org@localhost>
date:      Thu Jun 24 14:18:10 1999 +0000

description:
Add compile-time and run-time feature test knobs for the 1003.1 Mapped Files,
Process Memory Locking, Range Memory Locking and Memory Protection options.

diffstat:

 lib/libc/gen/sysconf.3    |  16 ++++++++++++++--
 lib/libc/gen/sysconf.c    |  20 ++++++++++++++++++--
 lib/libc/gen/sysctl.3     |  24 ++++++++++++++++++++++--
 sys/kern/kern_sysctl.c    |  10 +++++++++-
 sys/sys/sysctl.h          |  12 ++++++++++--
 sys/sys/unistd.h          |  14 +++++++++++++-
 usr.bin/getconf/getconf.c |   9 ++++++---
 7 files changed, 92 insertions(+), 13 deletions(-)

diffs (269 lines):

diff -r 22df84ab36f9 -r a36128b0ca85 lib/libc/gen/sysconf.3
--- a/lib/libc/gen/sysconf.3    Thu Jun 24 14:07:44 1999 +0000
+++ b/lib/libc/gen/sysconf.3    Thu Jun 24 14:18:10 1999 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sysconf.3,v 1.11 1999/03/22 19:44:46 garbled Exp $
+.\"    $NetBSD: sysconf.3,v 1.12 1999/06/24 14:18:10 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 April 19, 1994
+.Dd June 24, 1999
 .Dt SYSCONF 3
 .Os
 .Sh NAME
@@ -89,6 +89,18 @@
 .Xr writev 2 .
 .It Li _SC_JOB_CONTROL
 Return 1 if job control is available on this system, otherwise \-1.
+.It Li _SC_MAPPED_FILES
+Return 1 if the Memory Mapped Files Option is available on this system,
+otherwise \-1.
+.It Li _SC_MEMLOCK
+Return 1 if the Process Memory Locking Option is available on this system,
+otherwise \-1.
+.It Li _SC_MEMLOCK_RANGE
+Return 1 if the Range Memory Locking Option is available on this system,
+otherwise \-1.
+.It Li _SC_MEMORY_PROTECTION
+Return 1 if the Memory Protection Option is available on this system,
+otherwise \-1.
 .It Li _SC_NGROUPS_MAX
 The maximum number of supplemental groups.
 .It Li _SC_OPEN_MAX
diff -r 22df84ab36f9 -r a36128b0ca85 lib/libc/gen/sysconf.c
--- a/lib/libc/gen/sysconf.c    Thu Jun 24 14:07:44 1999 +0000
+++ b/lib/libc/gen/sysconf.c    Thu Jun 24 14:18:10 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysconf.c,v 1.9 1998/08/03 14:41:21 kleink Exp $       */
+/*     $NetBSD: sysconf.c,v 1.10 1999/06/24 14:18:10 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.9 1998/08/03 14:41:21 kleink Exp $");
+__RCSID("$NetBSD: sysconf.c,v 1.10 1999/06/24 14:18:10 kleink Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -131,6 +131,22 @@
                mib[0] = CTL_KERN;
                mib[1] = KERN_SYNCHRONIZED_IO;
                goto yesno;
+       case _SC_MAPPED_FILES:
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_MAPPED_FILES;
+               goto yesno;
+       case _SC_MEMLOCK:
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_MEMLOCK;
+               goto yesno;
+       case _SC_MEMLOCK_RANGE:
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_MEMLOCK_RANGE;
+               goto yesno;
+       case _SC_MEMORY_PROTECTION:
+               mib[0] = CTL_KERN;
+               mib[1] = KERN_MEMORY_PROTECTION;
+               goto yesno;
 
 /* 1003.2 */
        case _SC_BC_BASE_MAX:
diff -r 22df84ab36f9 -r a36128b0ca85 lib/libc/gen/sysctl.3
--- a/lib/libc/gen/sysctl.3     Thu Jun 24 14:07:44 1999 +0000
+++ b/lib/libc/gen/sysctl.3     Thu Jun 24 14:18:10 1999 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: sysctl.3,v 1.35 1999/05/23 20:33:51 ad Exp $
+.\"    $NetBSD: sysctl.3,v 1.36 1999/06/24 14:18:10 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 May 9, 1995
+.Dd June 24, 1999
 .Dt SYSCTL 3
 .Os
 .Sh NAME
@@ -263,12 +263,16 @@
 .It KERN\_IOV\_MAX     integer no
 .It KERN\_JOB\_CONTROL integer no
 .It KERN\_LINK\_MAX    integer no
+.It KERN\_MAPPED_FILES integer no
 .It KERN\_MAXFILES     integer yes
 .It KERN\_MAXPARTITIONS        integer no
 .It KERN\_MAXPROC      integer yes
 .It KERN\_MAXVNODES    integer yes
 .It KERN\_MAX\_CANON   integer no
 .It KERN\_MAX\_INPUT   integer no
+.It KERN\_MEMLOCK      integer no
+.It KERN\_MEMLOCK\_RANGE       integer no
+.It KERN\_MEMORY\_PROTECTION   integer no
 .It KERN\_MSGBUFSIZE   integer no
 .It KERN\_NAME\_MAX    integer no
 .It KERN\_NGROUPS      integer no
@@ -354,6 +358,10 @@
 Return 1 if job control is available on this system, otherwise 0.
 .It Li KERN_LINK_MAX
 The maximum file link count.
+.It Li KERN_MAPPED_FILES
+Returns 1 if the POSIX 1003.1b Memory Mapped Files Option is available
+on this system,
+otherwise 0.
 .It Li KERN_MAXFILES
 The maximum number of open files that may be open in the system.
 .It Li KERN_MAXPARTITIONS
@@ -367,6 +375,18 @@
 .It Li KERN_MAX_INPUT
 The minimum maximum number of bytes for which space is available in
 a terminal input queue.
+.It Li KERN_MEMLOCK
+Returns 1 if the POSIX 1003.1b Process Memory Locking Option is available
+on this system,
+otherwise 0.
+.It Li KERN_MEMLOCK_RANGE
+Returns 1 if the POSIX 1003.1b Range Memory Locking Option is available
+on this system,
+otherwise 0.
+.It Li KERN_MEMORY_PROTECTION
+Returns 1 if the POSIX 1003.1b Memory Protection Option is available
+on this system,
+otherwise 0.
 .It Li KERN_MSGBUFSIZE
 The maximum number of characters that the kernel message buffer can hold.
 .It Li KERN_NAME_MAX
diff -r 22df84ab36f9 -r a36128b0ca85 sys/kern/kern_sysctl.c
--- a/sys/kern/kern_sysctl.c    Thu Jun 24 14:07:44 1999 +0000
+++ b/sys/kern/kern_sysctl.c    Thu Jun 24 14:18:10 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_sysctl.c,v 1.46 1999/06/17 15:47:23 thorpej Exp $ */
+/*     $NetBSD: kern_sysctl.c,v 1.47 1999/06/24 14:18:11 kleink Exp $  */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -397,6 +397,14 @@
        case KERN_MBUF:
                return (sysctl_dombuf(name + 1, namelen - 1, oldp, oldlenp,
                    newp, newlen));
+       case KERN_MAPPED_FILES:
+               return (sysctl_rdint(oldp, oldlenp, newp, 1));
+       case KERN_MEMLOCK:
+               return (sysctl_rdint(oldp, oldlenp, newp, 1));
+       case KERN_MEMLOCK_RANGE:
+               return (sysctl_rdint(oldp, oldlenp, newp, 1));
+       case KERN_MEMORY_PROTECTION:
+               return (sysctl_rdint(oldp, oldlenp, newp, 1));
        default:
                return (EOPNOTSUPP);
        }
diff -r 22df84ab36f9 -r a36128b0ca85 sys/sys/sysctl.h
--- a/sys/sys/sysctl.h  Thu Jun 24 14:07:44 1999 +0000
+++ b/sys/sys/sysctl.h  Thu Jun 24 14:18:10 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysctl.h,v 1.34 1999/04/26 21:54:46 thorpej Exp $      */
+/*     $NetBSD: sysctl.h,v 1.35 1999/06/24 14:18:12 kleink Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -149,7 +149,11 @@
 #define        KERN_SYNCHRONIZED_IO    37      /* int: POSIX synchronized I/O */
 #define        KERN_IOV_MAX            38      /* int: max iovec's for readv(2) etc. */
 #define        KERN_MBUF               39      /* node: mbuf parameters */
-#define        KERN_MAXID              40      /* number of valid kern ids */
+#define        KERN_MAPPED_FILES       40      /* int: POSIX memory mapped files */
+#define        KERN_MEMLOCK            41      /* int: POSIX memory locking */
+#define        KERN_MEMLOCK_RANGE      42      /* int: POSIX memory range locking */
+#define        KERN_MEMORY_PROTECTION  43      /* int: POSIX memory protections */
+#define        KERN_MAXID              44      /* number of valid kern ids */
 
 #define CTL_KERN_NAMES { \
        { 0, 0 }, \
@@ -192,6 +196,10 @@
        { "synchronized_io", CTLTYPE_INT }, \
        { "iov_max", CTLTYPE_INT }, \
        { "mbuf", CTLTYPE_NODE }, \
+       { "mapped_files", CTLTYPE_INT }, \
+       { "memlock", CTLTYPE_INT }, \
+       { "memlock_range", CTLTYPE_INT }, \
+       { "memory_protection", CTLTYPE_INT }, \
 }
 
 /*
diff -r 22df84ab36f9 -r a36128b0ca85 sys/sys/unistd.h
--- a/sys/sys/unistd.h  Thu Jun 24 14:07:44 1999 +0000
+++ b/sys/sys/unistd.h  Thu Jun 24 14:18:10 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: unistd.h,v 1.16 1999/03/22 19:14:22 kleink Exp $       */
+/*     $NetBSD: unistd.h,v 1.17 1999/06/24 14:18:12 kleink Exp $       */
 
 /*
  * Copyright (c) 1989, 1993
@@ -75,6 +75,14 @@
 #define        _POSIX_FSYNC            1
                                /* synchronized I/O is available */
 #define        _POSIX_SYNCHRONIZED_IO  1
+                               /* memory mapped files */
+#define        _POSIX_MAPPED_FILES     1
+                               /* memory locking of whole address space */
+#define        _POSIX_MEMLOCK          1
+                               /* memory locking address ranges */
+#define        _POSIX_MEMLOCK_RANGE    1
+                               /* memory access protections */
+#define        _POSIX_MEMORY_PROTECTION 1
 
 
 /* access function */
@@ -142,6 +150,10 @@
 #define        _SC_XOPEN_SHM           30
 #define        _SC_SYNCHRONIZED_IO     31
 #define        _SC_IOV_MAX             32
+#define        _SC_MAPPED_FILES        33
+#define        _SC_MEMLOCK             34
+#define        _SC_MEMLOCK_RANGE       35
+#define        _SC_MEMORY_PROTECTION   36
 
 /* configurable system strings */
 #define        _CS_PATH                 1
diff -r 22df84ab36f9 -r a36128b0ca85 usr.bin/getconf/getconf.c
--- a/usr.bin/getconf/getconf.c Thu Jun 24 14:07:44 1999 +0000
+++ b/usr.bin/getconf/getconf.c Thu Jun 24 14:18:10 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getconf.c,v 1.9 1999/03/22 19:18:10 kleink Exp $       */
+/*     $NetBSD: getconf.c,v 1.10 1999/06/24 14:18:12 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.9 1999/03/22 19:18:10 kleink Exp $");
+__RCSID("$NetBSD: getconf.c,v 1.10 1999/06/24 14:18:12 kleink Exp $");
 #endif /* not lint */
 
 #include <err.h>
@@ -136,11 +136,14 @@
   /* POSIX.1b Configurable System Variables */
   { "PAGESIZE",                        SYSCONF,        _SC_PAGESIZE            },
   { "_POSIX_FSYNC",            SYSCONF,        _SC_FSYNC               },
+  { "_POSIX_MAPPED_FILES",     SYSCONF,        _SC_MAPPED_FILES        },
+  { "_POSIX_MEMLOCK",          SYSCONF,        _SC_MEMLOCK             },
+  { "_POSIX_MEMLOCK_RANGE",    SYSCONF,        _SC_MEMLOCK_RANGE       },
+  { "_POSIX_MEMORY_PROTECTION",        SYSCONF,        _SC_MEMORY_PROTECTION   },
   { "_POSIX_SYNCHRONIZED_IO",  SYSCONF,        _SC_SYNCHRONIZED_IO     },
 
   { "_POSIX_SYNC_IO",          PATHCONF,       _PC_SYNC_IO             },
 
-
   /* XPG4.2 Configurable System Variables */
   { "IOV_MAX",                 SYSCONF,        _SC_IOV_MAX             },
   { "PAGE_SIZE",               SYSCONF,        _SC_PAGE_SIZE           },



Home | Main Index | Thread Index | Old Index