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