forked from PX4/NuttX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
limits.h
227 lines (189 loc) · 7.88 KB
/
limits.h
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
/********************************************************************************
* include/limits.h
*
* Copyright (C) 2007-2009, 2014 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <[email protected]>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name NuttX 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.
*
********************************************************************************/
#ifndef __INCLUDE_LIMITS_H
#define __INCLUDE_LIMITS_H
/********************************************************************************
* Included Files
********************************************************************************/
#include <nuttx/config.h>
/* Architecture specific limits */
#include <arch/limits.h>
/********************************************************************************
* Pre-processor Definitions
********************************************************************************/
/* Default values for user configurable limits **********************************/
/* Maximum number of bytes in a filename (not including terminating null). */
#ifndef CONFIG_NAME_MAX
# define CONFIG_NAME_MAX 32
#endif
/* Maximum number of bytes in a pathname, including the terminating null
* character.
*/
#ifndef CONFIG_PATH_MAX
# if CONFIG_NAME_MAX < 64
# define CONFIG_PATH_MAX (4*CONFIG_NAME_MAX + 1)
# else
# define CONFIG_PATH_MAX 256
# endif
#endif
/* Configurable limits required by POSIX ****************************************
*
* Required for all implementations:
*
* _POSIX_ARG_MAX Total length of string arguments
* _POSIX_CHILD_MAX Number of child tasks active
* _POSIX_LINK_MAX The number of links a file can have
* _POSIX_MAX_CANON Number bytes in TTY canonical input queue
* _POSIX_MAX_INPUT Number bytes in TTY canonical input queue
* _POSIX_NAME_MAX Number of bytes in a file or pathname component
* _POSIX_NGROUPS_MAX Number supplementary group IDs
* _POSIX_OPEN_MAX Number of files a task can have open at once
* _POSIX_PATH_MAX Number of bytes in a full pathname (including NULL)
* _POSIX_PIPE_BUF Number of bytes for atomic write into pipe
* _POSIX_SSIZE_MAX Largest filesystem write; also max value of ssize_t
* _POSIX_STREAM_MAX Number of std I/O streams open at once
* _POSIX_TZNAME_MAX Max number of bytes of a timezone name
*
* Required for sigqueue
*
* _POSIX_RTSIG_MAX Difference between SIGRTMIN and SIGRTMAX
* _POSIX_SIGQUEUE_MAX Max number signals a task can queue
*
* Required for POSIX timers
*
* _POSIX_DELAYTIMER_MAX Max number timer overruns
* _POSIX_TIMER_MAX Max number of timers per task
* _POSIX_CLOCKRES_MIN Clock resolution in nanoseconds
*
* Required for asynchronous I/O
*
* _POSIX_AIO_LISTIO_MAX Max number of AIOs in single listio call
* _POSIX_AIO_MAX Max number of simultaneous AIO operations
*
* Required for POSIX message passing
*
* _POSIX_MQ_OPEN_MAX Max number message queues task may open (mq_open)
* _POSIX_MQ_PRIO_MAX Max message priority (mq_send)
*
* Required for POSIX semaphores
*
* _POSIX_SEM_NSEMS_MAX Max number of open semaphores per task
* _POSIX_SEM_VALUE_MAX Max value a semaphore may have
*/
#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 CONFIG_NAME_MAX
#define _POSIX_NGROUPS_MAX 0
#define _POSIX_OPEN_MAX CONFIG_NFILE_DESCRIPTORS
#define _POSIX_PATH_MAX CONFIG_PATH_MAX
#define _POSIX_PIPE_BUF 512
#define _POSIX_STREAM_MAX CONFIG_NFILE_STREAMS
#define _POSIX_TZNAME_MAX 3
#ifdef CONFIG_SMALL_MEMORY
#define _POSIX_SSIZE_MAX 32767 /* See sys/types.h */
#define _POSIX_SSIZE_MIN -32768
#else /* CONFIG_SMALL_MEMORY */
#define _POSIX_SSIZE_MAX 2147483647 /* See sys/types.h */
#define _POSIX_SSIZE_MIN -2147483648
#endif /* CONFIG_SMALL_MEMORY */
/* Required for sigqueue */
#define _POSIX_RTSIG_MAX 31
#define _POSIX_SIGQUEUE_MAX 32
/* Required for POSIX timers.
*
* _POSIX_DELAYTIMER_MAX is the number of timer expiration overruns.
*
* _POSIX_TIMER_MAX is the per-process number of timers.
*
* _POSIX_CLOCKRES_MIN is the resolution of the CLOCK_REALTIME clock in
* nanoseconds. CLOCK_REALTIME is controlled by the NuttX system time.
* The default value is the system timer which has a resolution of 1000
* microseconds. This default setting can be overridden by defining the
* clock interval in microseconds as CONFIG_USEC_PER_TICK in the NuttX
* configuration file.
*/
#define _POSIX_DELAYTIMER_MAX 32
#define _POSIX_TIMER_MAX 32
#ifdef CONFIG_USEC_PER_TICK
# define _POSIX_CLOCKRES_MIN ((CONFIG_USEC_PER_TICK)*1000)
#else
# define _POSIX_CLOCKRES_MIN (10*1000000)
#endif
/* Required for asynchronous I/O */
#define _POSIX_AIO_LISTIO_MAX 2
#define _POSIX_AIO_MAX 1
/* Required for POSIX message passing */
#define _POSIX_MQ_OPEN_MAX 8
#define _POSIX_MQ_PRIO_MAX UCHAR_MAX
/* Required for POSIX semaphores */
#define _POSIX_SEM_NSEMS_MAX INT_MAX
#define _POSIX_SEM_VALUE_MAX 0x7fff
/* Actual limits. These values may be increased from the POSIX minimum
* values above or made indeterminate
*/
#define ARG_MAX _POSIX_ARG_MAX
#define CHILD_MAX _POSIX_CHILD_MAX
#define LINK_MAX _POSIX_LINK_MAX
#define MAX_CANON _POSIX_MAX_CANON
#define MAX_INPUT _POSIX_MAX_INPUT
#define NAME_MAX _POSIX_NAME_MAX
#define NGROUPS_MAX _POSIX_NGROUPS_MAX
#define OPEN_MAX _POSIX_OPEN_MAX
#define PATH_MAX _POSIX_PATH_MAX
#define PIPE_BUF _POSIX_PIPE_BUF
#define SSIZE_MAX _POSIX_SSIZE_MAX
#define SSIZE_MIN _POSIX_SSIZE_MIN
#define STREAM_MAX _POSIX_STREAM_MAX
#define TZNAME_MAX _POSIX_TZNAME_MAX
#define TZ_MAX_TIMES CONFIG_LIBC_TZ_MAX_TIMES
#define TZ_MAX_TYPES CONFIG_LIBC_TZ_MAX_TYPES
#define RTSIG_MAX _POSIX_RTSIG_MAX
#define SIGQUEUE_MAX _POSIX_SIGQUEUE_MAX
#define DELAYTIMER_MAX _POSIX_DELAYTIMER_MAX
#define TIMER_MAX _POSIX_TIMER_MAX
#define CLOCKRES_MIN _POSIX_CLOCKRES_MIN
/* Required for asynchronous I/O */
#define AIO_LISTIO_MAX _POSIX_AIO_LISTIO_MAX
#define AIO_MAX _POSIX_AIO_MAX
/* Required for POSIX message passing */
#define MQ_OPEN_MAX _POSIX_MQ_OPEN_MAX
#define MQ_PRIO_MAX _POSIX_MQ_PRIO_MAX
/* Required for POSIX semaphores */
#define SEM_NSEMS_MAX _POSIX_SEM_NSEMS_MAX
#define SEM_VALUE_MAX _POSIX_SEM_VALUE_MAX
#endif /* __INCLUDE_LIMITS_H */