| 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)
|
|---|
| 13 | extern "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: Assuming at least 4KB of environment gives us 0xf000 at the very best.
|
|---|
| 84 | * However we set it to 32KB which should be a safe max. */
|
|---|
| 85 | #define NCARGS ARG_MAX
|
|---|
| 86 | #endif
|
|---|
| 87 | #ifndef NGROUPS
|
|---|
| 88 | /** Max supplemental group id's.
|
|---|
| 89 | * OS2: doesn't make much sens just set it high. */
|
|---|
| 90 | #define NGROUPS NGROUPS_MAX
|
|---|
| 91 | #endif
|
|---|
| 92 |
|
|---|
| 93 | #ifndef NOFILE
|
|---|
| 94 | /** Max number of open files per process.
|
|---|
| 95 | * OS2: Using DosSetMaxFH the theoretical maximum should be 0xfff0 I believe.
|
|---|
| 96 | */
|
|---|
| 97 | #define NOFILE OPEN_MAX
|
|---|
| 98 | #endif
|
|---|
| 99 |
|
|---|
| 100 | #ifndef NOGROUP
|
|---|
| 101 | /** Marker for empty group set member.
|
|---|
| 102 | * OS2: no meaning currently. */
|
|---|
| 103 | #define NOGROUP 0xffff
|
|---|
| 104 | #endif
|
|---|
| 105 |
|
|---|
| 106 | #ifndef MAXHOSTNAMELEN
|
|---|
| 107 | /** Max number of bytes in a hostname. */
|
|---|
| 108 | #define MAXHOSTNAMELEN 256
|
|---|
| 109 | #endif
|
|---|
| 110 |
|
|---|
| 111 | #ifndef SPECNAMELEN
|
|---|
| 112 | /** Max number of bytes in a devicename.
|
|---|
| 113 | * OS2: no real meaning. */
|
|---|
| 114 | #define SPECNAMELEN 16
|
|---|
| 115 | #endif
|
|---|
| 116 |
|
|---|
| 117 | #ifndef MAXNAMLEN
|
|---|
| 118 | /** Max number of chars in a file name.
|
|---|
| 119 | * BSD name for posix NAME_MAX. */
|
|---|
| 120 | #define MAXNAMLEN NAME_MAX
|
|---|
| 121 | #endif
|
|---|
| 122 |
|
|---|
| 123 | #ifndef MAXPATHLEN
|
|---|
| 124 | /** Max number of chars in a path name.
|
|---|
| 125 | * BSD name for posix PATH_MAX.
|
|---|
| 126 | * @remark Very strict BSD kernel/user code may expect it to be a number which
|
|---|
| 127 | * is the power of two an. The OS/2 number is not a power of 2. */
|
|---|
| 128 | #define MAXPATHLEN PATH_MAX
|
|---|
| 129 | #endif
|
|---|
| 130 |
|
|---|
| 131 | #ifndef MAXBSIZE
|
|---|
| 132 | /** Max filesystem block size.
|
|---|
| 133 | * Pretty internal FreeBSD define which may be used to optimize file access.
|
|---|
| 134 | * It must be a power of 2. */
|
|---|
| 135 | #define MAXBSIZE 65536
|
|---|
| 136 | #endif
|
|---|
| 137 |
|
|---|
| 138 | #ifndef BKVASIZE
|
|---|
| 139 | /** Nominal buffer space per buffer, in bytes.
|
|---|
| 140 | * Pretty internal FreeBSD define which may be used to optimize file access.
|
|---|
| 141 | * It must be a power of 2. */
|
|---|
| 142 | #define BKVASIZE 16384
|
|---|
| 143 | #endif
|
|---|
| 144 |
|
|---|
| 145 | #ifndef BKVAMASK
|
|---|
| 146 | /** Block mask of some kind... Very internal BSD stuff which noone really should use. */
|
|---|
| 147 | #define BKVAMASK (BKVASIZE - 1)
|
|---|
| 148 | #endif
|
|---|
| 149 |
|
|---|
| 150 | /** @} */
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 | /** @group EMX defines
|
|---|
| 154 | * @{
|
|---|
| 155 | */
|
|---|
| 156 | #ifndef HZ
|
|---|
| 157 | /** Frequencey of something but have no clue of what...
|
|---|
| 158 | * Freebsd isn't defining this, linux is but only for the kernel sources.
|
|---|
| 159 | * Considered EMX specific. */
|
|---|
| 160 | #define HZ 100
|
|---|
| 161 | #endif
|
|---|
| 162 | /** @} */
|
|---|
| 163 |
|
|---|
| 164 |
|
|---|
| 165 | /** @group Bitmap Access
|
|---|
| 166 | * The bitmaps in question is arrays if integer.
|
|---|
| 167 | * @{ */
|
|---|
| 168 | /** number of bytes in an int */
|
|---|
| 169 | #define NBPW sizeof(int)
|
|---|
| 170 | /** Set a bit in the bitmap */
|
|---|
| 171 | #define setbit(Bitmap,iBit) ( (Bitmap)[(i)/NBBY] |= 1 << ((i) % NBBY) )
|
|---|
| 172 | /** Clear a bit in the bitmap */
|
|---|
| 173 | #define clrbit(Bitmap,iBit) ( (Bitmap)[(i)/NBBY] &= ~(1 << ((i) % NBBY)) )
|
|---|
| 174 | /** Test if a bit in a bitmap is set. */
|
|---|
| 175 | #define isset(Bitmap,iBit) ( (Bitmap)[(i)/NBBY] & (1 << ((i) % NBBY)) )
|
|---|
| 176 | /** Test if a bit in a bitmap is clear. */
|
|---|
| 177 | #define isclr(Bitmap,iBit) (((Bitmap)[(i)/NBBY] & 1 << ((i) % NBBY)) == 0 )
|
|---|
| 178 | /** @} */
|
|---|
| 179 |
|
|---|
| 180 |
|
|---|
| 181 | /* Handle flags of some kind... Toolkit defines it here.
|
|---|
| 182 | * Freebsd headers indicates that these are KERNEL flags, but
|
|---|
| 183 | * there is a chance one or two tcpip ioctls are using them. */
|
|---|
| 184 | #ifndef _POSIX_SOURCE
|
|---|
| 185 | #ifndef FREAD
|
|---|
| 186 | #define FREAD 0x0001
|
|---|
| 187 | #define FWRITE 0x0002
|
|---|
| 188 | #endif
|
|---|
| 189 | #endif
|
|---|
| 190 |
|
|---|
| 191 | #if 0 /* we don't need it, endian takes care of this */
|
|---|
| 192 | /* Basic byte order conversion (non-inline).
|
|---|
| 193 | * Note that freebsd only does this when KERNEL is defined. */
|
|---|
| 194 | #if !defined (htonl)
|
|---|
| 195 | #define htonl(X) _swapl(X)
|
|---|
| 196 | #define ntohl(X) _swapl(X)
|
|---|
| 197 | #define htons(X) _swaps(X)
|
|---|
| 198 | #define ntohs(X) _swaps(X)
|
|---|
| 199 | #endif
|
|---|
| 200 | unsigned short _swaps (unsigned short _x);
|
|---|
| 201 | unsigned long _swapl (unsigned long _x);
|
|---|
| 202 | #endif
|
|---|
| 203 |
|
|---|
| 204 | #if defined (__cplusplus) && (__GNUC__ >= 2)
|
|---|
| 205 | # define MIN(a,b) (((a)<?(b))
|
|---|
| 206 | #else
|
|---|
| 207 | # define MIN(a,b) (((a)<(b))?(a):(b))
|
|---|
| 208 | #endif
|
|---|
| 209 | #if defined (__cplusplus) && (__GNUC__ >= 2)
|
|---|
| 210 | # define MAX(a,b) (((a)>?(b))
|
|---|
| 211 | #else
|
|---|
| 212 | # define MAX(a,b) (((a)>(b))?(a):(b))
|
|---|
| 213 | #endif
|
|---|
| 214 |
|
|---|
| 215 | #if defined (__cplusplus)
|
|---|
| 216 | }
|
|---|
| 217 | #endif
|
|---|
| 218 |
|
|---|
| 219 | #endif /* not _SYS_PARAM_H */
|
|---|