17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 534709573Sraf * Common Development and Distribution License (the "License"). 634709573Sraf * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 2134709573Sraf 227c478bd9Sstevel@tonic-gate /* 23*f48205beScasper * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #include <sys/param.h> 337c478bd9Sstevel@tonic-gate #include <sys/types.h> 347c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h> 357c478bd9Sstevel@tonic-gate #include <sys/systm.h> 367c478bd9Sstevel@tonic-gate #include <sys/tuneable.h> 377c478bd9Sstevel@tonic-gate #include <sys/errno.h> 387c478bd9Sstevel@tonic-gate #include <sys/var.h> 397c478bd9Sstevel@tonic-gate #include <sys/signal.h> 407c478bd9Sstevel@tonic-gate #include <sys/time.h> 417c478bd9Sstevel@tonic-gate #include <sys/sysconfig.h> 427c478bd9Sstevel@tonic-gate #include <sys/resource.h> 437c478bd9Sstevel@tonic-gate #include <sys/ulimit.h> 447c478bd9Sstevel@tonic-gate #include <sys/unistd.h> 457c478bd9Sstevel@tonic-gate #include <sys/debug.h> 467c478bd9Sstevel@tonic-gate #include <sys/cpuvar.h> 477c478bd9Sstevel@tonic-gate #include <sys/mman.h> 487c478bd9Sstevel@tonic-gate #include <sys/timer.h> 497c478bd9Sstevel@tonic-gate #include <sys/zone.h> 507c478bd9Sstevel@tonic-gate 517c478bd9Sstevel@tonic-gate long 527c478bd9Sstevel@tonic-gate sysconfig(int which) 537c478bd9Sstevel@tonic-gate { 547c478bd9Sstevel@tonic-gate switch (which) { 557c478bd9Sstevel@tonic-gate 567c478bd9Sstevel@tonic-gate /* 577c478bd9Sstevel@tonic-gate * if it is not handled in mach_sysconfig either 587c478bd9Sstevel@tonic-gate * it must be EINVAL. 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate default: 617c478bd9Sstevel@tonic-gate return (mach_sysconfig(which)); /* `uname -i`/os */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate case _CONFIG_CLK_TCK: 647c478bd9Sstevel@tonic-gate return ((long)hz); /* clock frequency per second */ 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate case _CONFIG_PROF_TCK: 677c478bd9Sstevel@tonic-gate return ((long)hz); /* profiling clock freq per sec */ 687c478bd9Sstevel@tonic-gate 697c478bd9Sstevel@tonic-gate case _CONFIG_NGROUPS: 707c478bd9Sstevel@tonic-gate /* 717c478bd9Sstevel@tonic-gate * Maximum number of supplementary groups. 727c478bd9Sstevel@tonic-gate */ 737c478bd9Sstevel@tonic-gate return (ngroups_max); 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate case _CONFIG_OPEN_FILES: 767c478bd9Sstevel@tonic-gate /* 777c478bd9Sstevel@tonic-gate * Maximum number of open files (soft limit). 787c478bd9Sstevel@tonic-gate */ 797c478bd9Sstevel@tonic-gate { 807c478bd9Sstevel@tonic-gate rlim64_t fd_ctl; 817c478bd9Sstevel@tonic-gate mutex_enter(&curproc->p_lock); 827c478bd9Sstevel@tonic-gate fd_ctl = rctl_enforced_value( 837c478bd9Sstevel@tonic-gate rctlproc_legacy[RLIMIT_NOFILE], curproc->p_rctls, 847c478bd9Sstevel@tonic-gate curproc); 857c478bd9Sstevel@tonic-gate mutex_exit(&curproc->p_lock); 867c478bd9Sstevel@tonic-gate return ((ulong_t)fd_ctl); 877c478bd9Sstevel@tonic-gate } 887c478bd9Sstevel@tonic-gate 897c478bd9Sstevel@tonic-gate case _CONFIG_CHILD_MAX: 907c478bd9Sstevel@tonic-gate /* 917c478bd9Sstevel@tonic-gate * Maximum number of processes. 927c478bd9Sstevel@tonic-gate */ 937c478bd9Sstevel@tonic-gate return (v.v_maxup); 947c478bd9Sstevel@tonic-gate 957c478bd9Sstevel@tonic-gate case _CONFIG_POSIX_VER: 967c478bd9Sstevel@tonic-gate return (_POSIX_VERSION); /* current POSIX version */ 977c478bd9Sstevel@tonic-gate 987c478bd9Sstevel@tonic-gate case _CONFIG_PAGESIZE: 997c478bd9Sstevel@tonic-gate return (PAGESIZE); 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate case _CONFIG_XOPEN_VER: 1027c478bd9Sstevel@tonic-gate return (_XOPEN_VERSION); /* current XOPEN version */ 1037c478bd9Sstevel@tonic-gate 1047c478bd9Sstevel@tonic-gate case _CONFIG_NPROC_CONF: 1057c478bd9Sstevel@tonic-gate return (zone_ncpus_get(curproc->p_zone)); 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate case _CONFIG_NPROC_ONLN: 1087c478bd9Sstevel@tonic-gate return (zone_ncpus_online_get(curproc->p_zone)); 1097c478bd9Sstevel@tonic-gate 1107c478bd9Sstevel@tonic-gate case _CONFIG_NPROC_MAX: 1117c478bd9Sstevel@tonic-gate return (max_ncpus); 1127c478bd9Sstevel@tonic-gate 1137c478bd9Sstevel@tonic-gate case _CONFIG_STACK_PROT: 1147c478bd9Sstevel@tonic-gate return (curproc->p_stkprot & ~PROT_USER); 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate case _CONFIG_AIO_LISTIO_MAX: 1177c478bd9Sstevel@tonic-gate return (_AIO_LISTIO_MAX); 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate case _CONFIG_AIO_MAX: 1207c478bd9Sstevel@tonic-gate return (_AIO_MAX); 1217c478bd9Sstevel@tonic-gate 1227c478bd9Sstevel@tonic-gate case _CONFIG_AIO_PRIO_DELTA_MAX: 1237c478bd9Sstevel@tonic-gate return (0); 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate case _CONFIG_DELAYTIMER_MAX: 1267c478bd9Sstevel@tonic-gate return (INT_MAX); 1277c478bd9Sstevel@tonic-gate 1287c478bd9Sstevel@tonic-gate case _CONFIG_MQ_OPEN_MAX: 1297c478bd9Sstevel@tonic-gate return (_MQ_OPEN_MAX); 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate case _CONFIG_MQ_PRIO_MAX: 1327c478bd9Sstevel@tonic-gate return (_MQ_PRIO_MAX); 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate case _CONFIG_RTSIG_MAX: 1357c478bd9Sstevel@tonic-gate return (_SIGRTMAX - _SIGRTMIN + 1); 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate case _CONFIG_SEM_NSEMS_MAX: 1387c478bd9Sstevel@tonic-gate return (_SEM_NSEMS_MAX); 1397c478bd9Sstevel@tonic-gate 1407c478bd9Sstevel@tonic-gate case _CONFIG_SEM_VALUE_MAX: 1417c478bd9Sstevel@tonic-gate return (_SEM_VALUE_MAX); 1427c478bd9Sstevel@tonic-gate 1437c478bd9Sstevel@tonic-gate case _CONFIG_SIGQUEUE_MAX: 1447c478bd9Sstevel@tonic-gate return (_SIGQUEUE_MAX); 1457c478bd9Sstevel@tonic-gate 1467c478bd9Sstevel@tonic-gate case _CONFIG_SIGRT_MIN: 1477c478bd9Sstevel@tonic-gate return (_SIGRTMIN); 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate case _CONFIG_SIGRT_MAX: 1507c478bd9Sstevel@tonic-gate return (_SIGRTMAX); 1517c478bd9Sstevel@tonic-gate 1527c478bd9Sstevel@tonic-gate case _CONFIG_TIMER_MAX: 15334709573Sraf return (timer_max); 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate case _CONFIG_PHYS_PAGES: 1567c478bd9Sstevel@tonic-gate return (physinstalled); 1577c478bd9Sstevel@tonic-gate 1587c478bd9Sstevel@tonic-gate case _CONFIG_AVPHYS_PAGES: 1597c478bd9Sstevel@tonic-gate return (freemem); 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate case _CONFIG_MAXPID: 1627c478bd9Sstevel@tonic-gate return (maxpid); 1637c478bd9Sstevel@tonic-gate 1647c478bd9Sstevel@tonic-gate case _CONFIG_CPUID_MAX: 1657c478bd9Sstevel@tonic-gate return (max_cpuid); 1667c478bd9Sstevel@tonic-gate 167*f48205beScasper case _CONFIG_EPHID_MAX: 168*f48205beScasper return (MAXEPHUID); 169*f48205beScasper 1707c478bd9Sstevel@tonic-gate case _CONFIG_SYMLOOP_MAX: 1717c478bd9Sstevel@tonic-gate return (MAXSYMLINKS); 1727c478bd9Sstevel@tonic-gate } 1737c478bd9Sstevel@tonic-gate } 174