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/5.4/sys/posix4/posix4_mib.c 116192 2003-06-11 06:34:30Z obrien $");
35
36 #include <sys/param.h>
37 #include <sys/kernel.h>
38 #include <sys/queue.h>
39 #include <sys/sysctl.h>
40 #include <sys/vnode.h>
41 #include <posix4/posix4.h>
42
43 static int facility[CTL_P1003_1B_MAXID - 1];
44 static int facility_initialized[CTL_P1003_1B_MAXID - 1];
45
46 /* OID_AUTO isn't working with sysconf(3). I guess I'd have to
47 * modify it to do a lookup by name from the index.
48 * For now I've left it a top-level sysctl.
49 */
50
51 #if 1
52
53 SYSCTL_DECL(_p1003_1b);
54
55 #define P1B_SYSCTL(num, name) \
56 SYSCTL_INT(_p1003_1b, num, \
57 name, CTLFLAG_RD, facility + num - 1, 0, "");
58
59 #else
60
61 SYSCTL_DECL(_kern_p1003_1b);
62
63 #define P1B_SYSCTL(num, name) \
64 SYSCTL_INT(_kern_p1003_1b, OID_AUTO, \
65 name, CTLFLAG_RD, facility + num - 1, 0, "");
66 SYSCTL_NODE(_kern, OID_AUTO, p1003_1b, CTLFLAG_RW, 0, "P1003.1B");
67
68 #endif
69
70 SYSCTL_INT(_p1003_1b, CTL_P1003_1B_ASYNCHRONOUS_IO, \
71 asynchronous_io, CTLFLAG_RD, &async_io_version, 0, "");
72 P1B_SYSCTL(CTL_P1003_1B_MAPPED_FILES, mapped_files);
73 P1B_SYSCTL(CTL_P1003_1B_MEMLOCK, memlock);
74 P1B_SYSCTL(CTL_P1003_1B_MEMLOCK_RANGE, memlock_range);
75 P1B_SYSCTL(CTL_P1003_1B_MEMORY_PROTECTION, memory_protection);
76 P1B_SYSCTL(CTL_P1003_1B_MESSAGE_PASSING, message_passing);
77 P1B_SYSCTL(CTL_P1003_1B_PRIORITIZED_IO, prioritized_io);
78 P1B_SYSCTL(CTL_P1003_1B_PRIORITY_SCHEDULING, priority_scheduling);
79 P1B_SYSCTL(CTL_P1003_1B_REALTIME_SIGNALS, realtime_signals);
80 P1B_SYSCTL(CTL_P1003_1B_SEMAPHORES, semaphores);
81 P1B_SYSCTL(CTL_P1003_1B_FSYNC, fsync);
82 P1B_SYSCTL(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, shared_memory_objects);
83 P1B_SYSCTL(CTL_P1003_1B_SYNCHRONIZED_IO, synchronized_io);
84 P1B_SYSCTL(CTL_P1003_1B_TIMERS, timers);
85 P1B_SYSCTL(CTL_P1003_1B_AIO_LISTIO_MAX, aio_listio_max);
86 P1B_SYSCTL(CTL_P1003_1B_AIO_MAX, aio_max);
87 P1B_SYSCTL(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, aio_prio_delta_max);
88 P1B_SYSCTL(CTL_P1003_1B_DELAYTIMER_MAX, delaytimer_max);
89 P1B_SYSCTL(CTL_P1003_1B_MQ_OPEN_MAX, mq_open_max);
90 P1B_SYSCTL(CTL_P1003_1B_PAGESIZE, pagesize);
91 P1B_SYSCTL(CTL_P1003_1B_RTSIG_MAX, rtsig_max);
92 P1B_SYSCTL(CTL_P1003_1B_SEM_NSEMS_MAX, sem_nsems_max);
93 P1B_SYSCTL(CTL_P1003_1B_SEM_VALUE_MAX, sem_value_max);
94 P1B_SYSCTL(CTL_P1003_1B_SIGQUEUE_MAX, sigqueue_max);
95 P1B_SYSCTL(CTL_P1003_1B_TIMER_MAX, timer_max);
96
97 #define P31B_VALID(num) ((num) >= 1 && (num) < CTL_P1003_1B_MAXID)
98
99 /* p31b_setcfg: Set the configuration
100 */
101 void
102 p31b_setcfg(int num, int value)
103 {
104
105 if (P31B_VALID(num)) {
106 facility[num - 1] = value;
107 facility_initialized[num - 1] = 1;
108 }
109 }
110
111 int
112 p31b_getcfg(int num)
113 {
114
115 if (P31B_VALID(num))
116 return (facility[num - 1]);
117 return (0);
118 }
119
120 int
121 p31b_iscfg(int num)
122 {
123
124 if (P31B_VALID(num))
125 return (facility_initialized[num - 1]);
126 return (0);
127 }
128
129 /*
130 * Turn on indications for standard (non-configurable) kernel features.
131 */
132 static void
133 p31b_set_standard(void *dummy)
134 {
135 /* ??? p31b_setcfg(CTL_P1003_1B_FSYNC, 1); */
136 p31b_setcfg(CTL_P1003_1B_MAPPED_FILES, 1);
137 p31b_setcfg(CTL_P1003_1B_SHARED_MEMORY_OBJECTS, 1);
138 p31b_setcfg(CTL_P1003_1B_PAGESIZE, PAGE_SIZE);
139 if (!p31b_iscfg(CTL_P1003_1B_AIO_LISTIO_MAX))
140 p31b_setcfg(CTL_P1003_1B_AIO_LISTIO_MAX, -1);
141 if (!p31b_iscfg(CTL_P1003_1B_AIO_MAX))
142 p31b_setcfg(CTL_P1003_1B_AIO_MAX, -1);
143 if (!p31b_iscfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX))
144 p31b_setcfg(CTL_P1003_1B_AIO_PRIO_DELTA_MAX, -1);
145 }
146
147 SYSINIT(p31b_set_standard, SI_SUB_P1003_1B, SI_ORDER_ANY, p31b_set_standard,
148 0);
149
Cache object: 953c8f671a3335853034e514218ff1e4
|