17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
57c478bdstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only
67c478bdstevel@tonic-gate * (the "License").  You may not use this file except in compliance
77c478bdstevel@tonic-gate * with the License.
87c478bdstevel@tonic-gate *
97c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
117c478bdstevel@tonic-gate * See the License for the specific language governing permissions
127c478bdstevel@tonic-gate * and limitations under the License.
137c478bdstevel@tonic-gate *
147c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
157c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
177c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
187c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bdstevel@tonic-gate *
207c478bdstevel@tonic-gate * CDDL HEADER END
217c478bdstevel@tonic-gate */
227c478bdstevel@tonic-gate/*
237c478bdstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
247c478bdstevel@tonic-gate * Use is subject to license terms.
257c478bdstevel@tonic-gate */
267c478bdstevel@tonic-gate
277c478bdstevel@tonic-gate/*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
287c478bdstevel@tonic-gate/*	  All Rights Reserved  	*/
297c478bdstevel@tonic-gate
307c478bdstevel@tonic-gate/*
317c478bdstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988
327c478bdstevel@tonic-gate * The Regents of the University of California
337c478bdstevel@tonic-gate * All Rights Reserved
347c478bdstevel@tonic-gate *
357c478bdstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from
367c478bdstevel@tonic-gate * software developed by the University of California, Berkeley, and its
377c478bdstevel@tonic-gate * contributors.
387c478bdstevel@tonic-gate */
397c478bdstevel@tonic-gate
407c478bdstevel@tonic-gate#ifndef	_SYS_PARAM_H
417c478bdstevel@tonic-gate#define	_SYS_PARAM_H
427c478bdstevel@tonic-gate
437c478bdstevel@tonic-gate
447c478bdstevel@tonic-gate/*
457c478bdstevel@tonic-gate * Fundamental variables; don't change too often.
467c478bdstevel@tonic-gate *
477c478bdstevel@tonic-gate * This file is included here for compatibility with
487c478bdstevel@tonic-gate * SunOS, but it does *not* include all the values
497c478bdstevel@tonic-gate * define in the SunOS version of this file.
507c478bdstevel@tonic-gate */
517c478bdstevel@tonic-gate
527c478bdstevel@tonic-gate#include <sys/isa_defs.h>
537c478bdstevel@tonic-gate#include <limits.h>
547c478bdstevel@tonic-gate#include <unistd.h>
557c478bdstevel@tonic-gate
567c478bdstevel@tonic-gate#ifdef __cplusplus
577c478bdstevel@tonic-gateextern "C" {
587c478bdstevel@tonic-gate#endif
597c478bdstevel@tonic-gate
607c478bdstevel@tonic-gate#ifndef	MAX_INPUT
617c478bdstevel@tonic-gate#define	MAX_INPUT	512	/* Maximum bytes stored in the input queue */
627c478bdstevel@tonic-gate#endif
637c478bdstevel@tonic-gate
647c478bdstevel@tonic-gate#ifndef	MAX_CANON
657c478bdstevel@tonic-gate#define	MAX_CANON	256	/* Maximum bytes for canoical processing */
667c478bdstevel@tonic-gate#endif
677c478bdstevel@tonic-gate
687c478bdstevel@tonic-gate#define	UID_NOBODY	60001
697c478bdstevel@tonic-gate#define	GID_NOBODY	60001
707c478bdstevel@tonic-gate
717c478bdstevel@tonic-gate#define	UID_NOACCESS	60002	/* user ID no access */
727c478bdstevel@tonic-gate
737c478bdstevel@tonic-gate#define	MAXPID	((pid_t)sysconf(_SC_MAXPID))	/* max process id */
747c478bdstevel@tonic-gate#define	MAXUID	2147483647	/* max user id */
757c478bdstevel@tonic-gate#define	MAXLINK	32767		/* max links */
767c478bdstevel@tonic-gate
777c478bdstevel@tonic-gate#define	NMOUNT		40	/* est. of # mountable fs for quota calc */
787c478bdstevel@tonic-gate
797c478bdstevel@tonic-gate/* The values below are defined in limits.h */
807c478bdstevel@tonic-gate#define	NOFILE	OPEN_MAX	/* max open files per process */
817c478bdstevel@tonic-gate
827c478bdstevel@tonic-gate#define	CANBSIZ	256		/* max size of typewriter line	*/
837c478bdstevel@tonic-gate#define	HZ	((int)sysconf(_SC_CLK_TCK))  /* ticks/second of the clock */
847c478bdstevel@tonic-gate#define	TICK	(1000000000/((int)sysconf(_SC_CLK_TCK)))
857c478bdstevel@tonic-gate
867c478bdstevel@tonic-gate#define	NCARGS	0x100000	/* # characters in exec arglist */
877c478bdstevel@tonic-gate				/*   must be multiple of NBPW.  */
887c478bdstevel@tonic-gate/*
897c478bdstevel@tonic-gate * These define the maximum and minimum allowable values of the
907c478bdstevel@tonic-gate * configurable parameter NGROUPS_MAX.
917c478bdstevel@tonic-gate */
927c478bdstevel@tonic-gate#define	NGROUPS_UMAX	32
937c478bdstevel@tonic-gate#define	NGROUPS_UMIN	8
947c478bdstevel@tonic-gate
957c478bdstevel@tonic-gate#define	NGROUPS		NGROUPS_MAX	/* max number groups, from limits.h */
967c478bdstevel@tonic-gate#define	NOGROUP		-1	/* marker for empty group set member */
977c478bdstevel@tonic-gate
987c478bdstevel@tonic-gate/*
997c478bdstevel@tonic-gate * Priorities.  Should not be altered too much.
1007c478bdstevel@tonic-gate */
1017c478bdstevel@tonic-gate
1027c478bdstevel@tonic-gate#define	PMASK	0177
1037c478bdstevel@tonic-gate#define	PCATCH	0400
1047c478bdstevel@tonic-gate#define	PNOSTOP	01000
1057c478bdstevel@tonic-gate#define	PSWP	0
1067c478bdstevel@tonic-gate#define	PINOD	10
1077c478bdstevel@tonic-gate#define	PSNDD	PINOD
1087c478bdstevel@tonic-gate#define	PAMAP	PINOD
1097c478bdstevel@tonic-gate#define	PPMAP	PINOD
1107c478bdstevel@tonic-gate#define	PRIBIO	20
1117c478bdstevel@tonic-gate#define	PZERO	25
1127c478bdstevel@tonic-gate#define	PMEM	0
1137c478bdstevel@tonic-gate#define	NZERO	20
1147c478bdstevel@tonic-gate#define	PPIPE	26
1157c478bdstevel@tonic-gate#define	PVFS	27
1167c478bdstevel@tonic-gate#define	PWAIT	30
1177c478bdstevel@tonic-gate#define	PLOCK	35
1187c478bdstevel@tonic-gate#define	PSLEP	39
1197c478bdstevel@tonic-gate#define	PUSER	60
1207c478bdstevel@tonic-gate#define	PIDLE	127
1217c478bdstevel@tonic-gate
1227c478bdstevel@tonic-gate/*
1237c478bdstevel@tonic-gate * Fundamental constants of the implementation--cannot be changed easily.
1247c478bdstevel@tonic-gate */
1257c478bdstevel@tonic-gate
1267c478bdstevel@tonic-gate#define	NBPS	0x20000		/* Number of bytes per segment */
1277c478bdstevel@tonic-gate#define	NBPW	sizeof (int)	/* number of bytes in an integer */
1287c478bdstevel@tonic-gate
1297c478bdstevel@tonic-gate#define	CMASK	0		/* default mask for file creation */
1307c478bdstevel@tonic-gate#define	CDLIMIT	(1L<<11)	/* default max write address */
1317c478bdstevel@tonic-gate#define	NODEV	(dev_t)(-1)
1327c478bdstevel@tonic-gate#define	NBPSCTR		512	/* Bytes per disk sector.	*/
1337c478bdstevel@tonic-gate#define	UBSIZE		512	/* unix block size.		*/
1347c478bdstevel@tonic-gate#define	SCTRSHFT	9	/* Shift for BPSECT.		*/
1357c478bdstevel@tonic-gate
1367c478bdstevel@tonic-gate#define	lobyte(X)	(((unsigned char *)&(X))[1])
1377c478bdstevel@tonic-gate#define	hibyte(X)	(((unsigned char *)&(X))[0])
1387c478bdstevel@tonic-gate#define	loword(X)	(((ushort_t *)&(X))[1])
1397c478bdstevel@tonic-gate#define	hiword(X)	(((ushort_t *)&(X))[0])
1407c478bdstevel@tonic-gate
1417c478bdstevel@tonic-gate/* REMOTE -- whether machine is primary, secondary, or regular */
1427c478bdstevel@tonic-gate#define	SYSNAME 9		/* # chars in system name */
1437c478bdstevel@tonic-gate#define	PREMOTE 39
1447c478bdstevel@tonic-gate
1457c478bdstevel@tonic-gate/*
1467c478bdstevel@tonic-gate * MAXPATHLEN defines the longest permissible path length,
1477c478bdstevel@tonic-gate * including the terminating null, after expanding symbolic links.
1487c478bdstevel@tonic-gate * MAXSYMLINKS defines the maximum number of symbolic links
1497c478bdstevel@tonic-gate * that may be expanded in a path name. It should be set high
1507c478bdstevel@tonic-gate * enough to allow all legitimate uses, but halt infinite loops
1517c478bdstevel@tonic-gate * reasonably quickly.
1527c478bdstevel@tonic-gate * MAXNAMELEN is the length (including the terminating null) of
1537c478bdstevel@tonic-gate * the longest permissible file (component) name.
1547c478bdstevel@tonic-gate */
1557c478bdstevel@tonic-gate#define	MAXPATHLEN	1024
1567c478bdstevel@tonic-gate#define	MAXSYMLINKS	20
1577c478bdstevel@tonic-gate#define	MAXNAMELEN	256
1587c478bdstevel@tonic-gate
1597c478bdstevel@tonic-gate#ifndef	NADDR
1607c478bdstevel@tonic-gate#define	NADDR 13
1617c478bdstevel@tonic-gate#endif
1627c478bdstevel@tonic-gate
1637c478bdstevel@tonic-gate/*
1647c478bdstevel@tonic-gate * The following are defined to be the same as
1657c478bdstevel@tonic-gate * defined in /usr/include/limits.h.  They are
1667c478bdstevel@tonic-gate * needed for pipe and FIFO compatibility.
1677c478bdstevel@tonic-gate */
1687c478bdstevel@tonic-gate#ifndef	PIPE_BUF	/* max # bytes atomic in write to a pipe */
1697c478bdstevel@tonic-gate#define	PIPE_BUF	5120
1707c478bdstevel@tonic-gate#endif	/* PIPE_BUF */
1717c478bdstevel@tonic-gate
1727c478bdstevel@tonic-gate#ifndef	PIPE_MAX	/* max # bytes written to a pipe in a write */
1737c478bdstevel@tonic-gate#define	PIPE_MAX	5120
1747c478bdstevel@tonic-gate#endif	/* PIPE_MAX */
1757c478bdstevel@tonic-gate
1767c478bdstevel@tonic-gate#define	PIPEBUF PIPE_BUF	/* pipe buffer size */
1777c478bdstevel@tonic-gate
1787c478bdstevel@tonic-gate#ifndef	NBBY
1797c478bdstevel@tonic-gate#define	NBBY	8			/* number of bits per byte */
1807c478bdstevel@tonic-gate#endif
1817c478bdstevel@tonic-gate
1827c478bdstevel@tonic-gate/* macros replacing interleaving functions */
1837c478bdstevel@tonic-gate#define	dkblock(bp)	((bp)->b_blkno)
1847c478bdstevel@tonic-gate#define	dkunit(bp)	(minor((bp)->b_dev) >> 3)
1857c478bdstevel@tonic-gate
1867c478bdstevel@tonic-gate/*
1877c478bdstevel@tonic-gate * File system parameters and macros.
1887c478bdstevel@tonic-gate *
1897c478bdstevel@tonic-gate * The file system is made out of blocks of at most MAXBSIZE units,
1907c478bdstevel@tonic-gate * with smaller units (fragments) only in the last direct block.
1917c478bdstevel@tonic-gate * MAXBSIZE primarily determines the size of buffers in the buffer
1927c478bdstevel@tonic-gate * pool. It may be made larger without any effect on existing
1937c478bdstevel@tonic-gate * file systems; however making it smaller make make some file
1947c478bdstevel@tonic-gate * systems unmountable.
1957c478bdstevel@tonic-gate *
1967c478bdstevel@tonic-gate * Note that the blocked devices are assumed to have DEV_BSIZE
1977c478bdstevel@tonic-gate * "sectors" and that fragments must be some multiple of this size.
1987c478bdstevel@tonic-gate */
1997c478bdstevel@tonic-gate#define	MAXBSIZE	8192
2007c478bdstevel@tonic-gate#define	DEV_BSIZE	512
2017c478bdstevel@tonic-gate#define	DEV_BSHIFT	9		/* log2(DEV_BSIZE) */
2027c478bdstevel@tonic-gate#define	MAXFRAG 	8
2037c478bdstevel@tonic-gate
2047c478bdstevel@tonic-gate#ifdef  _LP64
2057c478bdstevel@tonic-gate#define	MAXOFF_T	0x7fffffffffffffffl
2067c478bdstevel@tonic-gate#define	MAXOFFSET_T	0x7fffffffffffffffll
2077c478bdstevel@tonic-gate#else
2087c478bdstevel@tonic-gate#define	MAXOFF_T	0x7fffffff
2097c478bdstevel@tonic-gate#ifndef _LONGLONG_TYPE
2107c478bdstevel@tonic-gate#define	MAXOFFSET_T	0x7fffffff
2117c478bdstevel@tonic-gate#else
2127c478bdstevel@tonic-gate#define	MAXOFFSET_T	0x7fffffffffffffffLL
2137c478bdstevel@tonic-gate#endif
2147c478bdstevel@tonic-gate#endif  /* _LP64 */
2157c478bdstevel@tonic-gate
2167c478bdstevel@tonic-gate#define	btodb(bytes)			/* calculates (bytes / DEV_BSIZE) */ \
2177c478bdstevel@tonic-gate	((unsigned)(bytes) >> DEV_BSHIFT)
2187c478bdstevel@tonic-gate#define	dbtob(db)			/* calculates (db * DEV_BSIZE) */ \
2197c478bdstevel@tonic-gate	((unsigned)(db) << DEV_BSHIFT)
2207c478bdstevel@tonic-gate
2217c478bdstevel@tonic-gate/*
2227c478bdstevel@tonic-gate * PAGES* describes the logical page size used by the system.
2237c478bdstevel@tonic-gate */
2247c478bdstevel@tonic-gate
2257c478bdstevel@tonic-gate#define	PAGESIZE	(sysconf(_SC_PAGESIZE))	/* All the above, for logical */
2267c478bdstevel@tonic-gate#define	PAGEOFFSET	(PAGESIZE - 1)
2277c478bdstevel@tonic-gate#define	PAGEMASK	(~PAGEOFFSET)
2287c478bdstevel@tonic-gate
2297c478bdstevel@tonic-gate/*
2307c478bdstevel@tonic-gate * Some random macros for units conversion.
2317c478bdstevel@tonic-gate */
2327c478bdstevel@tonic-gate
2337c478bdstevel@tonic-gate/*
2347c478bdstevel@tonic-gate * pages to bytes, and back (with and without rounding)
2357c478bdstevel@tonic-gate */
2367c478bdstevel@tonic-gate#define	ptob(x)		((x) * PAGESIZE)
2377c478bdstevel@tonic-gate#define	btop(x)		(((unsigned)(x)) / PAGESIZE)
2387c478bdstevel@tonic-gate#define	btopr(x)	((((unsigned)(x) + PAGEOFFSET) / PAGESIZE))
2397c478bdstevel@tonic-gate
2407c478bdstevel@tonic-gate/*
2417c478bdstevel@tonic-gate * Signals
2427c478bdstevel@tonic-gate */
2437c478bdstevel@tonic-gate
2447c478bdstevel@tonic-gate#include <sys/signal.h>
2457c478bdstevel@tonic-gate#include <sys/types.h>
2467c478bdstevel@tonic-gate
2477c478bdstevel@tonic-gate/*
2487c478bdstevel@tonic-gate * bit map related macros
2497c478bdstevel@tonic-gate */
2507c478bdstevel@tonic-gate#define	setbit(a, i)	((a)[(i)/NBBY] |= 1<<((i)%NBBY))
2517c478bdstevel@tonic-gate#define	clrbit(a, i)	((a)[(i)/NBBY] &= ~(1<<((i)%NBBY)))
2527c478bdstevel@tonic-gate#define	isset(a, i)	((a)[(i)/NBBY] & (1<<((i)%NBBY)))
2537c478bdstevel@tonic-gate#define	isclr(a, i)	(((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
2547c478bdstevel@tonic-gate
2557c478bdstevel@tonic-gate/*
2567c478bdstevel@tonic-gate * Macros for fast min/max.
2577c478bdstevel@tonic-gate */
2587c478bdstevel@tonic-gate#ifndef	MIN
2597c478bdstevel@tonic-gate#define	MIN(a, b)	(((a) < (b))?(a):(b))
2607c478bdstevel@tonic-gate#endif
2617c478bdstevel@tonic-gate#ifndef	MAX
2627c478bdstevel@tonic-gate#define	MAX(a, b)	(((a) > (b))?(a):(b))
2637c478bdstevel@tonic-gate#endif
2647c478bdstevel@tonic-gate
2657c478bdstevel@tonic-gate#define	howmany(x, y)	(((x)+((y)-1))/(y))
2667c478bdstevel@tonic-gate#define	roundup(x, y)	((((x)+((y)-1))/(y))*(y))
2677c478bdstevel@tonic-gate
2687c478bdstevel@tonic-gate/*
2697c478bdstevel@tonic-gate * Scale factor for scaled integers used to count
2707c478bdstevel@tonic-gate * %cpu time and load averages.
2717c478bdstevel@tonic-gate */
2727c478bdstevel@tonic-gate#define	FSHIFT	8		/* bits to right of fixed binary point */
2737c478bdstevel@tonic-gate#define	FSCALE	(1<<FSHIFT)
2747c478bdstevel@tonic-gate
2757c478bdstevel@tonic-gate/*
2767c478bdstevel@tonic-gate * Maximum size of hostname recognized and stored in the kernel.
2777c478bdstevel@tonic-gate * Same as in /usr/include/netdb.h
2787c478bdstevel@tonic-gate */
2797c478bdstevel@tonic-gate#ifndef	MAXHOSTNAMELEN
2807c478bdstevel@tonic-gate#define	MAXHOSTNAMELEN	256
2817c478bdstevel@tonic-gate#endif
2827c478bdstevel@tonic-gate
2837c478bdstevel@tonic-gate#ifdef __cplusplus
2847c478bdstevel@tonic-gate}
2857c478bdstevel@tonic-gate#endif
2867c478bdstevel@tonic-gate
2877c478bdstevel@tonic-gate#endif	/* _SYS_PARAM_H */
288