home *** CD-ROM | disk | FTP | other *** search
/ PC World Plus! (NZ) 2001 October / PCW1001.iso / Linux / apache / apache_1.3.20-win32-no_src-r2.msi / Data.Cab / F160722_ap_config.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-05-15  |  37.4 KB  |  1,423 lines

  1. /* ====================================================================
  2.  * The Apache Software License, Version 1.1
  3.  *
  4.  * Copyright (c) 2000 The Apache Software Foundation.  All rights
  5.  * reserved.
  6.  *
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  *
  11.  * 1. Redistributions of source code must retain the above copyright
  12.  *    notice, this list of conditions and the following disclaimer.
  13.  *
  14.  * 2. Redistributions in binary form must reproduce the above copyright
  15.  *    notice, this list of conditions and the following disclaimer in
  16.  *    the documentation and/or other materials provided with the
  17.  *    distribution.
  18.  *
  19.  * 3. The end-user documentation included with the redistribution,
  20.  *    if any, must include the following acknowledgment:
  21.  *       "This product includes software developed by the
  22.  *        Apache Software Foundation (http://www.apache.org/)."
  23.  *    Alternately, this acknowledgment may appear in the software itself,
  24.  *    if and wherever such third-party acknowledgments normally appear.
  25.  *
  26.  * 4. The names "Apache" and "Apache Software Foundation" must
  27.  *    not be used to endorse or promote products derived from this
  28.  *    software without prior written permission. For written
  29.  *    permission, please contact apache@apache.org.
  30.  *
  31.  * 5. Products derived from this software may not be called "Apache",
  32.  *    nor may "Apache" appear in their name, without prior written
  33.  *    permission of the Apache Software Foundation.
  34.  *
  35.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  36.  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  37.  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  38.  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  39.  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  40.  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  41.  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  42.  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  43.  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44.  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  45.  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  46.  * SUCH DAMAGE.
  47.  * ====================================================================
  48.  *
  49.  * This software consists of voluntary contributions made by many
  50.  * individuals on behalf of the Apache Software Foundation.  For more
  51.  * information on the Apache Software Foundation, please see
  52.  * <http://www.apache.org/>.
  53.  *
  54.  * Portions of this software are based upon public domain software
  55.  * originally written at the National Center for Supercomputing Applications,
  56.  * University of Illinois, Urbana-Champaign.
  57.  */
  58.  
  59. #ifndef AP_CONFIG_H
  60. #define AP_CONFIG_H
  61.  
  62. #ifdef __cplusplus
  63. extern "C" {
  64. #endif
  65.  
  66. /*
  67.  * ap_config.h: system-dependant #defines and includes...
  68.  * See PORTING for a listing of what they mean
  69.  */
  70.  
  71. #include "ap_mmn.h"        /* MODULE_MAGIC_NUMBER_ */
  72.  
  73. /*
  74.  * Support for platform dependent autogenerated defines
  75.  */
  76. #if !defined(WIN32) && !defined(NETWARE)
  77. #include "ap_config_auto.h"
  78. #else
  79. /* not available under WIN32, so provide important entries manually */
  80. #undef HAVE_UNISTD_H
  81. #endif
  82.  
  83. /* Have to include sys/stat.h before ../win32/os.h so we can override
  84. stat() properly */
  85. #ifndef NETWARE
  86. #include <sys/types.h>
  87. #endif
  88. #include <sys/stat.h>
  89.  
  90.  
  91. /* So that we can use inline on some critical functions, and use
  92.  * GNUC attributes (such as to get -Wall warnings for printf-like
  93.  * functions).  Only do this in gcc 2.7 or later ... it may work
  94.  * on earlier stuff, but why chance it.
  95.  *
  96.  * We've since discovered that the gcc shipped with NeXT systems
  97.  * as "cc" is completely broken.  It claims to be __GNUC__ and so
  98.  * on, but it doesn't implement half of the things that __GNUC__
  99.  * means.  In particular it's missing inline and the __attribute__
  100.  * stuff.  So we hack around it.  PR#1613. -djg
  101.  */
  102. #if !defined(__GNUC__) || __GNUC__ < 2 || \
  103.     (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ||\
  104.     defined(NEXT)
  105. #define ap_inline
  106. #define __attribute__(__x)
  107. #define ENUM_BITFIELD(e,n,w)  signed int n : w
  108. #else
  109. #define ap_inline __inline__
  110. #define USE_GNU_INLINE
  111. #define ENUM_BITFIELD(e,n,w)  e n : w
  112. #endif
  113.  
  114. #include "os.h"
  115.  
  116. /* Define one of these according to your system. */
  117. #if defined(MINT)
  118. typedef int rlim_t;
  119. #define JMP_BUF sigjmp_buf
  120. #define NO_LONG_DOUBLE
  121. #define USE_FLOCK_SERIALIZED_ACCEPT
  122. #define _BSD_SOURCE
  123. #define EAGAIN EWOULDBLOCK
  124. int initgroups (char *, int);     
  125. char *crypt (const char *pw, const char *salt);
  126. int gethostname (char *name, int namelen);
  127.  
  128. #elif defined(MPE)
  129. #include <sys/times.h>
  130. #define NO_SETSID
  131. #define NO_KILLPG
  132. #define NO_WRITEV
  133. #define HAVE_SHMGET 1
  134. #define USE_SHMGET_SCOREBOARD
  135. /* 
  136.    UID/GID isn't a native concept for MPE, and it's definitely not a 100%
  137.    Unix implementation.  There isn't a traditional superuser concept either,
  138.    so we're forced to liberalize SHM security a bit so the parent & children
  139.    can communicate when they're running with different UIDs within the same
  140.    GID (the GID will *always* be the same on MPE).  Thus the weird SHM_R and
  141.    SHM_W below.
  142. */
  143. #define SHM_R 0440  /* Read permission */
  144. #define SHM_W 0220  /* Write permission */
  145. #define NEED_INITGROUPS
  146. #define NEED_STRCASECMP
  147. #define NEED_STRDUP
  148. #define NEED_STRNCASECMP
  149. extern void GETPRIVMODE();
  150. extern void GETUSERMODE();
  151. extern char *inet_ntoa();
  152. #define NO_SLACK
  153. #define S_IEXEC  S_IXUSR
  154. #define S_IREAD  S_IRUSR
  155. #define S_IWRITE S_IWUSR
  156. #define PF_INET  AF_INET
  157. #define USE_FCNTL_SERIALIZED_ACCEPT
  158.  
  159. #elif defined(SUNOS4)
  160. #define HAVE_GMTOFF 1
  161. #undef NO_KILLPG
  162. #undef NO_SETSID
  163. char *crypt(const char *pw, const char *salt);
  164. char *mktemp(char *);
  165. #define HAVE_MMAP 1
  166. #define USE_MMAP_SCOREBOARD
  167. #define USE_MMAP_FILES
  168. #include <sys/time.h>
  169. #define NEED_STRERROR
  170. typedef int rlim_t;
  171. #define memmove(a,b,c) bcopy(b,a,c)
  172. #define NO_LINGCLOSE
  173. #define USE_FLOCK_SERIALIZED_ACCEPT
  174. #define NEED_DIFFTIME
  175. #define HAVE_SYSLOG 1
  176.  
  177. #elif defined(SOLARIS2)
  178. #undef HAVE_GMTOFF
  179. #define NO_KILLPG
  180. #undef NO_SETSID
  181. #define bzero(a,b) memset(a,0,b)
  182. #if !defined(USE_SYSVSEM_SERIALIZED_ACCEPT) && \
  183.     !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
  184. #define USE_FCNTL_SERIALIZED_ACCEPT
  185. #endif
  186. #define NEED_UNION_SEMUN
  187. #define HAVE_MMAP 1
  188. #define USE_MMAP_SCOREBOARD
  189. #define USE_MMAP_FILES
  190. int gethostname(char *name, int namelen);
  191. #define HAVE_SYSLOG 1
  192. #define SYS_SIGLIST _sys_siglist
  193.  
  194. #elif defined(IRIX)
  195. #undef HAVE_GMTOFF
  196. /* IRIX has killpg, but it's only in _BSD_COMPAT, so don't use it in case
  197.  * there's some weird conflict with non-BSD signals */
  198. #define NO_KILLPG
  199. #undef NO_SETSID
  200. #if !defined(USE_FLOCK_SERIALIZED_ACCEPT) && \
  201.     !defined(USE_USLOCK_SERIALIZED_ACCEPT) && \
  202.     !defined(USE_SYSVSEM_SERIALIZED_ACCEPT)
  203. #define USE_FCNTL_SERIALIZED_ACCEPT
  204. #endif
  205. #define HAVE_SHMGET 1
  206. #define USE_SHMGET_SCOREBOARD
  207. #define HAVE_MMAP 1
  208. #define USE_MMAP_FILES
  209. #define NO_LONG_DOUBLE
  210. #define NO_LINGCLOSE
  211. #define HAVE_SYSLOG 1
  212.  
  213. #elif defined(HIUX)
  214. #undef HAVE_GMTOFF
  215. #define NO_KILLPG
  216. #undef NO_SETSID
  217. #ifndef _HIUX_SOURCE
  218. #define _HIUX_SOURCE
  219. #endif
  220. #define HAVE_SHMGET 1
  221. #define USE_SHMGET_SCOREBOARD
  222. #define SELECT_NEEDS_CAST
  223. #define HAVE_SYSLOG 1
  224.  
  225. #elif defined(HPUX) || defined(HPUX10)
  226. #undef HAVE_GMTOFF
  227. #define NO_KILLPG
  228. #undef NO_SETSID
  229. #define USE_FCNTL_SERIALIZED_ACCEPT
  230. #ifndef _HPUX_SOURCE
  231. #define _HPUX_SOURCE
  232. #endif
  233. #define HAVE_SHMGET 1
  234. #define USE_SHMGET_SCOREBOARD
  235. #define HAVE_SYSLOG 1
  236. #ifndef HPUX10
  237. #define SELECT_NEEDS_CAST
  238. typedef int rlim_t;
  239. #endif
  240.  
  241. #elif defined(HPUX11)
  242. #ifndef _HPUX_SOURCE
  243. #define _HPUX_SOURCE
  244. #endif
  245. #define HAVE_SHMGET
  246. #define USE_SHMGET_SCOREBOARD
  247. #undef  HAVE_GMTOFF
  248. #define USE_FCNTL_SERIALIZED_ACCEPT
  249. /* feeling brave?  want to try using POSIX mutexes? */
  250. /* #define HAVE_MMAP */
  251. /* #define USE_MMAP_SCOREBOARD */
  252. /* #define USE_MMAP_FILES */
  253. /* #define USE_PTHREAD_SERIALIZED_ACCEPT */
  254. #define NO_KILLPG
  255. #undef  NO_SETSID
  256. #define HAVE_SYSLOG
  257.  
  258. #elif defined(AIX)
  259. #undef HAVE_GMTOFF
  260. #undef NO_KILLPG
  261. #undef NO_SETSID
  262. #ifndef __ps2__
  263. #define HAVE_MMAP 1
  264. #define USE_MMAP_SCOREBOARD
  265. #define USE_MMAP_FILES
  266. #define HAVE_SYSLOG 1
  267. #ifndef DEFAULT_GROUP
  268. #define DEFAULT_GROUP "nobody"
  269. #endif
  270. #endif
  271. #ifndef DEFAULT_USER
  272. #define DEFAULT_USER "nobody"
  273. #endif
  274. #ifdef NEED_RLIM_T
  275. typedef int rlim_t;
  276. #endif
  277. #if !defined(USE_PTHREAD_SERIALIZED_ACCEPT)
  278. #define USE_FCNTL_SERIALIZED_ACCEPT
  279. #endif
  280. #ifdef USEBCOPY
  281. #define memmove(a,b,c) bcopy(b,a,c)
  282. #endif
  283. #if AIX >= 42
  284. #define NET_SIZE_T size_t
  285. #endif
  286.  
  287. #elif defined(ULTRIX)
  288. /* we don't want to use sys/resource.h under
  289.    Ultrix although this header exists. */
  290. #undef HAVE_SYS_RESOURCE_H
  291. #define HAVE_GMTOFF 1
  292. #undef NO_KILLPG
  293. #undef NO_SETSID
  294. #define ULTRIX_BRAIN_DEATH
  295. #define NEED_STRDUP
  296. /* If you have Ultrix 4.3, and are using cc, const is broken */
  297. #ifndef __ultrix__        /* Hack to check for pre-Ultrix 4.4 cc */
  298. #define const            /* Not implemented */
  299. #endif
  300.  
  301. #elif defined(OSF1)
  302. #define HAVE_GMTOFF 1
  303. #undef NO_KILLPG
  304. #undef NO_SETSID
  305. #define HAVE_MMAP 1
  306. #define USE_MMAP_SCOREBOARD
  307. #define USE_MMAP_FILES
  308. #define NO_LONG_DOUBLE
  309. #define HAVE_SYSLOG 1
  310. #define USE_FLOCK_SERIALIZED_ACCEPT
  311. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  312.  
  313. #elif defined(PARAGON)
  314. #define HAVE_GMTOFF 1
  315. #undef NO_KILLPG
  316. #undef NO_SETSID
  317. #define HAVE_MMAP 1
  318. #define USE_MMAP_SCOREBOARD
  319. #define USE_MMAP_FILES
  320. #define NO_LONG_DOUBLE
  321. #define HAVE_SYSLOG 1
  322. typedef int rlim_t;
  323.  
  324. #elif defined(SEQUENT)
  325. #define DEFAULT_USER "nobody"
  326. #define DEFAULT_GROUP "nobody"
  327. #define NO_SHMGET 1
  328. #define HAVE_MMAP 1
  329. #define HAVE_SYSLOG 1
  330. #define USE_MMAP_FILES 1
  331. #define USE_MMAP_SCOREBOARD 1
  332. #define USE_FCNTL_SERIALIZED_ACCEPT 1
  333. #define JMP_BUF sigjmp_buf
  334. #undef NO_SETSID
  335. #if SEQUENT < 40
  336. typedef int rlim_t;
  337. #define NO_GETTIMEOFDAY
  338. #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
  339. #include <sys/times.h>
  340. #endif
  341. #if SEQUENT < 42
  342. #define NEED_STRCASECMP
  343. #define NEED_STRNCASECMP
  344. #endif
  345. #if SEQUENT < 44
  346. #define NO_KILLPG 1
  347. #define NET_SIZE_T int
  348. #endif
  349. #if SEQUENT >= 44
  350. #undef NO_KILLPG
  351. #define NET_SIZE_T size_t
  352. #endif
  353.  
  354. #elif defined(NEXT)
  355. typedef unsigned short mode_t;
  356. typedef int rlim_t;
  357. #define HAVE_GMTOFF 1
  358. #undef NO_KILLPG
  359. #define NO_SETSID
  360. #define NEED_STRDUP
  361. #define NO_LINGCLOSE
  362. #undef _POSIX_SOURCE
  363. #ifndef FD_CLOEXEC
  364. #define FD_CLOEXEC 1
  365. #endif
  366. #ifndef S_ISDIR
  367. #define S_ISDIR(m)      (((m)&(S_IFMT)) == (S_IFDIR))
  368. #endif
  369. #ifndef S_ISREG
  370. #define S_ISREG(m)      (((m)&(S_IFMT)) == (S_IFREG))
  371. #endif
  372. #ifndef S_IXUSR
  373. #define S_IXUSR 00100
  374. #endif
  375. #ifndef S_IRGRP
  376. #define S_IRGRP 00040
  377. #endif
  378. #ifndef S_IXGRP
  379. #define S_IXGRP 00010
  380. #endif
  381. #ifndef S_IROTH
  382. #define S_IROTH 00004
  383. #endif
  384. #ifndef S_IXOTH
  385. #define S_IXOTH 00001
  386. #endif
  387. #ifndef S_IRUSR
  388. #define S_IRUSR S_IREAD
  389. #endif
  390. #ifndef S_IWUSR
  391. #define S_IWUSR S_IWRITE
  392. #endif
  393. #ifndef S_IWGRP
  394. #define S_IWGRP    000020
  395. #endif
  396. #ifndef S_IWOTH
  397. #define S_IWOTH 000002
  398. #endif
  399.  
  400. #define STDIN_FILENO  0
  401. #define STDOUT_FILENO 1
  402. #define STDERR_FILENO 2
  403.  
  404. /* PR#2293 fix */
  405. #define    ap_wait_t    union wait
  406. #define waitpid(a,b,c) wait4((a) == -1 ? 0 : (a),(union wait *)(b),c,NULL)
  407. #define WEXITSTATUS(status)     (int)( WIFEXITED(status) ? ( (status).w_retcode ) : -1)
  408. #define WTERMSIG(status)    (int)( (status).w_termsig )
  409.  
  410. typedef int pid_t;
  411. #define USE_LONGJMP
  412. #define NO_USE_SIGACTION
  413. #define HAVE_SYSLOG 1
  414.  
  415. #if defined(__DYNAMIC__)
  416. #define HAVE_DYLD
  417. #define DYLD_CANT_UNLOAD
  418. #endif
  419.  
  420. #elif defined(DARWIN) /* Darwin (Mac OS) */
  421. #undef PLATFORM
  422. #define PLATFORM "Darwin"
  423. #define HAVE_DYLD
  424. #define HAVE_GMTOFF
  425. #define HAVE_MMAP
  426. #define USE_MMAP_FILES
  427. #define USE_MMAP_SCOREBOARD
  428. #ifdef MAC_OS_X_SERVER
  429. #define MAP_TMPFILE
  430. #endif /* MAC_OS_X_SERVER */
  431. #define HAVE_RESOURCE
  432. #define HAVE_SNPRINTF
  433. #define JMP_BUF jmp_buf
  434. #define USE_LONGJMP
  435. #define USE_FLOCK_SERIALIZED_ACCEPT
  436. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  437.  
  438. #elif defined(LINUX)
  439.  
  440. #if LINUX > 1
  441. #include <features.h>
  442.  
  443. /* libc4 systems probably still work, it probably doesn't define
  444.  *  __GNU_LIBRARY__
  445.  * libc5 systems define __GNU_LIBRARY__ == 1, but don't define __GLIBC__
  446.  * glibc 2.x and later systems define __GNU_LIBRARY__ == 6, but list it as
  447.  * "deprecated in favour of __GLIBC__"; the value 6 will never be changed.
  448.  * glibc 1.x systems (i.e. redhat 4.x on sparc/alpha) should have
  449.  * __GLIBC__ < 2
  450.  * all glibc based systems need crypt.h
  451.  */
  452. #if defined(__GNU_LIBRARY__) && __GNU_LIBRARY__ > 1
  453. #include <crypt.h>
  454. #endif
  455.  
  456. /* glibc 2.0.0 through 2.0.4 need size_t * here, where 2.0.5 needs socklen_t *
  457.  * there's no way to discern between these two libraries.  But using int should
  458.  * be portable because otherwise these libs would be hopelessly broken with
  459.  * reams of existing networking code.  We'll use socklen_t * for 2.1.x and
  460.  * later.
  461.  *
  462.  * int works for all the earlier libs, and is picked up by default later.
  463.  */
  464. #if defined(__GLIBC__) && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 0))
  465. #define NET_SIZE_T socklen_t
  466. #endif
  467.  
  468. #define HAVE_SHMGET 1
  469. #define USE_SHMGET_SCOREBOARD
  470. #define HAVE_MMAP 1
  471. #define USE_MMAP_FILES
  472.  
  473. #if LINUX > 20
  474. /* see Pine.LNX.4.21.0011041233550.1897-100000@twinlark.arctic.org
  475.  * in new-httpd archives for performance numbers indicating these
  476.  * are the right choices for linux 2.2.x and later
  477.  */
  478. #define USE_SYSVSEM_SERIALIZED_ACCEPT
  479. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT 
  480. #include <sys/sem.h>
  481. #if _SEM_SEMUN_UNDEFINED
  482. #define NEED_UNION_SEMUN
  483. #endif
  484. #else
  485. #define USE_FCNTL_SERIALIZED_ACCEPT
  486. #endif
  487.  
  488. #define SYS_SIGLIST    _sys_siglist
  489.  
  490. #else
  491. #define USE_FCNTL_SERIALIZED_ACCEPT
  492. #endif
  493.  
  494. #undef HAVE_GMTOFF
  495. #undef NO_KILLPG
  496. #undef NO_SETSID
  497. #undef NEED_STRDUP
  498. #include <sys/time.h>
  499. #define HAVE_SYSLOG 1
  500.  
  501. /* glibc 2.1 and later finally define rlim_t */
  502. #if !defined(__GLIBC__) || __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 1)
  503. typedef int rlim_t;
  504. #endif
  505.  
  506. #elif defined(SCO)
  507. #undef HAVE_GMTOFF
  508. #undef NO_KILLPG
  509. #undef NO_SETSID
  510. #define NEED_INITGROUPS
  511. #define NO_WRITEV
  512. #include <sys/time.h>
  513. #define HAVE_SYSLOG 1
  514. #undef HAVE_SYS_RESOURCE_H
  515.  
  516. #elif defined(SCO5)
  517.  
  518. #define USE_FCNTL_SERIALIZED_ACCEPT
  519. #define HAVE_MMAP 1
  520. #define USE_MMAP_SCOREBOARD
  521. #define USE_MMAP_FILES
  522. #define SecureWare
  523. #define HAVE_SYSLOG 1
  524.  
  525. /* Although SCO 5 defines these in <strings.h> (note the "s") they don't have
  526.    consts. Sigh. */
  527. extern int strcasecmp(const char *, const char *);
  528. extern int strncasecmp(const char *, const char *, unsigned);
  529.  
  530. #elif defined(AUX3)
  531. /* These are to let -Wall compile more cleanly */
  532. extern int strcasecmp(const char *, const char *);
  533. extern int strncasecmp(const char *, const char *, unsigned);
  534. extern int set42sig(), getopt(), getpeername(), bzero();
  535. extern int listen(), bind(), socket(), getsockname();
  536. extern int accept(), gethostname(), connect(), lstat();
  537. extern int select(), killpg(), shutdown();
  538. extern int initgroups(), setsockopt();
  539. extern char *shmat();
  540. extern int shmctl();
  541. extern int shmget();
  542. extern char *sbrk();
  543. extern char *crypt();
  544. #include <sys/time.h>
  545. #undef HAVE_GMTOFF
  546. #undef NO_KILLPG
  547. #undef NO_SETSID
  548. #define NEED_STRDUP
  549. /* fcntl() locking is expensive with NFS */
  550. #define USE_FLOCK_SERIALIZED_ACCEPT
  551. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  552. #define HAVE_SHMGET 1
  553. #define USE_SHMGET_SCOREBOARD
  554. /*
  555.  * NOTE: If when you run Apache under A/UX and you get a warning
  556.  * that httpd couldn't move break, then the below value for
  557.  * MOVEBREAK (64megs) is too large for your setup. Try reducing
  558.  * to 0x2000000 which is still PLENTY of space. I doubt if
  559.  * even on heavy systems sbrk() would be called at all...
  560.  */
  561. #define MOVEBREAK        0x4000000
  562. #define NO_LINGCLOSE
  563. #define NO_SLACK
  564. #define HAVE_SYSLOG 1
  565. #undef HAVE_SYS_RESOURCE_H    /* exists but does not provide *rlimit funcs */
  566.  
  567. #elif defined(SVR4)
  568. #define NO_KILLPG
  569. #undef  NO_SETSID
  570. #undef NEED_STRDUP
  571. #ifndef MPRAS
  572. #define NEED_STRCASECMP
  573. #ifndef ENCORE
  574. #define NEED_STRNCASECMP
  575. #endif /* ENCORE */
  576. #endif /* MPRAS */
  577. #define bzero(a,b) memset(a,0,b)
  578. /* A lot of SVR4 systems need this */
  579. #ifndef USE_SYSVSEM_SERIALIZED_ACCEPT
  580. #define USE_FCNTL_SERIALIZED_ACCEPT
  581. #endif
  582. #define HAVE_SYSLOG 1
  583. #define NET_SIZE_T size_t
  584. #define HAVE_SHMGET 1
  585. #define USE_SHMGET_SCOREBOARD
  586. #ifdef _OSD_POSIX /* BS2000-POSIX mainframe needs initgroups */
  587. #define NEED_HASHBANG_EMUL /* execve() doesn't start shell scripts by default */
  588. #define _KMEMUSER          /* Enable SHM_R/SHM_W defines in <shm.h> */
  589. #undef NEED_STRCASECMP
  590. #undef NEED_STRNCASECMP
  591. #undef bzero
  592. #endif /*_OSD_POSIX*/
  593.  
  594. #elif defined(UW)
  595. #if UW < 700
  596. #define USE_FCNTL_SERIALIZED_ACCEPT
  597. #define NO_LINGCLOSE
  598. #define NO_KILLPG
  599. #endif
  600. #undef  NO_SETSID
  601. #undef NEED_STRDUP
  602. #define NEED_STRCASECMP
  603. #define NEED_STRNCASECMP
  604. #define bzero(a,b) memset(a,0,b)
  605. #define HAVE_MMAP 1
  606. #define USE_MMAP_SCOREBOARD
  607. #define USE_MMAP_FILES
  608. #define HAVE_SHMGET 1
  609. #undef USE_SHMGET_SCOREBOARD    /* force use of mmap() scoreboard */
  610. #include <sys/time.h>
  611. #if UW >= 200
  612. #define _POSIX_SOURCE
  613. #endif
  614. #define NET_SIZE_T size_t
  615. #define HAVE_SYSLOG 1
  616.  
  617. #elif defined(DGUX)
  618. #define NO_KILLPG
  619. #undef  NO_SETSID
  620. #undef NEED_STRDUP
  621. #ifdef _IX86_DG
  622. #undef NEED_STRCASECMP
  623. #undef NEED_STRNCASECMP
  624. #else
  625. #define NEED_STRCASECMP
  626. #define NEED_STRNCASECMP
  627. #endif
  628. #define bzero(a,b) memset(a,0,b)
  629. /* A lot of SVR4 systems need this */
  630. #define USE_FCNTL_SERIALIZED_ACCEPT
  631. #define ap_inet_addr inet_network
  632. #define HAVE_SYSLOG 1
  633.  
  634. #elif defined(__NetBSD__) || defined(__OpenBSD__) || defined(NETBSD)
  635. #define HAVE_GMTOFF 1
  636. #undef NO_KILLPG
  637. #undef NO_SETSID
  638. #define HAVE_SYSLOG 1
  639. #ifndef DEFAULT_USER
  640. #define DEFAULT_USER "nobody"
  641. #endif
  642. #ifndef DEFAULT_GROUP
  643. #define DEFAULT_GROUP "nogroup"
  644. #endif
  645. #define HAVE_SHMGET 1
  646. #define HAVE_MMAP 1
  647. #define USE_MMAP_SCOREBOARD
  648. #define USE_MMAP_FILES
  649. #define USE_FLOCK_SERIALIZED_ACCEPT
  650. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  651.  
  652. #elif defined(UTS21)
  653. #undef HAVE_GMTOFF
  654. #undef NO_KILLPG
  655. #define NO_SETSID
  656. #define NEED_WAITPID
  657. #define STDIN_FILENO 0
  658. #define STDOUT_FILENO 1
  659. #define STDERR_FILENO 2
  660. #define HAVE_SYSLOG 1
  661. #define USE_LONGJMP
  662. #define JMP_BUF jmp_buf
  663. #define NO_USE_SIGACTION
  664. #define NEED_STRERROR
  665. #define NEED_STRSTR
  666. #define NEED_HASHBANG_EMUL
  667. #define NDELAY_PIPE_RETURNS_ZERO
  668. #define NO_DATA NO_ADDRESS
  669. #define    ap_wait_t        union wait
  670. #define WEXITSTATUS(status)    (int)((status).w_retcode)
  671. #define WTERMSIG(status)    (int)((status).w_termsig)
  672. #define strftime(buf,bufsize,fmt,tm)    ascftime(buf,fmt,tm)
  673. #undef HAVE_SYS_RESOURCE_H /* exists but does not provide *rlimit funcs */
  674. #include <sys/types.h>
  675. #include <sys/time.h>     
  676.  
  677. #elif defined(APOLLO)
  678. #undef HAVE_GMTOFF
  679. #undef NO_KILLPG
  680. #undef NO_SETSID
  681. #define HAVE_SYSLOG 1
  682.  
  683. #elif defined(__FreeBSD__) || defined(__bsdi__)
  684. #if defined(__FreeBSD__)
  685. #include <osreldate.h>
  686. #endif
  687. #define HAVE_GMTOFF 1
  688. #undef NO_KILLPG
  689. #undef NO_SETSID
  690. #define HAVE_MMAP 1
  691. #define USE_MMAP_SCOREBOARD
  692. #define USE_MMAP_FILES
  693. #ifndef DEFAULT_USER
  694. #define DEFAULT_USER "nobody"
  695. #endif
  696. #ifndef DEFAULT_GROUP
  697. #define DEFAULT_GROUP "nogroup"
  698. #endif
  699. #if defined(__bsdi__) || \
  700. (defined(__FreeBSD_version) && (__FreeBSD_version < 220000))
  701. typedef quad_t rlim_t;
  702. #endif
  703. #define USE_FLOCK_SERIALIZED_ACCEPT
  704. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  705. #define HAVE_SYSLOG 1
  706. #define SYS_SIGLIST sys_siglist
  707. #if (defined(__FreeBSD_version) && (__FreeBSD_version >= 400000))
  708. #define NET_SIZE_T socklen_t
  709. #endif
  710.  
  711. #elif defined(QNX)
  712. #ifndef crypt
  713. char *crypt(const char *pw, const char *salt);
  714. #endif
  715. #ifndef initgroups
  716. int initgroups(char *, int);
  717. #endif
  718. #ifndef strncasecmp
  719. #define strncasecmp strnicmp
  720. #endif
  721. #undef NO_KILLPG
  722. #undef NO_SETSID
  723. #define NEED_INITGROUPS
  724. #define NEED_SELECT_H
  725. #define NEED_PROCESS_H
  726. #include <unix.h>
  727. #define HAVE_MMAP 1
  728. #define USE_POSIX_SCOREBOARD
  729. #define USE_FLOCK_SERIALIZED_ACCEPT
  730. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  731. #define HAVE_SYSLOG 1
  732.  
  733. #elif defined(LYNXOS)
  734. #undef HAVE_GMTOFF
  735. #undef USE_MMAP_SCOREBOARD
  736. #undef USE_SHMGET_SCOREBOARD
  737. #undef USE_FCNTL_SERIALIZED_ACCEPT
  738. #undef USE_FLOCK_SERIALIZED_ACCEPT
  739. #define USE_LONGJMP
  740. #undef NO_KILLPG
  741. #undef NO_SETSID
  742. #undef NO_USE_SIGACTION
  743. #undef NO_LINGCLOSE
  744. extern char *crypt(char *pw, char *salt);
  745. typedef int rlim_t;
  746. #define HAVE_SYSLOG 1
  747.  
  748. #elif defined(UXPDS)
  749. #undef NEED_STRCASECMP
  750. #undef NEED_STRNCASECMP
  751. #undef NEED_STRDUP
  752. #undef HAVE_GMTOFF
  753. #define NO_KILLPG
  754. #undef NO_SETSID
  755. #define bzero(a,b) memset(a,0,b)
  756. #define USE_FCNTL_SERIALIZED_ACCEPT
  757. #define HAVE_MMAP 1
  758. #define USE_MMAP_SCOREBOARD
  759. #define USE_MMAP_FILES
  760. #define HAVE_SYSLOG 1
  761.  
  762. #elif defined(OS2)
  763. /* Defines required for EMX OS/2 port. */
  764. #define NO_KILLPG
  765. #define NEED_STRCASECMP
  766. #define NEED_STRNCASECMP
  767. #define NEED_PROCESS_H
  768. #define NO_SETSID
  769. #define NO_TIMES
  770. #define CASE_BLIND_FILESYSTEM
  771. /* Add some drive name support */
  772. #define chdir _chdir2
  773. #include <sys/time.h>
  774. #define MAXSOCKETS 2048
  775. #define USE_OS2_SCOREBOARD
  776. #define NO_RELIABLE_PIPED_LOGS
  777. #define USE_OS2SEM_SERIALIZED_ACCEPT
  778. #define SINGLE_LISTEN_UNSERIALIZED_ACCEPT
  779. #define NO_SLACK
  780. #define FOPEN_REQUIRES_T
  781.  
  782. #elif defined(__MACHTEN__)
  783. typedef int rlim_t;
  784. #undef NO_KILLPG
  785. #define NO_SETSID
  786. #define HAVE_GMTOFF 1
  787. #ifndef __MACHTEN_PPC__
  788. #ifndef __MACHTEN_68K__
  789. #define __MACHTEN_68K__
  790. #endif
  791. #define USE_FLOCK_SERIALIZED_ACCEPT
  792. #define NO_USE_SIGACTION
  793. #define JMP_BUF sigjmp_buf
  794. #define USE_LONGJMP
  795. #undef NEED_STRDUP
  796. #else
  797. #define HAVE_SHMGET 1
  798. #define USE_SHMGET_SCOREBOARD
  799. #define USE_FCNTL_SERIALIZED_ACCEPT
  800. #endif
  801.  
  802. /* Convex OS v11 */
  803. #elif defined(CONVEXOS11)
  804. #undef HAVE_GMTOFF
  805. #undef NO_KILLPG
  806. #undef NO_SETSID
  807. #undef NEED_STRDUP
  808. #define HAVE_MMAP 1
  809. #define USE_MMAP_SCOREBOARD
  810. #define USE_MMAP_FILES
  811. #define HAVE_SYSLOG 1
  812.  
  813. #define NO_TIMEZONE
  814. #include <stdio.h>
  815. #include <sys/types.h>
  816. typedef int rlim_t;
  817.  
  818. #elif defined(ISC)
  819. #include <net/errno.h>
  820. #define NO_KILLPG
  821. #undef NO_SETSID
  822. #define HAVE_SHMGET 1
  823. #define USE_SHMGET_SCOREBOARD
  824. #define USE_FCNTL_SERIALIZED_ACCEPT
  825. #define HAVE_SYSLOG 1
  826.  
  827. #elif defined(NEWSOS)
  828. #define HAVE_SHMGET 1
  829. #define USE_SHMGET_SCOREBOARD
  830. #define USE_LONGJMP
  831. #define NO_SETSID
  832. #define NO_USE_SIGACTION
  833. #define NEED_WAITPID
  834. #define NO_OTHER_CHILD
  835. #define HAVE_SYSLOG 1
  836. #include <sys/time.h>
  837. #include <stdlib.h>
  838. #include <sys/types.h>
  839. typedef int pid_t;
  840. typedef int rlim_t;
  841. typedef int mode_t;
  842.  
  843. #elif defined(RISCIX)
  844. #include <sys/time.h>
  845. typedef int rlim_t;
  846. #define NO_USE_SIGACTION
  847. #define USE_LONGJMP
  848. #define NEED_STRCASECMP
  849. #define NEED_STRNCASECMP
  850. #define NEED_STRDUP
  851.  
  852. #elif defined(BEOS)
  853. #undef PLATFORM
  854. #define PLATFORM "BeOS"
  855. #include <stddef.h>
  856.  
  857. #define NO_WRITEV
  858. #define NO_KILLPG
  859. #define NEED_INITGROUPS
  860. #define PF_INET AF_INET
  861. #define S_IEXEC S_IXUSR
  862.  
  863. #elif defined(BONE)
  864. #undef PLATFORM
  865. #define PLATFORM "BeOS BONE"
  866. #define NO_KILLPG
  867. #define NEED_INITGROUPS
  868. #define S_IEXEC S_IXUSR
  869.  
  870. #elif defined(_CX_SX)
  871. #define JMP_BUF sigjmp_buf
  872. #include <sys/types.h>
  873. #include <sys/time.h>
  874.  
  875. #elif defined(WIN32)
  876.  
  877. /* All windows stuff is now in os/win32/os.h */
  878.  
  879. #elif defined(TPF) /* IBM Transaction Processing Facility operating system */
  880.  
  881. #include <tpfeq.h>
  882. #include <tpfio.h>
  883. #include <sysapi.h>
  884. #include <sysgtime.h>
  885. #define PRIMECRAS 0x010000
  886. #define JMP_BUF jmp_buf
  887. #define HAVE_SHMGET
  888. #undef  HAVE_SYS_RESOURCE_H
  889. #define NEED_INITGROUPS
  890. #define NEED_SIGNAL_INTERRUPT
  891. #include <strings.h>
  892. #ifndef __strings_h
  893. #define NEED_STRCASECMP
  894. #define NEED_STRNCASECMP
  895. #endif
  896. #define NEED_STRDUP
  897. #define NO_DBM_REWRITEMAP
  898. #define NO_GETTIMEOFDAY
  899. #define NO_LINGCLOSE
  900. #define NO_MMAP
  901. #define NO_OTHER_CHILD
  902. #define NO_PIPED_LOGS
  903. #define NO_RELIABLE_PIPED_LOGS
  904. #define NO_SETSID
  905. #define NO_SLACK
  906. #define NO_TIMES
  907. #define NO_USE_SIGACTION
  908. #define USE_LONGJMP
  909. #define USE_SHMGET_SCOREBOARD
  910. /*#define USE_TPF_SCOREBOARD*/
  911. #define USE_TPF_ACCEPT
  912. #define USE_TPF_CORE_SERIALIZED_ACCEPT
  913. #define USE_TPF_SELECT
  914. #define S_IREAD S_IRUSR
  915. #define S_IWRITE S_IWUSR
  916. #define S_IEXEC S_IXUSR
  917. #define crypt(buf,salt) ((char *)buf)
  918. #undef  offsetof
  919. #define offsetof(s_type,field) ((size_t)&(((s_type*)0)->field))
  920.  
  921. #elif defined(__TANDEM)
  922. #define NO_WRITEV
  923. #define NO_KILLPG
  924. #define NEED_INITGROUPS
  925. #define NO_SLACK
  926.  
  927. #elif defined(OS390)                /* IBM OS/390 Operating System      */
  928. #define HAVE_MMAP
  929. #define HAVE_SHMGET
  930. #define USE_SHMGET_SCOREBOARD
  931. #define USE_MMAP_FILES
  932. #define NEED_UNION_SEMUN
  933. #define USE_SYSVSEM_SERIALIZED_ACCEPT
  934. #define _POSIX_SOURCE
  935. #include <signal.h>
  936. #ifdef SIGDUMP  /* SIGDUMP is not defined by OS/390 v1r2 */
  937. #define NSIG SIGDUMP+1
  938. #else
  939. #define NSIG 40
  940. #endif
  941. #define JMP_BUF sigjmp_buf
  942. #define _XOPEN_SOURCE_EXTENDED 1
  943. #define _OPEN_MSGQ_EXT
  944. #define _XOPEN_SOURCE
  945. #define SHM_R S_IRUSR
  946. #define SHM_W S_IWUSR
  947. #include <sys/time.h>
  948. #include <sys/types.h>
  949. #include <sys/msg.h>
  950. #include <sys/socket.h>
  951. #define NET_SIZE_T size_t
  952. #define NEED_HASHBANG_EMUL
  953.  
  954. #elif defined(CYGWIN)               /* Cygwin 1.x POSIX layer for Win32 */
  955. #define JMP_BUF jmp_buf
  956. #define NO_KILLPG
  957. #define USE_LONGJMP
  958.  
  959. #else
  960. /* Unknown system - Edit these to match */
  961. #ifdef BSD
  962. #define HAVE_GMTOFF 1
  963. #else
  964. #undef HAVE_GMTOFF
  965. #endif
  966. /* NO_KILLPG is set on systems that don't have killpg */
  967. #undef NO_KILLPG
  968. /* NO_SETSID is set on systems that don't have setsid */
  969. #undef NO_SETSID
  970. /* NEED_STRDUP is set on stupid systems that don't have strdup. */
  971. #undef NEED_STRDUP
  972. #endif
  973.  
  974. #ifdef HAVE_SYS_PARAM_H
  975. #include <sys/param.h>
  976. #endif /* HAVE_SYS_PARAM_H */
  977.  
  978. /* stuff marked API_EXPORT is part of the API, and intended for use
  979.  * by modules
  980.  */
  981. #ifndef API_EXPORT
  982. #define API_EXPORT(type)    type
  983. #endif
  984.  
  985. /* Stuff marked API_EXPORT_NONSTD is part of the API, and intended for
  986.  * use by modules.  The difference between API_EXPORT and
  987.  * API_EXPORT_NONSTD is that the latter is required for any functions
  988.  * which use varargs or are used via indirect function call.  This
  989.  * is to accomodate the two calling conventions in windows dlls.
  990.  */
  991. #ifndef API_EXPORT_NONSTD
  992. #define API_EXPORT_NONSTD(type)    type
  993. #endif
  994.  
  995. #ifndef MODULE_VAR_EXPORT
  996. #define MODULE_VAR_EXPORT
  997. #endif
  998. #ifndef API_VAR_EXPORT
  999. #define API_VAR_EXPORT
  1000. #endif
  1001.  
  1002. /* modules should not used functions marked CORE_EXPORT
  1003.  * or CORE_EXPORT_NONSTD */
  1004. #ifndef CORE_EXPORT
  1005. #define CORE_EXPORT    API_EXPORT
  1006. #endif
  1007. #ifndef CORE_EXPORT_NONSTD
  1008. #define CORE_EXPORT_NONSTD    API_EXPORT_NONSTD
  1009. #endif
  1010.  
  1011. /* On Darwin, symbols that conflict with loaded dylibs
  1012.  * (eg. System framework) need to be declared as private symbols with
  1013.  * __private_extern__.
  1014.  * For other systems, make that a no-op.
  1015.  */
  1016. #if defined(DARWIN) && defined(__DYNAMIC__)
  1017. #define ap_private_extern __private_extern__
  1018. #else
  1019. #define ap_private_extern
  1020. #endif
  1021.  
  1022. /*
  1023.  * The particular directory style your system supports. If you have dirent.h
  1024.  * in /usr/include (POSIX) or /usr/include/sys (SYSV), #include 
  1025.  * that file and define DIR_TYPE to be dirent. Otherwise, if you have 
  1026.  * /usr/include/sys/dir.h, define DIR_TYPE to be direct and include that
  1027.  * file. If you have neither, I'm confused.
  1028.  */
  1029.  
  1030. #ifndef NETWARE
  1031. #include <sys/types.h>
  1032. #endif
  1033. #include <stdarg.h>
  1034.  
  1035. #if !defined(NEXT) && !defined(WIN32)
  1036. #include <dirent.h>
  1037. #define DIR_TYPE dirent
  1038. #elif !defined(WIN32)
  1039. #include <sys/dir.h>
  1040. #define DIR_TYPE direct
  1041. #else
  1042. #define DIR_TYPE dirent
  1043. #endif
  1044.  
  1045. #include <stdio.h>
  1046. #include <stdlib.h>
  1047. #include <string.h>
  1048. #ifdef __TANDEM
  1049. #include <strings.h>
  1050. #endif
  1051. #include "ap_ctype.h"
  1052. #if !defined(MPE) && !defined(WIN32) && !defined(TPF) && !defined(__TANDEM) && !defined(NETWARE)
  1053. #include <sys/file.h>
  1054. #endif
  1055. #if !defined(WIN32) && !defined(NETWARE)
  1056. #include <sys/socket.h>
  1057. #ifdef HAVE_SYS_SELECT_H
  1058. #include <sys/select.h>
  1059. #endif /* HAVE_SYS_SELECT_H */
  1060. #ifndef TPF
  1061. #include <netinet/in.h>
  1062. #endif /* TPF */
  1063. #if defined(OS390) && !defined(NO_ADDRESS)
  1064. #define NO_ADDRESS NO_DATA  /* Not defined properly by OS/390 v1r2 */
  1065. #endif
  1066. #include <netdb.h>
  1067. #include <sys/ioctl.h>
  1068. #if !defined(MPE) && !defined(BEOS) && !defined(TPF)
  1069. #include <arpa/inet.h>        /* for inet_ntoa */
  1070. #endif
  1071. #include <sys/wait.h>
  1072. #include <pwd.h>
  1073. #include <grp.h>
  1074. #include <fcntl.h>
  1075. #ifndef BEOS
  1076. #define closesocket(s) close(s)
  1077. #endif
  1078. #ifndef O_BINARY
  1079. #define O_BINARY (0)
  1080. #endif
  1081. #endif /* ndef WIN32 */
  1082.  
  1083. #include <limits.h>
  1084. #include <time.h>        /* for ctime */
  1085. #ifdef WIN32
  1086. #define strftime(s,max,format,tm)  os_strftime(s,max,format,tm)
  1087. #endif
  1088. #include <signal.h>
  1089. #ifdef NETWARE
  1090. #undef SIGKILL
  1091. #undef SA_NOCLDSTOP
  1092. #undef SIGALRM
  1093. #undef SIGCHILD
  1094. #undef SIGCONT
  1095. #undef SIGHUP
  1096. #undef SIGPIPE
  1097. #undef SIGQUIT
  1098. #undef SIGSTOP
  1099. #undef SIGTSTP
  1100. #undef SIGTTIN
  1101. #undef SIGTTOU
  1102. #undef SIGUSR1
  1103. #undef SIGUSR2
  1104. #undef SIG_BLOCK
  1105. #undef SIG_SETMASK
  1106. #undef SIG_UNBLOCK
  1107. #endif
  1108. #if defined(TPF) && defined(NSIG)
  1109. #undef NSIG
  1110. #endif
  1111. #include <errno.h>
  1112. #if !defined(QNX) && !defined(CONVEXOS11) && !defined(NEXT) && !defined(TPF) && !defined(NETWARE) && !defined(MPE)
  1113. #include <memory.h>
  1114. #endif
  1115.  
  1116. #ifdef NEED_PROCESS_H
  1117. #include <process.h>
  1118. #endif
  1119.  
  1120. #if defined(WIN32) || defined(USE_HSREGEX)
  1121. #include "hsregex.h"
  1122. #else
  1123. #include <regex.h>
  1124. #endif
  1125.  
  1126. #ifdef HAVE_SYS_RESOURCE_H
  1127. #include <sys/resource.h>
  1128. #ifdef SUNOS4
  1129. int getrlimit(int, struct rlimit *);
  1130. int setrlimit(int, struct rlimit *);
  1131. #endif
  1132. #endif
  1133. #ifdef USE_MMAP_SCOREBOARD
  1134. #if !defined(OS2) && !defined(WIN32)
  1135. /* This file is not needed for OS/2 */
  1136. #include <sys/mman.h>
  1137. #endif
  1138. #endif
  1139. #if !defined(MAP_ANON) && defined(MAP_ANONYMOUS)
  1140. #define MAP_ANON MAP_ANONYMOUS
  1141. #endif
  1142.  
  1143. #if defined(USE_MMAP_FILES) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
  1144. #undef USE_MMAP_FILES
  1145. #endif
  1146.  
  1147. #if defined(USE_MMAP_SCOREBOARD) && (defined(NO_MMAP) || !defined(HAVE_MMAP))
  1148. #undef USE_MMAP_SCOREBOARD
  1149. #endif
  1150.  
  1151. #if defined(USE_SHMGET_SCOREBOARD) && (defined(NO_SHMGET) || !defined(HAVE_SHMGET))
  1152. #undef USE_SHMGET_SCOREBOARD
  1153. #endif
  1154.  
  1155. #ifndef LOGNAME_MAX
  1156. #define LOGNAME_MAX 25
  1157. #endif
  1158.  
  1159. #ifdef HAVE_UNISTD_H
  1160. #include <unistd.h>
  1161. #endif
  1162.  
  1163. #ifdef ultrix
  1164. #define ULTRIX_BRAIN_DEATH
  1165. #endif
  1166.  
  1167. #ifndef S_ISLNK
  1168. #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
  1169. #endif
  1170.  
  1171. #ifndef INADDR_NONE
  1172. #define INADDR_NONE ((unsigned long) -1)
  1173. #endif
  1174.  
  1175. /*
  1176.  * Replace signal function with sigaction equivalent
  1177.  */
  1178. #ifndef NO_USE_SIGACTION
  1179. typedef void Sigfunc(int);
  1180.  
  1181. #if defined(SIG_IGN) && !defined(SIG_ERR)
  1182. #define SIG_ERR ((Sigfunc *)-1)
  1183. #endif
  1184.  
  1185. /*
  1186.  * For some strange reason, QNX defines signal to signal. Eliminate it.
  1187.  */
  1188. #ifdef signal
  1189. #undef signal
  1190. #endif
  1191. #define signal(s,f)    ap_signal(s,f)
  1192. Sigfunc *signal(int signo, Sigfunc * func);
  1193. #endif
  1194.  
  1195. #include <setjmp.h>
  1196.  
  1197. #if defined(USE_LONGJMP)
  1198. #define ap_longjmp(x, y)        longjmp((x), (y))
  1199. #define ap_setjmp(x)            setjmp(x)
  1200. #ifndef JMP_BUF
  1201. #define JMP_BUF jmp_buf
  1202. #endif
  1203. #else
  1204. #define ap_longjmp(x, y)        siglongjmp((x), (y))
  1205. #define ap_setjmp(x)            sigsetjmp((x), 1)
  1206. #ifndef JMP_BUF
  1207. #define JMP_BUF sigjmp_buf
  1208. #endif
  1209. #endif
  1210.  
  1211. /* Majority of os's want to verify FD_SETSIZE */
  1212. #if !defined(WIN32) && !defined(TPF) && !defined(NETWARE)
  1213. #define CHECK_FD_SETSIZE
  1214. #endif
  1215.  
  1216. #ifdef USE_TPF_SELECT
  1217. #define ap_select(_a, _b, _c, _d, _e)    \
  1218.     tpf_select(_a, _b, _c, _d, _e)
  1219. #elif defined(SELECT_NEEDS_CAST)
  1220. #define ap_select(_a, _b, _c, _d, _e)   \
  1221.     select((_a), (int *)(_b), (int *)(_c), (int *)(_d), (_e))
  1222. #else
  1223. #define ap_select(_a, _b, _c, _d, _e)   \
  1224.     select(_a, _b, _c, _d, _e)
  1225. #endif
  1226.  
  1227. #ifdef USE_TPF_ACCEPT
  1228. #define ap_accept(_fd, _sa, _ln)    tpf_accept(_fd, _sa, _ln)
  1229. #else
  1230. #define ap_accept(_fd, _sa, _ln)    accept(_fd, _sa, _ln)
  1231. #endif
  1232.  
  1233. #ifdef NEED_SIGNAL_INTERRUPT
  1234. #define ap_check_signals()    tpf_process_signals()
  1235. #else
  1236. #define ap_check_signals()
  1237. #endif
  1238.  
  1239. #ifdef ULTRIX_BRAIN_DEATH
  1240. #define ap_fdopen(d,m) fdopen((d), (char *)(m))
  1241. #else
  1242. #define ap_fdopen(d,m) fdopen((d), (m))
  1243. #endif
  1244.  
  1245. #ifndef ap_inet_addr
  1246. #define ap_inet_addr inet_addr
  1247. #endif
  1248.  
  1249. #ifdef NO_OTHER_CHILD
  1250. #define NO_RELIABLE_PIPED_LOGS
  1251. #endif
  1252.  
  1253. /* When the underlying OS doesn't support exec() of scripts which start
  1254.  * with a HASHBANG (#!) followed by interpreter name and args, define this.
  1255.  */
  1256. #ifdef NEED_HASHBANG_EMUL
  1257. extern int ap_execle(const char *filename, const char *arg,...);
  1258. extern int ap_execve(const char *filename, char * const argv[],
  1259.                      char * const envp[]);
  1260. /* ap_execle() is a wrapper function around ap_execve(). */
  1261. #define execle  ap_execle
  1262. #define execve(path,argv,envp)  ap_execve(path,argv,envp)
  1263. #endif
  1264.  
  1265. /* Finding offsets of elements within structures.
  1266.  * Taken from the X code... they've sweated portability of this stuff
  1267.  * so we don't have to.  Sigh...
  1268.  */
  1269.  
  1270. #if defined(CRAY) || (defined(__arm) && !defined(LINUX))
  1271. #ifdef __STDC__
  1272. #define XtOffset(p_type,field) _Offsetof(p_type,field)
  1273. #else
  1274. #ifdef CRAY2
  1275. #define XtOffset(p_type,field) \
  1276.     (sizeof(int)*((unsigned int)&(((p_type)NULL)->field)))
  1277.  
  1278. #else /* !CRAY2 */
  1279.  
  1280. #define XtOffset(p_type,field) ((unsigned int)&(((p_type)NULL)->field))
  1281.  
  1282. #endif /* !CRAY2 */
  1283. #endif /* __STDC__ */
  1284. #else /* ! (CRAY || __arm) */
  1285.  
  1286. #define XtOffset(p_type,field) \
  1287.     ((long) (((char *) (&(((p_type)NULL)->field))) - ((char *) NULL)))
  1288.  
  1289. #endif /* !CRAY */
  1290.  
  1291. #ifdef offsetof
  1292. #define XtOffsetOf(s_type,field) offsetof(s_type,field)
  1293. #else
  1294. #define XtOffsetOf(s_type,field) XtOffset(s_type*,field)
  1295. #endif
  1296.  
  1297. /*
  1298.  * NET_SIZE_T exists because of shortsightedness on the POSIX committee.  BSD
  1299.  * systems used "int *" as the parameter to accept(), getsockname(),
  1300.  * getpeername() et al.  Consequently many unixes took an int * for that
  1301.  * parameter.  The POSIX committee decided that "int" was just too generic and
  1302.  * had to be replaced with size_t almost everywhere.  There's no problem with
  1303.  * that when you're passing by value.  But when you're passing by reference
  1304.  * this creates a gross source incompatibility with existing programs.  On
  1305.  * 32-bit architectures it creates only a warning.  On 64-bit architectures it
  1306.  * creates broken code -- because "int *" is a pointer to a 64-bit quantity and
  1307.  * "size_t *" is frequently a pointer to a 32-bit quantity.
  1308.  *
  1309.  * Some Unixes adopted "size_t *" for the sake of POSIX compliance.  Others
  1310.  * ignored it because it was such a broken interface.  Chaos ensued.  POSIX
  1311.  * finally woke up and decided that it was wrong and created a new type
  1312.  * socklen_t.  The only useful value for socklen_t is int, and that's how
  1313.  * everyone who has a clue implements it.  It is almost always the case that
  1314.  * NET_SIZE_T should be defined to be an int, unless the system being compiled
  1315.  * for was created in the window of POSIX madness.
  1316.  */
  1317. #ifndef NET_SIZE_T
  1318. #define NET_SIZE_T int
  1319. #endif
  1320.  
  1321. /* Linux defines __WCOREDUMP, but doesn't define WCOREDUMP unless __USE_BSD
  1322.  * is in use... we'd prefer to just use WCOREDUMP everywhere.
  1323.  */
  1324. #if defined(__WCOREDUMP) && !defined(WCOREDUMP)
  1325. #define WCOREDUMP __WCOREDUMP
  1326. #endif
  1327.  
  1328. #ifdef SUNOS_LIB_PROTOTYPES
  1329. /* Prototypes needed to get a clean compile with gcc -Wall.
  1330.  * Believe it or not, these do have to be declared, at least on SunOS,
  1331.  * because they aren't mentioned in the relevant system headers.
  1332.  * Sun Quality Software.  Gotta love it.  This section is not 
  1333.  * currently (13Nov97) used.
  1334.  */
  1335.  
  1336. int getopt(int, char **, char *);
  1337.  
  1338. int strcasecmp(const char *, const char *);
  1339. int strncasecmp(const char *, const char *, int);
  1340. int toupper(int);
  1341. int tolower(int);
  1342.  
  1343. int printf(char *,...);
  1344. int fprintf(FILE *, char *,...);
  1345. int fputs(char *, FILE *);
  1346. int fread(char *, int, int, FILE *);
  1347. int fwrite(char *, int, int, FILE *);
  1348. int fgetc(FILE *);
  1349. char *fgets(char *s, int, FILE*);
  1350. int fflush(FILE *);
  1351. int fclose(FILE *);
  1352. int ungetc(int, FILE *);
  1353. int _filbuf(FILE *);    /* !!! */
  1354. int _flsbuf(unsigned char, FILE *);    /* !!! */
  1355. int sscanf(char *, char *,...);
  1356. void setbuf(FILE *, char *);
  1357. void perror(char *);
  1358.  
  1359. time_t time(time_t *);
  1360. int strftime(char *, int, const char *, struct tm *);
  1361.  
  1362. int initgroups(char *, int);
  1363. int wait3(int *, int, void *);    /* Close enough for us... */
  1364. int lstat(const char *, struct stat *);
  1365. int stat(const char *, struct stat *);
  1366. int flock(int, int);
  1367. #ifndef NO_KILLPG
  1368. int killpg(int, int);
  1369. #endif
  1370. int socket(int, int, int);
  1371. int setsockopt(int, int, int, const char *, int);
  1372. int listen(int, int);
  1373. int bind(int, struct sockaddr *, int);
  1374. int connect(int, struct sockaddr *, int);
  1375. int accept(int, struct sockaddr *, int *);
  1376. int shutdown(int, int);
  1377.  
  1378. int getsockname(int s, struct sockaddr *name, int *namelen);
  1379. int getpeername(int s, struct sockaddr *name, int *namelen);
  1380. int gethostname(char *name, int namelen);
  1381. void syslog(int, char *,...);
  1382. char *mktemp(char *);
  1383.  
  1384. int vfprintf(FILE *, const char *, va_list);
  1385.  
  1386. #endif /* SUNOS_LIB_PROTOTYPES */
  1387.  
  1388. /* The assumption is that when the functions are missing,
  1389.  * then there's no matching prototype available either.
  1390.  * Declare what is needed exactly as the replacement routines implement it.
  1391.  */
  1392. #ifdef NEED_STRDUP
  1393. extern char *strdup (const char *str);
  1394. #endif
  1395. #ifdef NEED_STRCASECMP
  1396. extern int strcasecmp (const char *a, const char *b);
  1397. #endif
  1398. #ifdef NEED_STRNCASECMP
  1399. extern int strncasecmp (const char *a, const char *b, int n);
  1400. #endif
  1401. #ifdef NEED_INITGROUPS
  1402. extern int initgroups(const char *name, gid_t basegid);
  1403. #endif
  1404. #ifdef NEED_WAITPID
  1405. extern int waitpid(pid_t pid, int *statusp, int options);
  1406. #endif
  1407. #ifdef NEED_STRERROR
  1408. extern char *strerror (int err);
  1409. #endif
  1410. #ifdef NEED_DIFFTIME
  1411. extern double difftime(time_t time1, time_t time0);
  1412. #endif
  1413.  
  1414. #ifndef ap_wait_t
  1415. #define ap_wait_t int
  1416. #endif
  1417.  
  1418. #ifdef __cplusplus
  1419. }
  1420. #endif
  1421.  
  1422. #endif /* !AP_CONFIG_H */
  1423.