systems.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. * END COPYRIGHT BLOCK **/
  6. #ifndef BASE_SYSTEMS_H
  7. #define BASE_SYSTEMS_H
  8. #ifndef NOINTNSAPI
  9. #define INTNSAPI
  10. #endif /* !NOINTNSAPI */
  11. /*
  12. * systems.h: Lists of defines for systems
  13. *
  14. * This sets what general flavor the system is (UNIX, etc.),
  15. * and defines what extra functions your particular system needs.
  16. */
  17. /* --- Begin common definitions for all supported platforms --- */
  18. #define DAEMON_ANY
  19. #define DAEMON_STATS
  20. /* --- End common definitions for all supported platforms --- */
  21. /* --- Begin platform-specific definitions --- */
  22. #if defined(AIX)
  23. #define ACCELERATOR_CACHE
  24. #define AUTH_DBM
  25. #define BSD_RLIMIT
  26. #undef BSD_SIGNALS
  27. /* AIX can handle really big shoes */
  28. #define DAEMON_LISTEN_SIZE 4096
  29. #define DAEMON_NEEDS_SEMAPHORE
  30. #define DAEMON_UNIX_MOBRULE
  31. #define DLL_CAPABLE
  32. #define DLL_DLOPEN
  33. #define DLL_DLOPEN_FLAGS RTLD_NOW|RTLD_GLOBAL
  34. #define DNS_CACHE
  35. #define FILE_INHERIT_FCNTL
  36. #define FILE_MMAP_FLAGS MAP_SHARED
  37. #define HAS_STATFS
  38. #define HAVE_ATEXIT
  39. #define HAVE_PW_R /* reent passwd routines */
  40. #define HAVE_STRERROR_R
  41. #define HAVE_STRTOK_R
  42. #define HAVE_TIME_R 2 /* arg count */
  43. #define HAVE_STRFTIME /* no cftime */
  44. #define JAVA_STATIC_LINK
  45. #undef NEED_CRYPT_H
  46. #define NEED_SETEID_PROTO /* setegid, seteuid */
  47. #define NEED_STRINGS_H /* for strcasecmp */
  48. #define NET_SOCKETS
  49. #define SA_HANDLER_T(x) (void (*)(int))x
  50. #if OSVERSION < 4210
  51. #define SA_NOCLDWAIT 0 /* AIX < 4.2 don't got this */
  52. #endif /* OSVERSION < 4210 */
  53. #define SHMEM_MMAP_FLAGS MAP_SHARED
  54. #ifdef HW_THREADS
  55. #define THREAD_ANY
  56. #endif
  57. #elif defined(BSDI)
  58. #define ACCELERATOR_CACHE
  59. #define AUTH_DBM
  60. #define BSD_MAIL
  61. #define BSD_RLIMIT
  62. #define BSD_SIGNALS
  63. #define BSD_TIME
  64. #define DAEMON_UNIX_MOBRULE
  65. #define DNS_CACHE
  66. #define FILE_INHERIT_FCNTL
  67. #define FILE_MMAP_FLAGS (MAP_FILE | MAP_SHARED)
  68. #define HAS_STATFS
  69. #define HAVE_ATEXIT
  70. #undef NEED_CRYPT_PROTO
  71. #define NET_SOCKETS
  72. #ifndef NO_DOMAINNAME
  73. #define NO_DOMAINNAME
  74. #endif
  75. #define SHMEM_MMAP_FLAGS MAP_SHARED
  76. #define JAVA_STATIC_LINK
  77. #elif defined(HPUX)
  78. #define ACCELERATOR_CACHE
  79. #define AUTH_DBM
  80. #undef BSD_RLIMIT
  81. #undef BSD_SIGNALS
  82. #ifdef MCC_PROXY
  83. #define DAEMON_NEEDS_SEMAPHORE
  84. #else
  85. #undef DAEMON_NEEDS_SEMAPHORE
  86. #endif
  87. #define DAEMON_UNIX_MOBRULE
  88. #define DLL_CAPABLE
  89. #define DLL_HPSHL
  90. #define DNS_CACHE
  91. #define FILE_INHERIT_FCNTL
  92. #define FILE_MMAP_FLAGS MAP_PRIVATE
  93. #define HAS_STATFS
  94. #define HAVE_ATEXIT
  95. #define HAVE_STRFTIME
  96. #define JAVA_STATIC_LINK
  97. #undef NEED_CRYPT_H
  98. #define NET_SOCKETS
  99. #define SA_HANDLER_T(x) (void (*)(int))x
  100. /* warning: mmap doesn't work under 9.04 */
  101. #define SHMEM_MMAP_FLAGS MAP_FILE | MAP_VARIABLE | MAP_SHARED
  102. #elif defined (IRIX)
  103. #define ACCELERATOR_CACHE
  104. #define AUTH_DBM
  105. #define BSD_RLIMIT
  106. #undef BSD_SIGNALS
  107. #define DAEMON_UNIX_MOBRULE
  108. #define DLL_CAPABLE
  109. #define DLL_DLOPEN
  110. #define DLL_DLOPEN_FLAGS RTLD_NOW
  111. #define DNS_CACHE
  112. #define FILE_INHERIT_FCNTL
  113. #define FILE_MMAP_FLAGS MAP_SHARED
  114. #define HAS_STATVFS
  115. #define HAVE_ATEXIT
  116. #define HAVE_STRTOK_R
  117. #ifdef IRIX
  118. #define HAVE_TIME_R 2 /* arg count */
  119. #else
  120. #define HAVE_TIME_R 3 /* arg count */
  121. #define NEED_SETEID_PROTO /* setegid, seteuid */
  122. #endif
  123. #define JAVA_STATIC_LINK
  124. #define NEED_CRYPT_H
  125. #define NET_SOCKETS
  126. #define SA_HANDLER_T(x) (void (*)(int))x
  127. #define SHMEM_MMAP_FLAGS MAP_SHARED
  128. #define THROW_HACK throw()
  129. #elif defined(NCR)
  130. #define ACCELERATOR_CACHE
  131. #define AUTH_DBM
  132. #undef BSD_RLIMIT
  133. /* #define DAEMON_NEEDS_SEMAPHORE */
  134. #define DAEMON_UNIX_MOBRULE
  135. #define DLL_CAPABLE
  136. #define DLL_DLOPEN
  137. #define DLL_DLOPEN_FLAGS RTLD_NOW
  138. #define DNS_CACHE
  139. #define FILE_INHERIT_FCNTL
  140. #define FILE_MMAP_FLAGS MAP_SHARED
  141. #define HAS_STATVFS
  142. #define HAVE_ATEXIT
  143. #define HAVE_STRTOK_R
  144. #define JAVA_STATIC_LINK
  145. #define NEED_CRYPT_H
  146. #define NEED_FILIO
  147. #define NEED_GHN_PROTO
  148. #define NET_SOCKETS
  149. #define SHMEM_MMAP_FLAGS MAP_SHARED
  150. #elif defined(NEC)
  151. #define ACCELERATOR_CACHE
  152. #define DNS_CACHE
  153. #define AUTH_DBM
  154. #undef BSD_RLIMIT
  155. #define DAEMON_NEEDS_SEMAPHORE
  156. #define DAEMON_UNIX_MOBRULE
  157. #define DLL_DLOPEN
  158. #define DLL_DLOPEN_FLAGS RTLD_NOW
  159. #define DLL_CAPABLE
  160. #define FILE_INHERIT_FCNTL
  161. #define FILE_MMAP_FLAGS MAP_SHARED
  162. #define HAS_STATVFS
  163. #define HAVE_ATEXIT
  164. #define HAVE_STRTOK_R
  165. #define HAVE_TIME_R 2 /* arg count */
  166. #define JAVA_STATIC_LINK
  167. #define NEED_CRYPT_H
  168. #define NEED_FILIO
  169. #define NET_SOCKETS
  170. #define SHMEM_MMAP_FLAGS MAP_SHARED
  171. #elif defined(OSF1)
  172. #define ACCELERATOR_CACHE
  173. #define AUTH_DBM
  174. #define BSD_RLIMIT
  175. #undef BSD_SIGNALS
  176. #define BSD_TIME
  177. #define DAEMON_NEEDS_SEMAPHORE
  178. #define DAEMON_UNIX_MOBRULE
  179. #define DLL_CAPABLE
  180. #define DLL_DLOPEN
  181. #define DLL_DLOPEN_FLAGS RTLD_NOW
  182. #define DNS_CACHE
  183. #define FILE_INHERIT_FCNTL
  184. #define FILE_MMAP_FLAGS MAP_SHARED
  185. #define HAVE_ATEXIT
  186. #define HAVE_STRFTIME /* no cftime */
  187. #define HAVE_TIME_R 2 /* ctime_r arg count */
  188. #define NET_SOCKETS
  189. #define SA_HANDLER_T(x) (void (*)(int))x
  190. #define SHMEM_MMAP_FLAGS MAP_SHARED
  191. #elif defined(SCO)
  192. #define ACCELERATOR_CACHE
  193. #define AUTH_DBM
  194. #undef BSD_RLIMIT
  195. #undef BSD_SIGNALS
  196. #define DAEMON_NEEDS_SEMAPHORE
  197. #define DAEMON_UNIX_MOBRULE
  198. #define DLL_CAPABLE
  199. #define DLL_DLOPEN
  200. #define DLL_DLOPEN_FLAGS RTLD_NOW
  201. #define DNS_CACHE
  202. #define FILE_INHERIT_FCNTL
  203. #define FILE_MMAP_FLAGS MAP_SHARED
  204. #define HAS_STATVFS
  205. #define HAVE_ATEXIT
  206. #undef NEED_CRYPT_H
  207. #undef NEED_FILIO
  208. #undef NEED_GHN_PROTO
  209. #undef NEED_SETEID_PROTO /* setegid, seteuid */
  210. #define NET_SOCKETS
  211. #define SHMEM_MMAP_FLAGS MAP_SHARED
  212. #define SA_HANDLER_T(x) (void (*)(int))x
  213. #elif defined(SNI)
  214. #define ACCELERATOR_CACHE
  215. #define AUTH_DBM
  216. #undef BSD_RLIMIT
  217. #define DAEMON_NEEDS_SEMAPHORE
  218. #define DAEMON_UNIX_MOBRULE
  219. #define DLL_CAPABLE
  220. #define DLL_DLOPEN
  221. #define DLL_DLOPEN_FLAGS RTLD_NOW
  222. #define DNS_CACHE
  223. #define FILE_INHERIT_FCNTL
  224. #define FILE_MMAP_FLAGS MAP_SHARED
  225. #define HAS_STATVFS
  226. #define HAVE_ATEXIT
  227. #define JAVA_STATIC_LINK
  228. #define NEED_CRYPT_H
  229. #define NEED_FILIO
  230. #define NEED_SETEID_PROTO /* setegid, seteuid */
  231. #define NET_SOCKETS
  232. #define SHMEM_MMAP_FLAGS MAP_SHARED
  233. #define USE_PIPE
  234. /*
  235. * define this if your C++ platform has separate inline functions for
  236. * e.g. const char *strchr(const char *, char)
  237. * and
  238. * char *strchr(char *, char)
  239. * and your compiler complains about this:
  240. * func(const char *bla)
  241. * {
  242. * char *fasel = strchr(bla, '.');
  243. * ....
  244. * because it says that you cannot initialize a char * with a const char *
  245. */
  246. #define HAS_CONSTVALUED_STRFUNCS
  247. /* hack for C++ platforms where bool is a keyword */
  248. #ifndef boolean
  249. #define boolean boolean
  250. #endif
  251. #elif defined(Linux)
  252. #define ACCELERATOR_CACHE
  253. #define DNS_CACHE
  254. #define FILE_INHERIT_FCNTL
  255. #define DAEMON_UNIX_MOBRULE
  256. #define BSD_RLIMIT
  257. #undef BSD_SIGNALS
  258. #define FILE_UNIX_MMAP
  259. #define FILE_MMAP_FLAGS (MAP_FILE | MAP_SHARED)
  260. #define SHMEM_UNIX_MMAP
  261. #define SHMEM_MMAP_FLAGS MAP_SHARED
  262. #define AUTH_DBM
  263. #define SEM_FLOCK
  264. #define DLL_CAPABLE
  265. #define DLL_DLOPEN
  266. #define DLL_DLOPEN_FLAGS RTLD_NOW
  267. #define HAVE_ATEXIT
  268. #define HAS_STATFS
  269. #define JAVA_STATIC_LINK
  270. #define SA_HANDLER_T(x) (void (*)(int))(x)
  271. #undef NEED_CRYPT_PROTO
  272. #define NET_SOCKETS
  273. #ifndef NO_DOMAINNAME
  274. #define NO_DOMAINNAME
  275. #endif
  276. #elif defined(SOLARIS) || defined(SOLARISx86)
  277. #define ACCELERATOR_CACHE
  278. #define AUTH_DBM
  279. #define BSD_RLIMIT
  280. #undef BSD_SIGNALS
  281. #define DAEMON_NEEDS_SEMAPHORE
  282. #define DAEMON_UNIX_MOBRULE
  283. #define DLL_CAPABLE
  284. #define DLL_DLOPEN
  285. #define DLL_DLOPEN_FLAGS RTLD_NOW
  286. #define DNS_CACHE
  287. #define FILE_INHERIT_FCNTL
  288. #define FILE_MMAP_FLAGS MAP_SHARED
  289. #define HAS_STATVFS
  290. #define HAVE_ATEXIT
  291. #define HAVE_PW_R
  292. #define HAVE_STRTOK_R
  293. #define HAVE_TIME_R 3 /* arg count */
  294. #define NEED_CRYPT_H
  295. #define NEED_FILIO
  296. #if OSVERSION < 506 || OSVERSION == 50501
  297. #define NEED_GHN_PROTO
  298. #endif
  299. #define NET_SOCKETS
  300. #if OSVERSION > 504
  301. #define SA_HANDLER_T(x) x
  302. #endif
  303. #define SHMEM_MMAP_FLAGS MAP_SHARED
  304. #elif defined (SONY)
  305. #define AUTH_DBM
  306. #undef BSD_RLIMIT
  307. #define DAEMON_NEEDS_SEMAPHORE
  308. #define DAEMON_UNIX_MOBRULE
  309. #define DLL_CAPABLE
  310. #define FILE_INHERIT_FCNTL
  311. #define FILE_MMAP_FLAGS MAP_SHARED
  312. #define HAVE_ATEXIT
  313. #define NEED_CRYPT_H
  314. #define NEED_FILIO
  315. #define NET_SOCKETS
  316. #define SHMEM_MMAP_FLAGS MAP_SHARED
  317. #elif defined(SUNOS4)
  318. #define ACCELERATOR_CACHE
  319. #define AUTH_DBM
  320. #define BSD_MAIL
  321. #define BSD_RLIMIT
  322. #define BSD_SIGNALS
  323. #define BSD_TIME
  324. #define DAEMON_UNIX_MOBRULE
  325. #define DLL_CAPABLE
  326. #define DLL_DLOPEN
  327. #define DLL_DLOPEN_FLAGS 1
  328. #define DNS_CACHE
  329. #define FILE_INHERIT_FCNTL
  330. #define FILE_MMAP_FLAGS MAP_SHARED
  331. #define HAS_STATFS
  332. #undef HAVE_ATEXIT
  333. #undef NEED_CRYPT_H
  334. #define NEED_CRYPT_PROTO
  335. #define NEED_FILIO
  336. #define NET_SOCKETS
  337. #define SHMEM_MMAP_FLAGS MAP_SHARED
  338. #elif defined(UNIXWARE) || defined(UnixWare)
  339. #define ACCELERATOR_CACHE
  340. #define AUTH_DBM
  341. #undef BSD_RLIMIT
  342. #define DAEMON_UNIX_MOBRULE
  343. #define DLL_CAPABLE
  344. #define DLL_DLOPEN
  345. #define DLL_DLOPEN_FLAGS RTLD_NOW
  346. #define DNS_CACHE
  347. #define FILE_INHERIT_FCNTL
  348. #define FILE_MMAP_FLAGS MAP_SHARED
  349. #define HAS_STATVFS
  350. #define HAVE_ATEXIT
  351. #define NEED_CRYPT_H
  352. #define NEED_FILIO
  353. #define NEED_GHN_PROTO
  354. #define NEED_SETEID_PROTO /* setegid, seteuid */
  355. #define NET_SOCKETS
  356. #define SHMEM_MMAP_FLAGS MAP_SHARED
  357. #ifndef boolean
  358. #define boolean boolean
  359. #endif
  360. #if defined (UnixWare)
  361. /* UnixWare but not UNIXWARE... */
  362. #define NEED_STRINGS_H /* for strcasecmp */
  363. #define SA_HANDLER_T(x) (void (*)(int))x
  364. #endif
  365. #elif defined (XP_WIN32) /* Windows NT */
  366. #include <wtypes.h>
  367. #include <winbase.h>
  368. typedef void* PASSWD;
  369. #define ACCELERATOR_CACHE
  370. #define AUTH_DBM
  371. /* size has been raised to 200 with NT 4.0 server; NT 4.0 workstation is still
  372. * limited
  373. */
  374. #define DAEMON_LISTEN_SIZE 200
  375. #define DAEMON_WIN32
  376. #define DLL_CAPABLE
  377. #define DLL_WIN32
  378. #define DNS_CACHE
  379. #define LOG_BUFFERING
  380. #define HAVE_STRFTIME /* no cftime */
  381. #define NEED_CRYPT_PROTO
  382. #define NEEDS_WRITEV
  383. #define NET_SOCKETS
  384. #ifndef NO_DOMAINNAME
  385. #define NO_DOMAINNAME
  386. #endif
  387. #ifdef BUILD_DLL
  388. #define NSAPI_PUBLIC __declspec(dllexport)
  389. #else
  390. #define NSAPI_PUBLIC
  391. #endif /* BUILD_DLL */
  392. #define THREAD_ANY
  393. #define THREAD_NSPR_KERNEL
  394. #define USE_NSPR
  395. #define USE_STRFTIME /* no cftime */
  396. #else
  397. #error "Missing defines in ns/netsite/include/base/systems.h"
  398. #endif /* Windows NT */
  399. /* Pick up the configuration symbols in the public interface */
  400. #ifndef PUBLIC_BASE_SYSTEMS_H
  401. #include "public/base/systems.h"
  402. #endif /* PUBLIC_BASE_SYSTEMS_H */
  403. /* --- Begin defaults for values not defined above --- */
  404. #ifndef DAEMON_LISTEN_SIZE
  405. #define DAEMON_LISTEN_SIZE 128
  406. #endif /* !DAEMON_LISTEN_SIZE */
  407. #ifndef SA_HANDLER_T
  408. #define SA_HANDLER_T(x) (void (*)())x
  409. #endif
  410. #ifdef HAS_CONSTVALUED_STRFUNCS
  411. #define CONSTVALSTRCAST (char *)
  412. #else
  413. #define CONSTVALSTRCAST
  414. #endif
  415. #ifndef THROW_HACK
  416. #define THROW_HACK /* as nothing */
  417. #endif
  418. /* --- End defaults for values not defined above --- */
  419. /* --- Begin the great debate --- */
  420. /* NS_MAIL builds sec-key.c which calls systhread_init, which requires */
  421. /* that USE_NSPR is defined when systhr.c is compiled. --lachman */
  422. /* MCC_PROXY does the same thing now --nbreslow -- LIKE HELL --ari */
  423. #if (defined(MCC_HTTPD) || defined(MCC_ADMSERV) || defined(MCC_PROXY) || defined(NS_MAIL)) && defined(XP_UNIX)
  424. #define USE_NSPR
  425. /* XXXrobm This is UNIX-only for the moment */
  426. #define LOG_BUFFERING
  427. #ifdef SW_THREADS
  428. #define THREAD_NSPR_USER
  429. #else
  430. #define THREAD_NSPR_KERNEL
  431. #ifdef IRIX
  432. #undef SEM_FLOCK
  433. #define SEM_IRIX
  434. #endif
  435. #endif
  436. #define THREAD_ANY
  437. #endif
  438. /* --- End the great debate --- */
  439. #ifndef APSTUDIO_READONLY_SYMBOLS
  440. #ifndef NSPR_PRIO_H
  441. #include <prio.h>
  442. #define NSPR_PRIO_H
  443. #endif /* !NSPR_PRIO_H */
  444. /*
  445. * These types have to be defined early, because they are defined
  446. * as (void *) in the public API.
  447. */
  448. #ifndef SYS_FILE_T
  449. typedef PRFileDesc *SYS_FILE;
  450. #define SYS_FILE_T PRFileDesc *
  451. #endif /* !SYS_FILE_T */
  452. #ifndef SYS_NETFD_T
  453. typedef PRFileDesc *SYS_NETFD;
  454. #define SYS_NETFD_T PRFileDesc *
  455. #endif /* !SYS_NETFD_T */
  456. #ifdef SEM_WIN32
  457. typedef HANDLE SEMAPHORE;
  458. #define SEMAPHORE_T HANDLE
  459. #define SEM_ERROR NULL
  460. /* That oughta hold them (I hope) */
  461. #define SEM_MAXVALUE 32767
  462. #elif defined(SEM_IRIX)
  463. #ifndef OS_ULOCKS_H
  464. #include <ulocks.h>
  465. #define OS_ULOCKS_H
  466. #endif /* !OS_ULOCKS_H */
  467. typedef struct {
  468. usptr_t *arena;
  469. usema_t *sem;
  470. } semirix_s;
  471. typedef semirix_s* SEMAPHORE;
  472. #define SEMAPHORE_T semirix_s *
  473. #define SEM_ERROR NULL
  474. #elif defined(SEM_FLOCK)
  475. #define SEMAPHORE_T SYS_FILE
  476. typedef SYS_FILE SEMAPHORE;
  477. #define SEM_ERROR NULL
  478. #else /* ! SEM_WIN32, !SEM_IRIX */
  479. typedef int SEMAPHORE;
  480. #define SEMAPHORE_T int
  481. #define SEM_ERROR -1
  482. #endif /* SEM_WIN32 */
  483. #endif /* !APSTUDIO_READONLY_SYMBOLS */
  484. #endif /* BASE_SYSTEMS_H */