From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2210) id 29FB53836C6D; Mon, 1 Feb 2021 14:59:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 29FB53836C6D Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Ken Brown To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: include/cygwin/limits.h: new header X-Act-Checkin: newlib-cygwin X-Git-Author: Ken Brown X-Git-Refname: refs/heads/master X-Git-Oldrev: 5b8358e6ed8496f9c4a7cf6ed0fa740c79ff3719 X-Git-Newrev: c09320552baa87601a3f52068283e4408d4c26b5 Message-Id: <20210201145909.29FB53836C6D@sourceware.org> Date: Mon, 1 Feb 2021 14:59:09 +0000 (GMT) X-BeenThere: cygwin-cvs@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component git logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Feb 2021 14:59:09 -0000 https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c09320552baa87601a3f52068283e4408d4c26b5 commit c09320552baa87601a3f52068283e4408d4c26b5 Author: Ken Brown Date: Fri Jan 29 11:30:44 2021 -0500 Cygwin: include/cygwin/limits.h: new header The new header defines some Cygwin-specific limits, using private names. It is included by include/limits.h. For example, we now have #define __OPEN_MAX 3200 in include/cygwin/limits.h and #define OPEN_MAX __OPEN_MAX in include/limits.h. The purpose is to hide implementation details from users who view . Diff: --- winsup/cygwin/include/cygwin/limits.h | 65 ++++++++++++++++++++++++++++ winsup/cygwin/include/limits.h | 80 +++++++++++++++-------------------- 2 files changed, 98 insertions(+), 47 deletions(-) diff --git a/winsup/cygwin/include/cygwin/limits.h b/winsup/cygwin/include/cygwin/limits.h new file mode 100644 index 000000000..f005d5742 --- /dev/null +++ b/winsup/cygwin/include/cygwin/limits.h @@ -0,0 +1,65 @@ +/* cygwin/limits.h + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _CYGWIN_LIMITS_H__ +#define _CYGWIN_LIMITS_H__ + +#define __AIO_LISTIO_MAX 32 +#define __AIO_MAX 8 +#define __AIO_PRIO_DELTA_MAX 0 + +/* 32000 is the safe value used for Windows processes when called from + Cygwin processes. */ +#define __ARG_MAX 32000 +#define __ATEXIT_MAX 32 +#define __CHILD_MAX 256 +#define __DELAYTIMER_MAX __INT_MAX__ +#define __HOST_NAME_MAX 255 +#define __IOV_MAX 1024 +#define __LOGIN_NAME_MAX 256 /* equal to UNLEN defined in w32api/lmcons.h */ +#define __MQ_OPEN_MAX 256 +#define __MQ_PRIO_MAX INT_MAX +#define __OPEN_MAX 3200 /* value of the old OPEN_MAX_MAX */ +#define __PAGESIZE 65536 +#define __PTHREAD_DESTRUCTOR_ITERATIONS 4 + +/* Tls has 1088 items - and we don't want to use them all :] */ +#define __PTHREAD_KEYS_MAX 1024 +/* Actually the minimum stack size is somewhat of a split personality. + The size parameter in a CreateThread call is the size of the initially + commited stack size, which can be specified as low as 4K. However, the + default *reserved* stack size is 1 Meg, unless the .def file specifies + another STACKSIZE value. And even if you specify a stack size below 64K, + the allocation granularity is in the way. You can never squeeze multiple + threads in the same allocation granularity slot. Oh well. */ +#define __PTHREAD_STACK_MIN 65536 + +/* FIXME: We only support one realtime signal in 32 bit mode, but + _POSIX_RTSIG_MAX is 8. */ +#if __WORDSIZE == 64 +#define __RTSIG_MAX 33 +#else +#define __RTSIG_MAX 1 +#endif +#define __SEM_VALUE_MAX 1147483648 +#define __SIGQUEUE_MAX 32 +#define __STREAM_MAX 20 +#define __SYMLOOP_MAX 10 +#define __TIMER_MAX 32 +#define __TTY_NAME_MAX 32 +#define __FILESIZEBITS 64 +#define __LINK_MAX 1024 +#define __MAX_CANON 255 +#define __MAX_INPUT 255 +#define __NAME_MAX 255 + +/* Keep in sync with __PATHNAME_MAX__ in cygwin/config.h */ +#define __PATH_MAX 4096 +#define __PIPE_BUF 4096 + +#endif /* _CYGWIN_LIMITS_H__ */ diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h index 497d45419..6bdc9b40b 100644 --- a/winsup/cygwin/include/limits.h +++ b/winsup/cygwin/include/limits.h @@ -10,6 +10,7 @@ details. */ #include #include +#include #ifndef _MACH_MACHLIMITS_H_ @@ -156,67 +157,66 @@ details. */ /* Maximum number of I/O operations in a single list I/O call supported by the implementation. */ -#define AIO_LISTIO_MAX 32 +#define AIO_LISTIO_MAX __AIO_LISTIO_MAX /* Maximum number of outstanding asynchronous I/O operations supported by the implementation. */ -#define AIO_MAX 8 +#define AIO_MAX __AIO_MAX /* The maximum amount by which a process can decrease its asynchronous I/O priority level from its own scheduling priority. Not yet implemented. */ -#define AIO_PRIO_DELTA_MAX 0 +#define AIO_PRIO_DELTA_MAX __AIO_PRIO_DELTA_MAX /* Maximum number of bytes in arguments and environment passed in an exec - call. 32000 is the safe value used for Windows processes when called - from Cygwin processes. */ + call. */ #undef ARG_MAX -#define ARG_MAX 32000 +#define ARG_MAX __ARG_MAX #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 /* Maximum number of functions that may be registered with atexit(). */ #undef ATEXIT_MAX -#define ATEXIT_MAX 32 +#define ATEXIT_MAX __ATEXIT_MAX #endif /* Maximum number of simultaneous processes per real user ID. */ #undef CHILD_MAX -#define CHILD_MAX 256 +#define CHILD_MAX __CHILD_MAX /* Maximum number of timer expiration overruns. Not yet implemented. */ #undef DELAYTIMER_MAX -#define DELAYTIMER_MAX __INT_MAX__ +#define DELAYTIMER_MAX __DELAYTIMER_MAX /* Maximum length of a host name. */ #undef HOST_NAME_MAX -#define HOST_NAME_MAX 255 +#define HOST_NAME_MAX __HOST_NAME_MAX #if __XSI_VISIBLE /* Maximum number of iovcnt in a writev (an arbitrary number) */ #undef IOV_MAX -#define IOV_MAX 1024 +#define IOV_MAX __IOV_MAX #endif /* Maximum number of characters in a login name. */ #undef LOGIN_NAME_MAX -#define LOGIN_NAME_MAX 256 /* equal to UNLEN defined in w32api/lmcons.h */ +#define LOGIN_NAME_MAX __LOGIN_NAME_MAX /* The maximum number of open message queue descriptors a process may hold. */ #undef MQ_OPEN_MAX -#define MQ_OPEN_MAX OPEN_MAX +#define MQ_OPEN_MAX __MQ_OPEN_MAX /* The maximum number of message priorities supported by the implementation. */ #undef MQ_PRIO_MAX -#define MQ_PRIO_MAX INT_MAX +#define MQ_PRIO_MAX __MQ_PRIO_MAX /* # of open files per process. This limit is returned by getdtablesize(), sysconf(_SC_OPEN_MAX), and getrlimit(RLIMIT_NOFILE). */ #undef OPEN_MAX -#define OPEN_MAX 3200 +#define OPEN_MAX __OPEN_MAX /* Size in bytes of a page. */ #undef PAGESIZE -#define PAGESIZE 65536 +#define PAGESIZE __PAGESIZE #if __XSI_VISIBLE #undef PAGE_SIZE #define PAGE_SIZE PAGESIZE @@ -225,23 +225,15 @@ details. */ /* Maximum number of attempts made to destroy a thread's thread-specific data values on thread exit. */ #undef PTHREAD_DESTRUCTOR_ITERATIONS -#define PTHREAD_DESTRUCTOR_ITERATIONS 4 +#define PTHREAD_DESTRUCTOR_ITERATIONS __PTHREAD_DESTRUCTOR_ITERATIONS /* Maximum number of data keys that can be created by a process. */ -/* Tls has 1088 items - and we don't want to use them all :] */ #undef PTHREAD_KEYS_MAX -#define PTHREAD_KEYS_MAX 1024 +#define PTHREAD_KEYS_MAX __PTHREAD_KEYS_MAX /* Minimum size in bytes of thread stack storage. */ -/* Actually the minimum stack size is somewhat of a split personality. - The size parameter in a CreateThread call is the size of the initially - commited stack size, which can be specified as low as 4K. However, the - default *reserved* stack size is 1 Meg, unless the .def file specifies - another STACKSIZE value. And even if you specify a stack size below 64K, - the allocation granularity is in the way. You can never squeeze multiple - threads in the same allocation granularity slot. Oh well. */ #undef PTHREAD_STACK_MIN -#define PTHREAD_STACK_MIN 65536 +#define PTHREAD_STACK_MIN __PTHREAD_STACK_MIN /* Maximum number of threads that can be created per process. */ /* Windows allows any arbitrary number of threads per process. */ @@ -249,14 +241,8 @@ details. */ /* #define PTHREAD_THREADS_MAX unspecified */ /* Maximum number of realtime signals reserved for application use. */ -/* FIXME: We only support one realtime signal in 32 bit mode, but - _POSIX_RTSIG_MAX is 8. */ #undef RTSIG_MAX -#if __WORDSIZE == 64 -#define RTSIG_MAX 33 -#else -#define RTSIG_MAX 1 -#endif +#define RTSIG_MAX __RTSIG_MAX /* Maximum number of semaphores that a process may have. */ /* Windows allows any arbitrary number of semaphores per process. */ @@ -265,12 +251,12 @@ details. */ /* The maximum value a semaphore may have. */ #undef SEM_VALUE_MAX -#define SEM_VALUE_MAX 1147483648 +#define SEM_VALUE_MAX __SEM_VALUE_MAX /* Maximum number of queued signals that a process may send and have pending at the receiver(s) at any time. */ #undef SIGQUEUE_MAX -#define SIGQUEUE_MAX 32 +#define SIGQUEUE_MAX __SIGQUEUE_MAX /* The maximum number of replenishment operations that may be simultaneously pending for a particular sporadic server scheduler. Not implemented. */ @@ -279,15 +265,15 @@ details. */ /* Number of streams that one process can have open at one time. */ #undef STREAM_MAX -#define STREAM_MAX 20 +#define STREAM_MAX __STREAM_MAX /* Maximum number of nested symbolic links. */ #undef SYMLOOP_MAX -#define SYMLOOP_MAX 10 +#define SYMLOOP_MAX __SYMLOOP_MAX /* Maximum number of timer expiration overruns. */ #undef TIMER_MAX -#define TIMER_MAX 32 +#define TIMER_MAX __TIMER_MAX /* Maximum length of the trace event name. Not implemented. */ #undef TRACE_EVENT_NAME_MAX @@ -311,7 +297,7 @@ details. */ /* Maximum number of characters in a tty name. */ #undef TTY_NAME_MAX -#define TTY_NAME_MAX 32 +#define TTY_NAME_MAX __TTY_NAME_MAX /* Maximum number of bytes supported for the name of a timezone (not of the TZ variable). Not implemented. */ #undef TZNAME_MAX @@ -322,35 +308,35 @@ details. */ /* Minimum bits needed to represent the maximum size of a regular file. */ #undef FILESIZEBITS -#define FILESIZEBITS 64 +#define FILESIZEBITS __FILESIZEBITS /* Maximum number of hardlinks to a file. */ #undef LINK_MAX -#define LINK_MAX 1024 +#define LINK_MAX __LINK_MAX /* Maximum number of bytes in a terminal canonical input line. */ #undef MAX_CANON -#define MAX_CANON 255 +#define MAX_CANON __MAX_CANON /* Minimum number of bytes available in a terminal input queue. */ #undef MAX_INPUT -#define MAX_INPUT 255 +#define MAX_INPUT __MAX_INPUT /* Maximum length of a path component. */ #undef NAME_MAX -#define NAME_MAX 255 +#define NAME_MAX __NAME_MAX /* Maximum length of a path given to API functions including trailing NUL. Deliberately set to the same default value as on Linux. Internal paths may be longer. */ /* Keep in sync with __PATHNAME_MAX__ in cygwin/config.h */ #undef PATH_MAX -#define PATH_MAX 4096 +#define PATH_MAX __PATH_MAX /* # of bytes in a pipe buf. This is the max # of bytes which can be written to a pipe in one atomic operation. */ #undef PIPE_BUF -#define PIPE_BUF 4096 +#define PIPE_BUF __PIPE_BUF /* Minimum number of bytes of storage actually allocated for any portion of a file. Not implemented. */