home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1999 April / PCO0499.ISO / filesbbs / os2 / apach134.arj / APACH134.ZIP / src / include / ap_config.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-01  |  33.1 KB  |  1,286 lines

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