source: branches/libc-0.6/src/emx/include/sys/param.h

Last change on this file was 3929, checked in by bird, 11 years ago

trunk,0.6: syslimits.h,param.h: Lowered ARG_MAX/NCARGS by 32-bytes just to be on the safe side of the 32KB limit imposed by DosExecPgm. Corrected the comments.

  • Property cvs2svn:cvs-rev set to 1.5
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 5.4 KB
Line 
1/** @file sys/param.h
2 * BSD like sys\param.h file.
3 *
4 * TCPV40HDRS does include this file, but as we don't need to be
5 * 100% compatible we don't care.
6 */
7
8#ifndef _SYS_PARAM_H
9#define _SYS_PARAM_H
10#define _SYS_PARAM_H_ /* toolkit */
11
12#if defined (__cplusplus)
13extern "C" {
14#endif
15
16
17#if !defined (NULL)
18#if defined (__cplusplus)
19#define NULL 0
20#else
21#define NULL ((void*)0)
22#endif
23#endif
24
25
26/** @group BSD version defines.
27 * OS2: The toolkit headers define these. Resent FreeBSD release does too.
28 * Warning! Be aware that config scripts and programs may check for these and
29 * assume they're running on BSD. We might have to take out these
30 * defines.
31 * @{
32 */
33/** System version - year and month */
34#ifdef TCPV40HDRS
35#define BSD 43
36#else
37#define BSD 199506
38#endif
39#ifndef TCPV40HDRS
40/** Indicate BSD4.3 features present. */
41#define BSD4_3 1
42/** Indicate BSD4.4 features present. */
43#define BSD4_4 1
44#endif
45/** @} */
46
47
48#ifndef LOCORE
49#include "../types.h" /* #include <types.h> frequently includes the wrong header. */
50#endif
51#include <sys/syslimits.h>
52#include <sys/signal.h>
53#include <machine/param.h>
54#include <machine/limits.h>
55
56
57/** @group System Parameters (BSD flavored)
58 *
59 * @{ */
60#ifndef MAXCOMLEN
61/** Max command name remembered. */
62#define MAXCOMLEN 19
63#endif
64
65#ifndef MAXINTERP
66/** Max interpreter file name length (ELF?).
67 * OS2: Have no meaning. */
68#define MAXINTERP 12
69#endif
70
71#ifndef MAXLOGNAME
72/** Max login name length including terminating NULL. */
73#define MAXLOGNAME LOGIN_NAME_MAX
74#endif
75
76#ifndef MAXUPRC
77/** Maximum simultaneous processes. */
78#define MAXUPRC CHILD_MAX
79#endif
80
81#ifndef NCARGS
82/** Max argument size for an exec function.
83 * OS2: DosExecPgm does not accept more than 32KB of command line arguments
84 * (ditto for environment). So, we keep the limit a few bytes short of
85 * this to avoid rounding errors on the user side. */
86#define NCARGS ARG_MAX
87#endif
88#ifndef NGROUPS
89/** Max supplemental group id's.
90 * OS2: doesn't make much sens just set it high. */
91#define NGROUPS NGROUPS_MAX
92#endif
93
94#ifndef NOFILE
95/** Max number of open files per process.
96 * OS2: Using DosSetMaxFH the theoretical maximum should be 0xfff0 I believe.
97 */
98#define NOFILE OPEN_MAX
99#endif
100
101#ifndef NOGROUP
102/** Marker for empty group set member.
103 * OS2: no meaning currently. */
104#define NOGROUP 0xffff
105#endif
106
107#ifndef MAXHOSTNAMELEN
108/** Max number of bytes in a hostname. */
109#define MAXHOSTNAMELEN 256
110#endif
111
112#ifndef SPECNAMELEN
113/** Max number of bytes in a devicename.
114 * OS2: no real meaning. */
115#define SPECNAMELEN 16
116#endif
117
118#ifndef MAXNAMLEN
119/** Max number of chars in a file name.
120 * BSD name for posix NAME_MAX. */
121#define MAXNAMLEN NAME_MAX
122#endif
123
124#ifndef MAXPATHLEN
125/** Max number of chars in a path name.
126 * BSD name for posix PATH_MAX.
127 * @remark Very strict BSD kernel/user code may expect it to be a number which
128 * is the power of two an. The OS/2 number is not a power of 2. */
129#define MAXPATHLEN PATH_MAX
130#endif
131
132#ifndef MAXBSIZE
133/** Max filesystem block size.
134 * Pretty internal FreeBSD define which may be used to optimize file access.
135 * It must be a power of 2. */
136#define MAXBSIZE 65536
137#endif
138
139#ifndef BKVASIZE
140/** Nominal buffer space per buffer, in bytes.
141 * Pretty internal FreeBSD define which may be used to optimize file access.
142 * It must be a power of 2. */
143#define BKVASIZE 16384
144#endif
145
146#ifndef BKVAMASK
147/** Block mask of some kind... Very internal BSD stuff which noone really should use. */
148#define BKVAMASK (BKVASIZE - 1)
149#endif
150
151/** @} */
152
153
154/** @group EMX defines
155 * @{
156 */
157#ifndef HZ
158/** Frequencey of something but have no clue of what...
159 * Freebsd isn't defining this, linux is but only for the kernel sources.
160 * Considered EMX specific. */
161#define HZ 100
162#endif
163/** @} */
164
165
166/** @group Bitmap Access
167 * The bitmaps in question is arrays if integer.
168 * @{ */
169/** number of bytes in an int */
170#define NBPW sizeof(int)
171/** Set a bit in the bitmap */
172#define setbit(Bitmap,iBit) ( (Bitmap)[(i)/NBBY] |= 1 << ((i) % NBBY) )
173/** Clear a bit in the bitmap */
174#define clrbit(Bitmap,iBit) ( (Bitmap)[(i)/NBBY] &= ~(1 << ((i) % NBBY)) )
175/** Test if a bit in a bitmap is set. */
176#define isset(Bitmap,iBit) ( (Bitmap)[(i)/NBBY] & (1 << ((i) % NBBY)) )
177/** Test if a bit in a bitmap is clear. */
178#define isclr(Bitmap,iBit) (((Bitmap)[(i)/NBBY] & 1 << ((i) % NBBY)) == 0 )
179/** @} */
180
181
182/* Handle flags of some kind... Toolkit defines it here.
183 * Freebsd headers indicates that these are KERNEL flags, but
184 * there is a chance one or two tcpip ioctls are using them. */
185#ifndef _POSIX_SOURCE
186#ifndef FREAD
187#define FREAD 0x0001
188#define FWRITE 0x0002
189#endif
190#endif
191
192#if 0 /* we don't need it, endian takes care of this */
193/* Basic byte order conversion (non-inline).
194 * Note that freebsd only does this when KERNEL is defined. */
195#if !defined (htonl)
196#define htonl(X) _swapl(X)
197#define ntohl(X) _swapl(X)
198#define htons(X) _swaps(X)
199#define ntohs(X) _swaps(X)
200#endif
201unsigned short _swaps (unsigned short _x);
202unsigned long _swapl (unsigned long _x);
203#endif
204
205/*
206 * minimum and maximum macros. Use available g++ tricks.
207 */
208#if defined(__cplusplus) && (__GNUC__ >= 2) && (__GNUC__ <= 3)
209# define MIN(a, b) ( (a) <? (b) )
210# define MAX(a, b) ( (a) >? (b) )
211#else
212# define MIN(a, b) ( (a) < (b) ? (a) : (b) )
213# define MAX(a, b) ( (a) > (b) ? (a) : (b) )
214#endif
215
216#if defined (__cplusplus)
217}
218#endif
219
220#endif /* not _SYS_PARAM_H */
Note: See TracBrowser for help on using the repository browser.