blob: 5db23fee7b86f9af3e5aa91d7e37cdb21a884c95 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* or http://www.opensolaris.org/os/licensing.
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/param.h>
#include <sys/types.h>
#include <sys/sysmacros.h>
#include <sys/systm.h>
#include <sys/tuneable.h>
#include <sys/errno.h>
#include <sys/var.h>
#include <sys/signal.h>
#include <sys/time.h>
#include <sys/sysconfig.h>
#include <sys/resource.h>
#include <sys/ulimit.h>
#include <sys/unistd.h>
#include <sys/debug.h>
#include <sys/cpuvar.h>
#include <sys/mman.h>
#include <sys/timer.h>
#include <sys/zone.h>
long
sysconfig(int which)
{
switch (which) {
/*
* if it is not handled in mach_sysconfig either
* it must be EINVAL.
*/
default:
return (mach_sysconfig(which)); /* `uname -i`/os */
case _CONFIG_CLK_TCK:
return ((long)hz); /* clock frequency per second */
case _CONFIG_PROF_TCK:
return ((long)hz); /* profiling clock freq per sec */
case _CONFIG_NGROUPS:
/*
* Maximum number of supplementary groups.
*/
return (ngroups_max);
case _CONFIG_OPEN_FILES:
/*
* Maximum number of open files (soft limit).
*/
{
rlim64_t fd_ctl;
mutex_enter(&curproc->p_lock);
fd_ctl = rctl_enforced_value(
rctlproc_legacy[RLIMIT_NOFILE], curproc->p_rctls,
curproc);
mutex_exit(&curproc->p_lock);
return ((ulong_t)fd_ctl);
}
case _CONFIG_CHILD_MAX:
/*
* Maximum number of processes.
*/
return (v.v_maxup);
case _CONFIG_POSIX_VER:
return (_POSIX_VERSION); /* current POSIX version */
case _CONFIG_PAGESIZE:
return (PAGESIZE);
case _CONFIG_XOPEN_VER:
return (_XOPEN_VERSION); /* current XOPEN version */
case _CONFIG_NPROC_CONF:
return (zone_ncpus_get(curproc->p_zone));
case _CONFIG_NPROC_ONLN:
return (zone_ncpus_online_get(curproc->p_zone));
case _CONFIG_NPROC_MAX:
return (max_ncpus);
case _CONFIG_STACK_PROT:
return (curproc->p_stkprot & ~PROT_USER);
case _CONFIG_AIO_LISTIO_MAX:
return (_AIO_LISTIO_MAX);
case _CONFIG_AIO_MAX:
return (_AIO_MAX);
case _CONFIG_AIO_PRIO_DELTA_MAX:
return (0);
case _CONFIG_DELAYTIMER_MAX:
return (INT_MAX);
case _CONFIG_MQ_OPEN_MAX:
return (_MQ_OPEN_MAX);
case _CONFIG_MQ_PRIO_MAX:
return (_MQ_PRIO_MAX);
case _CONFIG_RTSIG_MAX:
return (_SIGRTMAX - _SIGRTMIN + 1);
case _CONFIG_SEM_NSEMS_MAX:
return (_SEM_NSEMS_MAX);
case _CONFIG_SEM_VALUE_MAX:
return (_SEM_VALUE_MAX);
case _CONFIG_SIGQUEUE_MAX:
return (_SIGQUEUE_MAX);
case _CONFIG_SIGRT_MIN:
return (_SIGRTMIN);
case _CONFIG_SIGRT_MAX:
return (_SIGRTMAX);
case _CONFIG_TIMER_MAX:
return (timer_max);
case _CONFIG_PHYS_PAGES:
return (physinstalled);
case _CONFIG_AVPHYS_PAGES:
return (freemem);
case _CONFIG_MAXPID:
return (maxpid);
case _CONFIG_CPUID_MAX:
return (max_cpuid);
case _CONFIG_EPHID_MAX:
return (MAXEPHUID);
case _CONFIG_SYMLOOP_MAX:
return (MAXSYMLINKS);
}
}
|