/*
 * Copyright (c) 1996-2003 MIPS Technologies, Inc.
 * 
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 *      * Redistributions of source code must retain the above copyright
 *        notice, this list of conditions and the following disclaimer.
 *      * Redistributions in binary form must reproduce the above
 *      copyright
 *        notice, this list of conditions and the following disclaimer
 *        in the documentation and/or other materials provided with
 *        the distribution.
 *      * Neither the name of MIPS Technologies Inc. nor the names of its
 *        contributors may be used to endorse or promote products derived
 *        from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * limits.h : machine and opertaing system limit definitions
 */


#ifndef __LIMITS_H
#define __LIMITS_H

/* processor dependent limits in here */
#include <machine/limits.h>

#if defined _POSIX_SOURCE || _POSIX_C_SOURCE >= 1 || defined _XOPEN_SOURCE

/* These are fixed values defined by the POSIX standard and
   are minumums */
#define _POSIX_ARG_MAX		4096
#define _POSIX_CHILD_MAX	6
#define _POSIX_LINK_MAX		8
#define _POSIX_MAX_CANON	255
#define _POSIX_MAX_INPUT	255
#define _POSIX_NAME_MAX		14
#define _POSIX_NGROUPS_MAX	0
#define _POSIX_OPEN_MAX		16
#define	_POSIX_FD_SETSIZE	_POSIX_OPEN_MAX
#define _POSIX_PATH_MAX		255
#define _POSIX_PIPE_BUF		512
#define	_POSIX_HIWAT		_POSIX_PIPE_BUF
#define	_POSIX_TZNAME_MAX	3
#define	_POSIX_STREAM_MAX	8
#define	_POSIX_SSIZE_MAX	32767
#define _POSIX_TTY_NAME_MAX	12
#define	_POSIX_QLIMIT		1
#define	_POSIX_UIO_MAXIOV	16
#define	_POSIX_LOGIN_NAME_MAX	9
#define _POSIX_CLOCKRES_MIN	20000000

/* POSIX real-time defined minimal maximums */
#define _POSIX_AIO_LISTIO_MAX	2
#define _POSIX_AIO_MAX		1
#define _POSIX_DELAYTIMER_MAX  	32
#define _POSIX_MQ_OPEN_MAX	8
#define _POSIX_MQ_PRIO_MAX	32
#define _POSIX_RTSIG_MAX	8
#define _POSIX_SIGQUEUE_MAX	32
#define _POSIX_SEM_NSEMS_MAX	256
#define _POSIX_SEM_VALUE_MAX	32767
#define _POSIX_TIMER_MAX  	32

/* Pthread extensions */
#include <pthread/limits.h>

#endif /* defined _POSIX_SOURCE */

/* these values are set fairly arbritary to most/least restrictive values seen
 * they should be overrriden by sys/limits.h if we can do better 
 * (or even worse)
 */
#define ARG_MAX			4096
#define ATEXIT_MAX		32
#define NGROUPS_MAX		32 	/* largest */
#define OPEN_MAX		16 	/* smallest */
#define LINK_MAX		127
#define MAX_CANON		255
#define MAX_INPUT		255
#define NAME_MAX		256
#define PATH_MAX		1024
#define PIPE_BUF		4096
#define	TZNAME_MAX		3
#define	TTY_NAME_MAX		12

#include <sys/limits.h>

#endif /* !defined __LIMITS_H */
