UNIXworkcode

1 /* 2 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. 3 * 4 * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 5 * 6 * THE BSD LICENSE 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions are met: 10 * 11 * Redistributions of source code must retain the above copyright notice, this 12 * list of conditions and the following disclaimer. 13 * Redistributions in binary form must reproduce the above copyright notice, 14 * this list of conditions and the following disclaimer in the documentation 15 * and/or other materials provided with the distribution. 16 * 17 * Neither the name of the nor the names of its contributors may be 18 * used to endorse or promote products derived from this software without 19 * specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 25 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 #ifndef BASE_SYSTEMS_H 35 #define BASE_SYSTEMS_H 36 37 //include <nspr.h> 38 #include <inttypes.h> 39 40 #ifndef NOINTNSAPI 41 #define INTNSAPI 42 #endif /* !NOINTNSAPI */ 43 44 /* 45 * systems.h: Lists of defines for systems 46 * 47 * This sets what general flavor the system is (UNIX, etc.), 48 * and defines what extra functions your particular system needs. 49 */ 50 51 52 /* --- Begin common definitions for all supported platforms --- */ 53 54 #define DAEMON_ANY 55 #define DAEMON_STATS 56 57 /* new types */ 58 typedef int PRBool; 59 #define PR_TRUE 1 60 #define PR_FALSE 0 61 /* end new types */ 62 63 /* --- End common definitions for all supported platforms --- */ 64 65 /* --- Begin platform-specific definitions --- */ 66 67 #if defined(AIX) 68 69 #define HAS_IPV6 70 #define AUTH_DBM 71 #define BSD_RLIMIT 72 #undef BSD_SIGNALS 73 //define DAEMON_NEEDS_SEMAPHORE 74 //define DAEMON_UNIX_MOBRULE 75 //define DLL_CAPABLE 76 #define DLL_DLOPEN 77 #define DLL_DLOPEN_FLAGS RTLD_NOW|RTLD_GLOBAL 78 #define DNS_CACHE 79 #define FILE_INHERIT_FCNTL 80 #define FILE_MMAP_FLAGS MAP_SHARED 81 #define HAS_STATFS 82 #define HAVE_ATEXIT 83 #define HAVE_STRERROR_R 84 #define HAVE_STRTOK_R 85 #define HAVE_TIME_R 2 /* arg count */ 86 #define HAVE_STRFTIME /* no cftime */ 87 #define JAVA_STATIC_LINK 88 #undef NEED_CRYPT_H 89 #define NEED_STRINGS_H /* for strcasecmp */ 90 #define NET_SOCKETS 91 #define SA_HANDLER_T(x) (void (*)(int))x 92 #ifdef NS_OLDES3X 93 #define SA_NOCLDWAIT 0 /* AIX don't got this */ 94 #endif 95 #define SEM_FLOCK 96 #define SHMEM_MMAP_FLAGS MAP_SHARED 97 #ifdef HW_THREADS 98 #define THREAD_ANY 99 #endif 100 #elif defined(BSDI) 101 102 #define AUTH_DBM 103 #define BSD_MAIL 104 #define BSD_RLIMIT 105 #define BSD_SIGNALS 106 #define BSD_TIME 107 #define DAEMON_UNIX_MOBRULE 108 #define DNS_CACHE 109 #define FILE_INHERIT_FCNTL 110 #define FILE_MMAP_FLAGS (MAP_FILE | MAP_SHARED) 111 #define HAS_STATFS 112 #define HAVE_ATEXIT 113 #undef NEED_CRYPT_PROTO 114 #define NET_SOCKETS 115 #define NO_DOMAINNAME 116 #define SEM_FLOCK 117 #define SHMEM_MMAP_FLAGS MAP_SHARED 118 #define JAVA_STATIC_LINK 119 120 #elif defined(HPUX) 121 122 #define HAVE_TIME_R 2 /* arg count */ 123 #define AUTH_DBM 124 #undef BSD_RLIMIT 125 #undef BSD_SIGNALS 126 #ifdef MCC_PROXY 127 #define DAEMON_NEEDS_SEMAPHORE 128 #else 129 #define DAEMON_NEEDS_SEMAPHORE 130 #endif 131 #define DAEMON_UNIX_MOBRULE 132 #define DLL_CAPABLE 133 #define DLL_HPSHL 134 #define DNS_CACHE 135 #define FILE_INHERIT_FCNTL 136 #define FILE_MMAP_FLAGS MAP_PRIVATE 137 #define HAS_STATFS 138 #define HAVE_ATEXIT 139 #define HAVE_STRFTIME 140 #define JAVA_STATIC_LINK 141 #undef NEED_CRYPT_H 142 #define NET_SOCKETS 143 #define SA_HANDLER_T(x) (void (*)(int))x 144 #define SEM_FLOCK 145 /* warning: mmap doesn't work under 9.04 */ 146 #define SHMEM_MMAP_FLAGS MAP_FILE | MAP_VARIABLE | MAP_SHARED 147 148 #elif defined (IRIX) 149 150 #define AUTH_DBM 151 #define BSD_RLIMIT 152 #undef BSD_SIGNALS 153 #define DAEMON_UNIX_MOBRULE 154 #define DLL_CAPABLE 155 #define DLL_DLOPEN 156 #define DLL_DLOPEN_FLAGS RTLD_NOW 157 #define DNS_CACHE 158 #define FILE_INHERIT_FCNTL 159 #define FILE_MMAP_FLAGS MAP_SHARED 160 #define HAS_STATVFS 161 #define HAVE_ATEXIT 162 #define HAVE_STRTOK_R 163 #define HAVE_TIME_R 2 /* arg count */ 164 #define JAVA_STATIC_LINK 165 #define NEED_CRYPT_H 166 #define NET_SOCKETS 167 #define SA_HANDLER_T(x) (void (*)(int))x 168 #define SEM_FLOCK 169 #define SHMEM_MMAP_FLAGS MAP_SHARED 170 #define THROW_HACK throw() 171 172 #elif defined(Linux) 173 174 #define HAS_IPV6 175 #define AUTH_DBM 176 #define BSD_RLIMIT 177 #undef BSD_SIGNALS 178 #define DAEMON_NEEDS_SEMAPHORE 179 #define DAEMON_UNIX_MOBRULE 180 #define DLL_CAPABLE 181 #define DLL_DLOPEN 182 #define DLL_DLOPEN_FLAGS RTLD_NOW 183 #define DNS_CACHE 184 #define FILE_INHERIT_FCNTL 185 #define FILE_MMAP_FLAGS MAP_SHARED 186 #define SEM_FLOCK 187 #define SHMEM_MMAP_FLAGS MAP_SHARED 188 #define HAS_STATVFS 189 #define HAVE_ATEXIT 190 #define HAVE_STRTOK_R 191 #define HAVE_TIME_R 2 /* arg count */ 192 #define NEED_CRYPT_H 193 #undef NEED_FILIO 194 #define NEED_GHN_PROTO 195 #define NET_SOCKETS 196 #define SA_HANDLER_T(x) (void (*)(int))x 197 #undef NEED_GHN_PROTO 198 199 #elif defined(NCR) 200 201 #define AUTH_DBM 202 #undef BSD_RLIMIT 203 /* #define DAEMON_NEEDS_SEMAPHORE */ 204 #define DAEMON_UNIX_MOBRULE 205 #define DLL_CAPABLE 206 #define DLL_DLOPEN 207 #define DLL_DLOPEN_FLAGS RTLD_NOW 208 #define DNS_CACHE 209 #define FILE_INHERIT_FCNTL 210 #define FILE_MMAP_FLAGS MAP_SHARED 211 #define HAS_STATVFS 212 #define HAVE_ATEXIT 213 #define HAVE_STRTOK_R 214 #define JAVA_STATIC_LINK 215 #define NEED_CRYPT_H 216 #define NEED_FILIO 217 #define NEED_GHN_PROTO 218 #define NET_SOCKETS 219 #define SEM_FLOCK 220 #define SHMEM_MMAP_FLAGS MAP_SHARED 221 222 #elif defined(NEC) 223 224 #define DNS_CACHE 225 #define AUTH_DBM 226 #undef BSD_RLIMIT 227 #define DAEMON_NEEDS_SEMAPHORE 228 #define DAEMON_UNIX_MOBRULE 229 #define DLL_DLOPEN 230 #define DLL_DLOPEN_FLAGS RTLD_NOW 231 #define DLL_CAPABLE 232 #define FILE_INHERIT_FCNTL 233 #define FILE_MMAP_FLAGS MAP_SHARED 234 #define HAS_STATVFS 235 #define HAVE_ATEXIT 236 #define HAVE_STRTOK_R 237 #define HAVE_TIME_R 2 /* arg count */ 238 #define JAVA_STATIC_LINK 239 #define NEED_CRYPT_H 240 #define NEED_FILIO 241 #define NET_SOCKETS 242 #define SEM_FLOCK 243 #define SHMEM_MMAP_FLAGS MAP_SHARED 244 245 #elif defined(OSF1) 246 247 #define HAS_IPV6 248 #define AUTH_DBM 249 #define BSD_RLIMIT 250 #undef BSD_SIGNALS 251 #define BSD_TIME 252 #define DAEMON_UNIX_MOBRULE 253 #define DAEMON_NEEDS_SEMAPHORE 254 #define DLL_CAPABLE 255 #define DLL_DLOPEN 256 #define DLL_DLOPEN_FLAGS RTLD_NOW 257 #define DNS_CACHE 258 #define FILE_INHERIT_FCNTL 259 #define FILE_MMAP_FLAGS MAP_SHARED 260 #define HAVE_ATEXIT 261 #define HAVE_STRFTIME /* no cftime */ 262 #define HAVE_TIME_R 2 /* ctime_r arg count */ 263 #define NET_SOCKETS 264 #define SA_HANDLER_T(x) (void (*)(int))x 265 #define SEM_FLOCK 266 #define SHMEM_MMAP_FLAGS MAP_SHARED 267 268 #elif defined(SCO) 269 270 #define AUTH_DBM 271 #undef BSD_RLIMIT 272 #undef BSD_SIGNALS 273 #define DAEMON_NEEDS_SEMAPHORE 274 #define DAEMON_UNIX_MOBRULE 275 #define DLL_CAPABLE 276 #define DLL_DLOPEN 277 #define DLL_DLOPEN_FLAGS RTLD_NOW 278 #define DNS_CACHE 279 #define FILE_INHERIT_FCNTL 280 #define FILE_MMAP_FLAGS MAP_SHARED 281 #define HAS_STATVFS 282 #define HAVE_ATEXIT 283 #undef NEED_CRYPT_H 284 #undef NEED_FILIO 285 #undef NEED_GHN_PROTO 286 #undef NEED_SETEID_PROTO /* setegid, seteuid */ 287 #define NET_SOCKETS 288 #define SEM_FLOCK 289 #define SHMEM_MMAP_FLAGS MAP_SHARED 290 #define SA_HANDLER_T(x) (void (*)(int))x 291 292 293 #elif defined(SNI) 294 295 #define AUTH_DBM 296 #undef BSD_RLIMIT 297 #define DAEMON_NEEDS_SEMAPHORE 298 #define DAEMON_UNIX_MOBRULE 299 #define DLL_CAPABLE 300 #define DLL_DLOPEN 301 #define DLL_DLOPEN_FLAGS RTLD_NOW 302 #define DNS_CACHE 303 #define FILE_INHERIT_FCNTL 304 #define FILE_MMAP_FLAGS MAP_SHARED 305 #define HAS_STATVFS 306 #define HAVE_ATEXIT 307 #define JAVA_STATIC_LINK 308 #define NEED_CRYPT_H 309 #define NEED_FILIO 310 #define NET_SOCKETS 311 #define SEM_FLOCK 312 #define SHMEM_MMAP_FLAGS MAP_SHARED 313 #define USE_PIPE 314 315 #elif defined(SOLARIS) 316 317 #if defined(ENABLE_IPV6) 318 #define HAS_IPV6 319 #endif 320 #define AUTH_DBM 321 #define BSD_RLIMIT 322 #undef BSD_SIGNALS 323 #define DAEMON_NEEDS_SEMAPHORE 324 #define DAEMON_UNIX_MOBRULE 325 #define DLL_CAPABLE 326 #define DLL_DLOPEN 327 #define DLL_DLOPEN_FLAGS RTLD_NOW|RTLD_FIRST 328 #define DNS_CACHE 329 #define FILE_INHERIT_FCNTL 330 #define FILE_MMAP_FLAGS MAP_SHARED 331 #define HAS_STATVFS 332 #define HAVE_ATEXIT 333 #define HAVE_STRTOK_R 334 #define HAVE_TIME_R 3 /* arg count */ 335 #define NEED_CRYPT_H 336 #define NEED_FILIO 337 #define NEED_GHN_PROTO 338 #define NET_SOCKETS 339 #if OSVERSION > 504 340 #define SA_HANDLER_T(x) x 341 #endif 342 #if OSVERSION >= 506 343 #undef NEED_GHN_PROTO 344 #endif 345 #define SEM_FLOCK 346 #define SHMEM_MMAP_FLAGS MAP_SHARED 347 348 #elif defined (SONY) 349 350 #define AUTH_DBM 351 #undef BSD_RLIMIT 352 #define DAEMON_NEEDS_SEMAPHORE 353 #define DAEMON_UNIX_MOBRULE 354 #define DLL_CAPABLE 355 #define FILE_INHERIT_FCNTL 356 #define FILE_MMAP_FLAGS MAP_SHARED 357 #define HAVE_ATEXIT 358 #define NEED_CRYPT_H 359 #define NEED_FILIO 360 #define NET_SOCKETS 361 #define SEM_FLOCK 362 #define SHMEM_MMAP_FLAGS MAP_SHARED 363 364 #elif defined(SUNOS4) 365 366 #define AUTH_DBM 367 #define BSD_MAIL 368 #define BSD_RLIMIT 369 #define BSD_SIGNALS 370 #define BSD_TIME 371 #define DAEMON_UNIX_MOBRULE 372 #define DLL_CAPABLE 373 #define DLL_DLOPEN 374 #define DLL_DLOPEN_FLAGS 1 375 #define DNS_CACHE 376 #define FILE_INHERIT_FCNTL 377 #define FILE_MMAP_FLAGS MAP_SHARED 378 #define HAS_STATFS 379 #undef HAVE_ATEXIT 380 #undef NEED_CRYPT_H 381 #define NEED_CRYPT_PROTO 382 #define NEED_FILIO 383 #define NET_SOCKETS 384 #define SEM_FLOCK 385 #define SHMEM_MMAP_FLAGS MAP_SHARED 386 387 #elif defined(UNIXWARE) 388 389 #define AUTH_DBM 390 #undef BSD_RLIMIT 391 #define DAEMON_UNIX_MOBRULE 392 #define DLL_CAPABLE 393 #define DLL_DLOPEN 394 #define DLL_DLOPEN_FLAGS RTLD_NOW 395 #define DNS_CACHE 396 #define FILE_INHERIT_FCNTL 397 #define FILE_MMAP_FLAGS MAP_SHARED 398 #define HAS_STATVFS 399 #define HAVE_ATEXIT 400 #define NEED_CRYPT_H 401 #define NEED_FILIO 402 #define NEED_GHN_PROTO 403 #define NEED_SETEID_PROTO /* setegid, seteuid */ 404 #define NET_SOCKETS 405 #define SEM_FLOCK 406 #define SHMEM_MMAP_FLAGS MAP_SHARED 407 408 #ifndef boolean 409 #define boolean boolean 410 #endif 411 412 #elif defined (XP_WIN32) /* Windows NT */ 413 414 #include <wtypes.h> 415 #include <winbase.h> 416 417 #define AUTH_DBM 418 #define DAEMON_WIN32 419 #define DLL_CAPABLE 420 #define DLL_WIN32 421 #define DNS_CACHE 422 #define LOG_BUFFERING 423 #define HAVE_STRFTIME /* no cftime */ 424 #define NEED_CRYPT_PROTO 425 #define NEEDS_WRITEV 426 #define NET_SOCKETS 427 #define NO_DOMAINNAME 428 #ifdef BUILD_DLL 429 #if defined (NSAPI_PUBLIC) 430 #undef NSAPI_PUBLIC 431 #endif 432 #define NSAPI_PUBLIC __declspec(dllexport) 433 #else 434 #if defined (NSAPI_PUBLIC) 435 #undef NSAPI_PUBLIC 436 #endif 437 #define NSAPI_PUBLIC 438 #endif /* BUILD_DLL */ 439 #define SEM_WIN32 440 #define THREAD_ANY 441 #define THREAD_NSPR_KERNEL 442 #define USE_NSPR 443 #define USE_STRFTIME /* no cftime */ 444 #define FILE_DEV_NULL "\\\\.\NUL" 445 446 #endif /* Windows NT */ 447 448 /* --- Begin defaults for values not defined above --- */ 449 450 #ifndef DAEMON_LISTEN_SIZE 451 #define DAEMON_LISTEN_SIZE 128 452 #endif /* !DAEMON_LISTEN_SIZE */ 453 454 #ifndef NSAPI_PUBLIC 455 #define NSAPI_PUBLIC 456 #endif 457 458 #ifndef SA_HANDLER_T 459 #define SA_HANDLER_T(x) (void (*)())x 460 #endif 461 462 #ifndef THROW_HACK 463 #define THROW_HACK /* as nothing */ 464 #endif 465 466 #ifndef FILE_DEV_NULL 467 #define FILE_DEV_NULL "/dev/null" 468 #endif 469 470 /* --- End defaults for values not defined above --- */ 471 472 /* --- Begin the great debate --- */ 473 474 /* NS_MAIL builds sec-key.c which calls systhread_init, which requires */ 475 /* that USE_NSPR is defined when systhr.c is compiled. --lachman */ 476 /* MCC_PROXY does the same thing now --nbreslow -- LIKE HELL --ari */ 477 #if (defined(MCC_HTTPD) || defined(MCC_ADMSERV) || defined(MCC_PROXY) || defined(NS_MAIL)) && defined(XP_UNIX) 478 #define USE_NSPR 479 /* XXXrobm This is UNIX-only for the moment */ 480 #define LOG_BUFFERING 481 #ifdef SW_THREADS 482 #define THREAD_NSPR_USER 483 #else 484 #define THREAD_NSPR_KERNEL 485 #endif 486 #define THREAD_ANY 487 #endif 488 489 /* --- End the great debate --- */ 490 491 #ifndef APSTUDIO_READONLY_SYMBOLS 492 493 #ifndef NSPR_PRIO_H 494 //include "prio.h" 495 #define NSPR_PRIO_H 496 #endif /* !NSPR_PRIO_H */ 497 498 /* 499 * These types have to be defined early, because they are defined 500 * as (void *) in the public API. 501 */ 502 503 /* TODO: remove */ 504 //ifndef SYS_FILE_T 505 //typedef PRFileDesc *SYS_FILE; 506 //define SYS_FILE_T PRFileDesc * 507 //endif /* !SYS_FILE_T */ 508 509 //ifndef SYS_NETFD_T 510 //typedef PRFileDesc *SYS_NETFD; 511 //define SYS_NETFD_T PRFileDesc * 512 //endif /* !SYS_NETFD_T */ 513 514 #ifdef SEM_WIN32 515 516 typedef HANDLE SEMAPHORE; 517 #define SEMAPHORE_T HANDLE 518 #define SEM_ERROR NULL 519 /* That oughta hold them (I hope) */ 520 #define SEM_MAXVALUE 32767 521 522 #elif defined(SEM_FLOCK) 523 524 //define SEMAPHORE_T int 525 //typedef int SEMAPHORE; 526 //define SEM_ERROR -1 527 528 #elif defined(SEM_POSIX) 529 530 #define SEM_ERROR ((void *)(-1)) 531 typedef void* SEMAPHORE_T; 532 533 #else /* ! SEM_WIN32 */ 534 535 // TODO 536 //typedef int SEMAPHORE; 537 //define SEMAPHORE_T int 538 //define SEM_ERROR -1 539 540 #endif /* SEM_WIN32 */ 541 542 #endif /* !APSTUDIO_READONLY_SYMBOLS */ 543 544 #ifndef XP_CPLUSPLUS 545 #ifdef __cplusplus 546 #define XP_CPLUSPLUS 547 #endif /* __cplusplus */ 548 #endif /* !XP_CPLUSPLUS */ 549 550 #endif /* BASE_SYSTEMS_H */ 551