The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/kern/posix4_mib.c

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1998
    3  *      HD Associates, Inc.  All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  * 3. All advertising materials mentioning features or use of this software
   14  *    must display the following acknowledgement:
   15  *      This product includes software developed by HD Associates, Inc
   16  * 4. Neither the name of the author nor the names of any co-contributors
   17  *    may be used to endorse or promote products derived from this software
   18  *    without specific prior written permission.
   19  *
   20  * THIS SOFTWARE IS PROVIDED BY HD ASSOCIATES AND CONTRIBUTORS ``AS IS'' AND
   21  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   23  * ARE DISCLAIMED.  IN NO EVENT SHALL HD ASSOCIATES OR CONTRIBUTORS BE LIABLE
   24  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   25  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   26  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   27  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   29  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   30  * SUCH DAMAGE.
   31  */
   32 
   33 #include <sys/cdefs.h>
   34 __FBSDID("$FreeBSD: releng/8.3/sys/kern/posix4_mib.c 217843 2011-01-25 20:48:48Z jhb $");
   35 
   36 #include <sys/param.h>
   37 #include <sys/systm.h>
   38 #include <sys/kernel.h>
   39 #include <sys/queue.h>
   40 #include <sys/sysctl.h>
   41 #include <sys/vnode.h>
   42 #include <sys/proc.h>
   43 #include <sys/posix4.h>
   44 
   45 static int facility[CTL_P1003_1B_MAXID - 1];
   46 static int facility_initialized[CTL_P1003_1B_MAXID - 1];
   47 
   48 static int p31b_sysctl_proc(SYSCTL_HANDLER_ARGS);
   49 
   50 /* OID_AUTO isn't working with sysconf(3).  I guess I'd have to
   51  * modify it to do a lookup by name from the index.
   52  * For now I've left it a top-level sysctl.
   53  */
   54 
   55 #if 1
   56 
   57 SYSCTL_DECL(_p1003_1b);
   58 
   59 #define P1B_SYSCTL(num, name)  \
   60         SYSCTL_INT(_p1003_1b, num, name, CTLFLAG_RD, facility + num - 1, 0, "");
   61 #define P1B_SYSCTL_RW(num, name)  \
   62         SYSCTL_PROC(_p1003_1b, num, name, CTLTYPE_INT | CTLFLAG_RW, NULL, num, \
   63             p31b_sysctl_proc, "I", "");
   64 
   65 #else
   66 
   67 SYSCTL_DECL(_kern_p1003_1b);
   68 
   69 #define P1B_SYSCTL(num, name)  \
   70         SYSCTL_INT(_kern_p1003_1b, OID_AUTO, name, CTLFLAG_RD, \
   71             facility + num - 1, 0, "");
   72 #define P1B_SYSCTL_RW(num, name)  \
   73         SYSCTL_PROC(_p1003_1b, OID_AUTO, name, CTLTYPE_INT | CTLFLAG_RW, NULL, \
   74             num, p31b_sysctl_proc, "I", "");
   75 SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B");
   76 
   77 #endif
   78 
   79 SYSCTL_INT(_p1003_1b, CTL_P1003_1B_ASYNCHRONOUS_IO, \
   80         asynchronous_io, CTLFLAG_RD, &async_io_version, 0, "");
   81 P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files);
   82 P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock);
   83 P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range);
   84 P1B_SYSCTL(CTL_P1003_1B_MEMORY_PROTECTION, memory_protection);
   85 P1B_SYSCTL(CTL_P1003_1B_MESSAGE_PASSING, message_passing);
   86 P1B_SYSCTL(CTL_P1003_1B_PRIORITIZED_IO, prioritized_io);
   87 P1B_SYSCTL(CTL_P1003_1B_PRIORITY_SCHEDULING, priority_scheduling);
   88 P1B_SYSCTL(CTL_P1003_1B_REALTIME_SIGNALS, realtime_signals);
   89 P1B_SYSCTL(CTL_P1003_1B_SEMAPHORES, semaphores);
   90 P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync);
   91 P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects);
   92 P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io);
   93 P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers);
   94 P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max);
   95 P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max);
   96 P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max);
   97 P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max);
   98 P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max);
   99 P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize);
  100 P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max);
  101 P1B_SYSCTL_RW(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max);
  102 P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max);
  103 P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max);
  104 P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max);
  105 
  106 #define P31B_VALID(num) ((num) >= 1 && (num) < CTL_P1003_1B_MAXID)
  107 
  108 static int
  109 p31b_sysctl_proc(SYSCTL_HANDLER_ARGS)
  110 {
  111         int error, num, val;
  112 
  113         num = arg2;
  114         if (!P31B_VALID(num))
  115                 return (EINVAL);
  116         val = facility_initialized[num] ? facility[num - 1] : 0;
  117         error = sysctl_handle_int(oidp, &val, 0, req);
  118         if (error == 0 && req->newptr != NULL && facility_initialized[num])
  119                 facility[num - 1] = val;
  120         return (error);
  121 }
  122 
  123 /* p31b_setcfg: Set the configuration
  124  */
  125 void
  126 p31b_setcfg(int num, int value)
  127 {
  128 
  129         if (P31B_VALID(num)) {
  130                 facility[num - 1] = value;
  131                 facility_initialized[num - 1] = 1;
  132         }
  133 }
  134 
  135 void
  136 p31b_unsetcfg(int num)
  137 {
  138 
  139         facility[num - 1] = 0;
  140         facility_initialized[num -1] = 0;
  141 }
  142 
  143 int
  144 p31b_getcfg(int num)
  145 {
  146 
  147         if (P31B_VALID(num))
  148                 return (facility[num - 1]);
  149         return (0);
  150 }
  151 
  152 int
  153 p31b_iscfg(int num)
  154 {
  155 
  156         if (P31B_VALID(num))
  157                 return (facility_initialized[num - 1]);
  158         return (0);
  159 }
  160 
  161 /*
  162  * Turn on indications for standard (non-configurable) kernel features.
  163  */
  164 static void
  165 p31b_set_standard(void *dummy)
  166 {
  167 
  168         p31b_setcfg(CTL_P1003_1B_FSYNC, 200112L);
  169         p31b_setcfg(CTL_P1003_1B_MAPPED_FILES, 200112L);
  170         p31b_setcfg(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, 200112L);
  171         p31b_setcfg(CTL_P1003_1B_PAGESIZE, PAGE_SIZE);
  172         if (!p31b_iscfg(CTL_P1003_1B_AIO_LISTIO_MAX))
  173                 p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, -1);
  174         if (!p31b_iscfg(CTL_P1003_1B_AIO_MAX))
  175                 p31b_setcfg(CTL_P1003_1B_AIO_MAX, -1);
  176         if (!p31b_iscfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX))
  177                 p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, -1);
  178 }
  179 
  180 SYSINIT(p31b_set_standard, SI_SUB_P1003_1B, SI_ORDER_ANY, p31b_set_standard, 
  181         0);
  182 

Cache object: 47cfe9dc314cdbccda7fdefd6f9056b8


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.