includes.h: Fixes for NetBSD and BSDI.
[samba.git] / source / include / includes.h
1 #ifndef _INCLUDES_H
2 #define _INCLUDES_H
3 /* 
4    Unix SMB/Netbios implementation.
5    Version 1.9.
6    Machine customisation and include handling
7    Copyright (C) Andrew Tridgell 1994-1998
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23 /*
24    This file does all the #includes's. This makes it easier to
25    port to a new unix. Hopefully a port will only have to edit the Makefile
26    and add a section for the new unix below.
27 */
28
29
30 /* the first OS dependent section is to setup what includes will be used.
31    the main OS dependent section comes later on 
32 */
33
34 #ifdef ALTOS
35 #define NO_UTIMEH
36 #endif
37
38 #ifdef MIPS
39 #define POSIX_H
40 #define NO_UTIMEH
41 #endif
42
43 #ifdef sun386
44 #define NO_UTIMEH
45 #endif
46
47 #ifdef NEXT2
48 #define NO_UTIMEH
49 #endif
50
51 #ifdef NEXT3_0
52 #define NO_UTIMEH
53 #define NO_UNISTDH
54 #endif
55
56 #ifdef APOLLO
57 #define NO_UTIMEH
58 #define NO_SYSMOUNTH
59 #define NO_UNISTDH
60 #endif
61
62 #ifdef AIX
63 #define NO_SYSMOUNTH
64 #endif
65
66 #ifdef M88K_R3
67 #define SVR3H
68 #define NO_RESOURCEH
69 #endif
70
71 #ifdef DNIX
72 #define NO_SYSMOUNTH
73 #define NO_NETIFH
74 #define NO_RESOURCEH
75 #define PRIME_NMBD 0
76 #define NO_SETGROUPS
77 #endif
78
79
80 #ifdef ISC
81 #define SYSSTREAMH
82 #define NO_RESOURCEH
83 #endif
84
85 #ifdef QNX
86 #define NO_RESOURCEH
87 #define NO_SYSMOUNTH
88 #define USE_MMAP 1
89 #ifdef __386__
90    #define __i386__
91 #endif
92 #endif
93
94 #ifdef NEWS42
95 #define NO_UTIMEH
96 #define NO_STRFTIME
97 #define NO_UTIMBUF
98 #define REPLACE_MKTIME
99 #define NO_TM_NAME
100 #endif
101
102 #ifdef OS2
103 #define NO_SYSMOUNTH
104 #define NO_NETIFH
105 #endif
106
107 #ifdef LYNX
108 #define NO_SYSMOUNTH
109 #endif
110
111
112 #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
113 #define PASSWORD_LENGTH 16
114 #endif
115
116 /* here is the general includes section - with some ifdefs generated 
117    by the previous section 
118 */
119 #include "local.h"
120 #include <stdio.h>
121 #ifdef POSIX_STDLIBH
122 #include <posix/stdlib.h>
123 #else
124 #include <stdlib.h>
125 #endif
126 #include <ctype.h>
127 #include <time.h>
128 #ifndef NO_UTIMEH
129 #include <utime.h>
130 #endif
131 #include <sys/types.h>
132
133 #ifdef SVR3H
134 #include <sys/statfs.h>
135 #include <sys/stream.h>
136 #include <netinet/types.h>
137 #include <netinet/ether.h>
138 #include <netinet/ip_if.h>
139 #endif
140
141 #include <sys/socket.h>
142 #ifdef AXPROC
143 #include <termio.h>
144 #endif
145 #include <sys/ioctl.h>
146 #include <stddef.h>
147 #ifdef POSIX_H
148 #include <posix/utime.h>
149 #include <bsd/sys/time.h>
150 #include <bsd/netinet/in.h>
151 #else
152 #include <sys/time.h>
153 #include <netinet/in.h>
154 #endif 
155 #include <netdb.h>
156 #include <signal.h>
157 #include <errno.h>
158 #include <sys/file.h>
159 #include <sys/stat.h>
160 #include <sys/param.h>
161 #include <grp.h>
162 #ifndef NO_RESOURCEH
163 #include <sys/resource.h>
164 #endif
165 #ifndef NO_SYSMOUNTH
166 #include <sys/mount.h>
167 #endif
168 #include <pwd.h>
169 #ifdef __STDC__
170 #include <stdarg.h>
171 #else
172 #include <varargs.h>
173 #endif
174 #ifndef NO_UNISTDH
175 #include <unistd.h>
176 #endif
177 #include <sys/wait.h>
178 #ifdef SYSSTREAMH
179 #include <sys/stream.h>
180 #endif
181 #ifndef NO_NETIFH
182 #ifdef POSIX_H
183 #include <bsd/net/if.h>
184 #else
185 #ifdef OSF1
186 #include <net/route.h>
187 #include <sys/mbuf.h>
188 #endif
189 #include <net/if.h>
190 #endif
191 #endif
192
193 #if defined(GETPWANAM)
194 #include <sys/types.h>
195 #include <sys/label.h>
196 #include <sys/audit.h>
197 #include <pwdadj.h>
198 #endif
199
200 #if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX) && !defined(__OpenBSD__)
201 #include <shadow.h>
202 #endif
203
204 #ifdef SYSLOG
205 #include <syslog.h>
206 #endif
207
208 #ifdef HAVE_REGEX_H
209 #include <regex.h>
210 #endif
211
212
213 /***************************************************************************
214 Here come some platform specific sections
215 ***************************************************************************/
216
217
218 #ifdef LINUX
219 #include <arpa/inet.h>
220 #include <dirent.h>
221 #include <string.h>
222 #include <sys/vfs.h>
223 #include <netinet/in.h>
224 #ifdef GLIBC2
225 #define _LINUX_C_LIB_VERSION_MAJOR     6
226 #include <termios.h>
227 #include <rpcsvc/ypclnt.h>
228 #include <crypt.h>
229 #include <netinet/tcp.h>
230 #include <netinet/ip.h>
231 #endif
232 #ifndef QSORT_CAST
233 #define QSORT_CAST (int (*)(const void *, const void *))
234 #endif /* QSORT_CAST */
235 #define SIGNAL_CAST (__sighandler_t)
236 #define USE_GETCWD
237 #define USE_SETSID
238 #define HAVE_BZERO
239 #define HAVE_MEMMOVE
240 #define HAVE_VSNPRINTF
241 #define USE_SIGPROCMASK
242 #define USE_WAITPID
243 #define USE_SYSV_IPC
244 #if 0
245 /* SETFS disabled until we can check on some bug reports */
246 #if _LINUX_C_LIB_VERSION_MAJOR >= 5
247 #define USE_SETFS
248 #endif
249 #endif
250 #ifdef SHADOW_PWD
251 #if _LINUX_C_LIB_VERSION_MAJOR < 5
252 #ifndef crypt
253 #define crypt pw_encrypt
254 #endif
255 #endif
256 #endif
257 #endif
258
259 #ifdef SUNOS4
260 #define SIGNAL_CAST (void (*)(int))
261 #include <netinet/tcp.h>
262 #include <dirent.h>
263 #include <sys/acct.h>
264 #include <sys/vfs.h>
265 #include <string.h>
266 #include <strings.h>
267 #include <errno.h>
268 #include <sys/wait.h>
269 #include <signal.h>
270 /* #include <termios.h> */
271 #ifdef sun386
272 #define NO_STRFTIME
273 #define NO_UTIMBUF
274 #define mktime timelocal
275 typedef unsigned short mode_t;
276 #else
277 #include <utime.h>
278 #define NO_STRERROR
279 #endif
280 #ifndef REPLACE_GETPASS
281 #define REPLACE_GETPASS
282 #endif
283 #ifndef BSD_TERMIO
284 #define BSD_TERMIO
285 #endif
286 #ifndef USE_SIGPROCMASK
287 #define USE_SIGPROCMASK
288 #endif
289 #ifndef USE_WAITPID
290 #define USE_WAITPID
291 #endif
292 #define USE_SYSV_IPC
293 /* SunOS doesn't have POSIX atexit */
294 #define atexit on_exit
295 #define NOSTRCASECMP
296 #endif
297
298
299 #ifdef SUNOS5
300 #include <fcntl.h>
301 #include <dirent.h>
302 #include <sys/acct.h>
303 #include <sys/statfs.h>
304 #include <sys/statvfs.h>
305 #include <sys/filio.h>
306 #include <sys/sockio.h>
307 #include <netinet/in_systm.h>
308 #include <netinet/tcp.h>
309 #include <netinet/ip.h>
310 #include <string.h>
311 #include <arpa/inet.h>
312 #include <rpcsvc/ypclnt.h>
313 #include <termios.h>
314 #include <sys/stropts.h>
315 #if !defined(USE_LIBDES) && !defined(KRB4_AUTH)
316 #include <crypt.h>
317 #endif /* !USE_LIBDES && !KRB4_AUTH */
318 extern int gettimeofday (struct timeval *, void *);
319 extern int gethostname (char *name, int namelen);
320 extern int innetgr (const char *, const char *, const char *, const char *);
321 #define USE_SETVBUF
322 #define SIGNAL_CAST (void (*)(int))
323 #ifndef SYSV
324 #define SYSV
325 #endif
326 #define USE_WAITPID
327 #define REPLACE_STRLEN
328 #define USE_STATVFS
329 #define USE_GETCWD
330 #define USE_SETSID
331 #define USE_SYSV_IPC
332 #define NO_SEMUN
333 #ifndef REPLACE_GETPASS
334 #define REPLACE_GETPASS
335 #endif /* REPLACE_GETPASS */
336 #define USE_SIGPROCMASK
337 #ifndef QSORT_CAST
338 #define QSORT_CAST (int (*)(const void *, const void *))
339 #endif /* QSORT_CAST */
340 #endif
341
342
343 #ifdef ULTRIX
344 #include <strings.h>
345 #include <nfs/nfs_clnt.h>
346 #include <nfs/vfs.h>
347 #include <netinet/tcp.h>
348 #ifdef ULTRIX_AUTH
349 #include <auth.h>
350 #endif
351 char *getwd(char *);
352 #define NOSTRDUP
353 #ifdef __STDC__
354 #define SIGNAL_CAST (void(*)(int))
355 #endif
356 #define USE_DIRECT
357 #define USE_WAITPID
358 #endif
359
360 #ifdef SGI4
361 #include <netinet/tcp.h>
362 #include <sys/statfs.h>
363 #include <string.h>
364 #include <signal.h>
365 #ifndef SYSV
366 #define SYSV
367 #endif
368 #define SIGNAL_CAST (void (*)())
369 #define STATFS4
370 #define USE_WAITPID
371 #define USE_DIRECT
372 #define USE_SETSID
373 #define USE_SYSV_IPC
374 #endif
375
376 #if defined(SGI5) || defined(SGI6)
377 #include <arpa/inet.h>
378 #include <netinet/tcp.h>
379 #include <netinet/in_systm.h>
380 #include <netinet/ip.h>
381 #include <sys/statvfs.h>
382 #include <string.h>
383 #include <signal.h>
384 #include <dirent.h>
385 #define USE_WAITPID
386 #define NETGROUP 
387 #ifndef SYSV
388 #define SYSV
389 #endif
390 #define SIGNAL_CAST (void (*)())
391 #define USE_STATVFS
392 #define USE_WAITPID
393 #define USE_SETSID
394 #define USE_SYSV_IPC
395 #ifndef QSORT_CAST
396 #define QSORT_CAST (int (*)(const void *, const void *))
397 #endif /* QSORT_CAST */
398 #endif
399
400
401 #ifdef MIPS
402 #include <bsd/net/soioctl.h>
403 #include <string.h>
404 #include <dirent.h>
405 #include <fcntl.h>
406 #include <sys/statfs.h>
407 #include <sys/wait.h>
408 #include <sys/termio.h>
409 #define SIGNAL_CAST (void (*)())
410 typedef int mode_t;
411 extern struct group *getgrnam();
412 extern struct passwd *getpwnam();
413 #define STATFS4
414 #define NO_STRERROR
415 #define REPLACE_STRSTR
416 #endif /* MIPS */
417
418
419
420 #ifdef DGUX
421 #include <string.h>
422 #include <dirent.h>
423 #include <sys/statfs.h>
424 #include <sys/statvfs.h>
425 #include <fcntl.h>
426 #include <termios.h>
427 #define SYSV
428 #define USE_WAITPID
429 #define SIGNAL_CAST (void (*)(int))
430 #define STATFS4
431 #define USE_GETCWD
432 #endif
433
434
435 #ifdef SVR4
436 #include <string.h>
437 #include <sys/dir.h>
438 #include <dirent.h>
439 #include <sys/statfs.h>
440 #include <sys/statvfs.h>
441 #include <sys/vfs.h>
442 #include <sys/filio.h>
443 #include <fcntl.h>
444 #include <sys/sockio.h>
445 #include <netinet/tcp.h>
446 #include <stropts.h>
447 #include <termios.h>
448 #define SYSV
449 #define USE_WAITPID
450 #define SIGNAL_CAST (void (*)(int))
451 #define USE_STATVFS
452 #define USE_GETCWD
453 #define USE_SETSID
454 #define USE_SYSV_IPC
455 #define NO_SEMUN
456 #endif
457
458
459 #ifdef OSF1
460 #include <termios.h>
461 #include <strings.h>
462 #include <dirent.h>
463 char *getwd(char *);
464 char *mktemp(char *); /* No standard include */
465 #include <netinet/in.h>
466 #include <arpa/inet.h> /* both for inet_ntoa */
467 #define SIGNAL_CAST ( void (*) (int) )
468 #define STATFS3
469 #define USE_F_FSIZE
470 #define USE_SETSID
471 #include <netinet/tcp.h>
472 #ifdef OSF1_ENH_SEC
473 #include <pwd.h>
474 #include <sys/types.h>
475 #include <sys/security.h>
476 #include <prot.h>
477 #include <unistd.h>
478 #define PASSWORD_LENGTH 16
479 #define NEED_AUTH_PARAMETERS
480 #endif  /* OSF1_ENH_SEC */
481 #define USE_SYSV_IPC
482 #define NO_SEMUN
483 #endif
484
485
486 #ifdef CLIX
487 #include <dirent.h>
488 #define SIGNAL_CAST     (void (*)())
489 #include <sys/fcntl.h>
490 #include <sys/statfs.h>
491 #include <string.h>
492 #define NO_EID
493 #define USE_WAITPID
494 #define STATFS4
495 #define NO_FSYNC
496 #define USE_GETCWD
497 #define USE_SETSID
498 #ifndef REPLACE_GETPASS
499 #define REPLACE_GETPASS
500 #endif /* REPLACE_GETPASS */
501 #define NO_GETRLIMIT
502 #endif  /* CLIX */
503
504
505
506 #ifdef BSDI
507 #include <string.h>
508 #include <netinet/tcp.h>
509 #define SIGNAL_CAST (void (*)())
510 #define USE_DIRECT
511 #define QSORT_CAST (int (*)(const void *, const void *))
512 #endif
513
514
515 #ifdef NETBSD  
516 #ifdef NetBSD1_3  
517 #include <string.h>  
518 #ifdef ALLOW_CHANGE_PASSWORD  
519 #include <termios.h>  
520 #endif /* ALLOW_CHANGE_PASSWORD */  
521 #else /* NetBSD1_3 */
522 #include <strings.h>  
523 #endif /* NetBSD1_3 */  
524 #include <netinet/tcp.h>
525 #include <netinet/in_systm.h>
526 #include <netinet/ip.h>
527 /* you may not need this */
528 #define NO_GETSPNAM 
529 #define SIGNAL_CAST (void (*)())
530 #define USE_DIRECT
531 #define REPLACE_INNETGR
532 #endif
533
534
535 #ifdef FreeBSD
536 #include <arpa/inet.h>
537 #include <strings.h>
538 #include <netinet/tcp.h>
539 #include <netinet/in_systm.h>
540 #include <netinet/ip.h>
541 #include <termios.h>
542 #include <fcntl.h>
543 #if __FreeBSD__ >= 3
544 #include <dirent.h>
545 #else
546 #define USE_DIRECT
547 #endif
548 #define SIGNAL_CAST (void (*)(int))
549 #define USE_SETVBUF
550 #define USE_SETSID
551 #define USE_GETCWD
552 #define USE_WAITPID
553 #define HAVE_MEMMOVE
554 #define HAVE_BZERO
555 #define HAVE_GETTIMEOFDAY
556 #define HAVE_PATHCONF
557 #define HAVE_GETGRNAM 1
558 #define HAVE_VSNPRINTF
559 #define QSORT_CAST (int (*)(const void *, const void *))
560 #if !defined(O_SYNC)
561 #if defined(O_FSYNC)
562 #define O_SYNC O_FSYNC
563 #else /* defined(O_FSYNC) */
564 #define O_SYNC 0
565 #endif /* defined(O_FSYNC) */
566 #endif /* !defined(O_SYNC) */
567 #endif /* FreeBSD */
568
569 #ifdef __OpenBSD__
570 #include <strings.h>
571 #include <netinet/tcp.h>
572 #define NO_GETSPNAM
573 #define SIGNAL_CAST (void (*)())
574 #define USE_DIRECT
575 #define REPLACE_INNETGR
576 #define HAVE_BZERO
577 #define HAVE_PATHCONF
578 #define HAVE_GETGRNAM 1
579 #define HAVE_GETTIMEOFDAY
580 #define HAVE_MEMMOVE
581 #define USE_GETCWD
582 #define USE_SETSID
583 #endif 
584
585 #ifdef AIX
586 #include <strings.h>
587 #include <sys/dir.h>
588 #include <sys/select.h>
589 #include <dirent.h>
590 #include <sys/statfs.h>
591 #include <sys/vfs.h>
592 #include <sys/id.h>
593 #include <sys/priv.h>
594 /* According to AIX 4.1 man pages, inet_ntoa needs the following headers */
595 #include <sys/socket.h>
596 #include <netinet/in.h>
597 #include <arpa/inet.h>
598 #include <netinet/tcp.h>
599 #include <locale.h>
600 #define SYSV
601 #define USE_WAITPID
602 #define USE_SIGBLOCK
603 #define SIGNAL_CAST (void (*)())
604 #define DEFAULT_PRINTING PRINT_AIX
605 /* we undef this because sys/param.h is broken in aix. uggh. */
606 #undef MAXHOSTNAMELEN
607 #endif
608
609
610 #ifdef HPUX
611 #include <string.h>
612 #include <dirent.h>
613 #include <fcntl.h>
614 #include <sys/vfs.h>
615 #include <sys/types.h>
616 #include <sys/termios.h>
617 #include <netinet/tcp.h>
618 #include <arpa/inet.h>                /* needed for inet_ntoa proto */
619 #ifdef HPUX_10_TRUSTED
620 #include <hpsecurity.h>
621 #include <prot.h>
622 #define NEED_AUTH_PARAMETERS
623 #endif
624 #define SIGNAL_CAST (void (*)(__harg))
625 #ifdef HPUX10
626 #include <stropts.h>
627 #else /* HPUX10 */  
628 /* This is only needed for HPUX 9.x */
629 #define SELECT_CAST (int *)
630 #endif /* HPUX10 */
631 #define SYSV
632 #define USE_WAITPID
633 #define WAIT3_CAST2 (int *)
634 #define USE_GETCWD
635 #define USE_SETSID
636 #define USE_SETRES
637 #define USE_SYSV_IPC
638 #define NO_SEMUN
639 #define DEFAULT_PRINTING PRINT_HPUX
640 /* Ken Weiss <krweiss@ucdavis.edu> tells us that SIGCLD_IGNORE is
641    not good for HPUX */
642 /* #define SIGCLD_IGNORE */
643 #define USE_SIGPROCMASK /* Needed to stop zombie processes on HPUX 9.x and 10.x.*/
644 #endif /* HPUX */
645
646
647 #ifdef SEQUENT
648 #include <signal.h>
649 #include <string.h>
650 #include <dirent.h>
651 #include <sys/types.h>
652 #include <sys/statfs.h>
653 #include <sys/stat.h>
654 #include <sys/buf.h>
655 #include <sys/socket.h>
656 #include <unistd.h>
657 #include <fcntl.h>
658 #define SIGNAL_CAST (void (*)(int))
659 #define USE_WAITPID
660 #define USE_GETCWD
661 #define NO_EID
662 #define STATFS4
663 #define USE_DIRECT
664 #ifdef PTX4
665 #undef USE_DIRECT
666 #endif
667 #endif
668
669
670
671 #ifdef SEQUENT_PTX4
672 #include <string.h>
673 #include <sys/dir.h>
674 #include <dirent.h>
675 #include <sys/statfs.h>
676 #include <sys/statvfs.h>
677 #include <sys/vfs.h>
678 #include <fcntl.h>
679 #include <sys/sockio.h>
680 #include <netinet/tcp.h>
681 #include <stropts.h>
682 #include <termios.h>
683 #define SYSV
684 #define USE_WAITPID
685 #define SIGNAL_CAST (void (*)(int))
686 #define USE_STATVFS
687 #define USE_GETCWD
688 #ifndef seteuid
689 #define seteuid(uid) setreuid(-1,uid)
690 #endif
691 #ifndef setegid
692 #define setegid(gid) setregid(-1,gid)
693 #endif
694 #endif
695
696
697 #ifdef NEXT2
698 #include <sys/types.h>
699 #include <strings.h>
700 #include <dirent.h>
701 #include <sys/vfs.h>
702 #define bzero(b,len) memset(b,0,len)
703 #define mode_t int
704 #define NO_UTIMBUF
705 #include <libc.h>
706 #define NOSTRDUP
707 #define USE_DIRECT
708 #define USE_WAITPID
709 #endif 
710
711
712 #ifdef NEXT3_0
713 #include <strings.h>
714 #include <sys/dir.h>
715 #include <sys/vfs.h>
716 #define NO_UTIMBUF
717 #include <libc.h>
718 #define NOSTRDUP
719 #define USE_DIRECT
720 #define mode_t int
721 #define GID_TYPE int
722 #define gid_t int
723 #define pid_t int
724 #define SIGNAL_CAST (void (*)(int))
725 #define WAIT3_CAST1 (union wait *)
726 #define HAVE_GMTOFF
727 #define O_NONBLOCK O_NDELAY
728 #endif
729
730
731
732 #ifdef APOLLO
733 #include <string.h>
734 #include <fcntl.h>
735 #include <sys/statfs.h>
736 #define NO_UTIMBUF
737 #define USE_DIRECT
738 #define USE_GETCWD
739 #define SIGNAL_CAST     (void (*)())
740 #define HAVE_FCNTL_LOCK 0
741 #define HAVE_GETTIMEOFDAY
742 #define STATFS4
743 #endif
744
745
746
747 #ifdef SCO
748 #include <sys/netinet/tcp.h>
749 #include <sys/netinet/in_systm.h>
750 #include <sys/netinet/ip.h>
751 #include <dirent.h>
752 #include <string.h>
753 #include <termios.h>
754 #include <fcntl.h>
755 #include <sys/statfs.h>
756 #include <sys/stropts.h>
757 #include <limits.h>
758 #include <locale.h>
759 #ifdef EVEREST
760 #include <unistd.h> 
761 #endif /* EVEREST */
762 #ifdef NETGROUP
763 #include <rpcsvc/ypclnt.h>
764 #endif /* NETGROUP */
765 #ifdef SecureWare
766 #include <sys/security.h>
767 #include <sys/audit.h>
768 #include <prot.h>
769 #define crypt bigcrypt
770 #endif /* SecureWare */
771 #define SIGNAL_CAST (void (*)(int))
772 #define USE_WAITPID
773 #define USE_GETCWD
774 #define USE_SETSID
775 #ifdef SCO3_2_2
776 #define setuid(u) setreuid(u,-1)
777 #define seteuid(u) setreuid(-1,u)
778 #else /* SCO3_2_2 */
779 #ifndef EVEREST
780 #define ftruncate(f,l) syscall(0x0a28,f,l)
781 #define USE_IFREQ
782 #define NO_INITGROUPS
783 #endif /* EVEREST */
784 #endif /* SCO3_2_2 */
785 #define STATFS4
786 #define NO_FSYNC
787 #define HAVE_PATHCONF
788 #define NO_GETRLIMIT
789 #endif /* SCO */
790
791
792
793 /* Definitions for RiscIX */
794 #ifdef RiscIX
795 #define SIGNAL_CAST (void (*)(int))
796 #include <sys/dirent.h>
797 #include <sys/acct.h>
798 #include <sys/vfs.h>
799 #include <string.h>
800 #include <utime.h>
801 #include <signal.h>
802 #define HAVE_GETTIMEOFDAY
803 #define NOSTRCASECMP
804 #define NOSTRDUP
805 #endif
806
807
808
809 #ifdef ISC
810 #include <net/errno.h>
811 #include <string.h>
812 #include <sys/dir.h>
813 #include <dirent.h>
814 #include <sys/statfs.h>
815 #include <fcntl.h>
816 #include <sys/sioctl.h>
817 #include <stropts.h>
818 #include <limits.h>
819 #include <netinet/tcp.h>
820 #define FIONREAD FIORDCHK
821 #define SYSV
822 #define USE_WAITPID
823 #define SIGNAL_CAST (void (*)(int))
824 #define USE_GETCWD
825 #define USE_SETSID
826 #define USE_IFREQ
827 #define NO_FTRUNCATE
828 #define STATFS4
829 #define NO_FSYNC
830 #endif
831
832
833
834 #ifdef AUX
835 #include <fstab.h>
836 #include <string.h>
837 #include <dirent.h>
838 #include <sys/vfs.h>
839 #include <fcntl.h>
840 #include <termios.h>
841 #define SYSV
842 #define USE_WAITPID
843 #define SIGNAL_CAST (void (*)(int))
844 char *strdup (char *);
845 #define USE_GETCWD
846 #endif
847
848
849 #ifdef M88K_R3
850 #include <string.h>
851 #include <dirent.h>
852 #include <fcntl.h>
853 #include <termios.h>
854 #define STATFS4
855 #define SYSV
856 #define USE_WAITPID
857 #define SIGNAL_CAST (void (*)(int))
858 char *strdup (char *);
859 #define USE_GETCWD
860 #define NO_FSYNC
861 #define NO_EID
862 #endif
863
864
865 #ifdef DNIX
866 #include <dirent.h>
867 #include <string.h>
868 #include <fcntl.h>
869 #include <sys/statfs.h>
870 #include <sys/stropts.h>
871 #define NO_GET_BROADCAST
872 #define USE_WAITPID
873 #define USE_GETCWD
874 #define USE_SETSID
875 #define STATFS4
876 #define NO_EID
877 #define PF_INET AF_INET
878 #define NO_STRERROR
879 #define ftruncate(f,l) chsize(f,l)
880 #endif /* DNIX */
881
882 #ifdef CONVEX
883 #include <netinet/tcp.h>
884 #include <arpa/inet.h>
885 #include <dirent.h>
886 #include <string.h>
887 #include <sys/vfs.h>
888 #include <fcntl.h>
889 #define DONT_REINSTALL_SIG
890 #define USE_SIGBLOCK
891 #define USE_WAITPID
892 #define SIGNAL_CAST (_SigFunc_Ptr_t)
893 #define NO_GETSPNAM
894 #define HAVE_MEMMOVE
895 extern char *mktemp(char *);
896 extern int  fsync(int);
897 extern int  seteuid(uid_t);
898 extern int  setgroups(int, int *);
899 extern int  initgroups(char *, int);
900 extern int  statfs(char *, struct statfs *);
901 extern int  setegid(gid_t);
902 extern int  getopt(int, char *const *, const char *);
903 extern int  chroot(char *);
904 extern int  gettimeofday(struct timeval *, struct timezone *);
905 extern int  gethostname(char *, int);
906 extern char *crypt(char *, char *);
907 extern char *getpass(char *);
908 #endif
909
910
911 #ifdef CRAY
912 #define MAXPATHLEN 1024
913 #include <dirent.h>
914 #include <string.h>
915 #include <fcntl.h>
916 #include <sys/statfs.h>
917 #define SIGNAL_CAST (void (*)(int))
918 #define SIGCLD_IGNORE
919 #define HAVE_FCNTL_LOCK 1
920 #define USE_SETSID
921 #define STATFS4
922 #endif
923
924
925 #ifdef ALTOS
926 #include <unistd.h>
927 #include <string.h>
928 #include <dirent.h>
929 #include <sys/fcntl.h>
930 #include <sys/statfs.h>
931 #define        const
932 #define        uid_t           int
933 #define        gid_t           int
934 #define        mode_t          int
935 #define        ptrdiff_t       int
936 #define HAVE_GETGRNAM  0
937 #define NO_EID
938 #define NO_FSYNC
939 #define        NO_FTRUNCATE
940 #define        NO_GETRLIMIT
941 #define        NO_INITGROUPS
942 #define NO_SELECT
943 #define NO_SETGROUPS
944 #define NO_STRERROR
945 #define NO_STRFTIME
946 #define        NO_TM_NAME
947 #define NO_UTIMEH
948 #define NOSTRCASECMP
949 #define REPLACE_MKTIME
950 #define REPLACE_RENAME
951 #define REPLACE_STRSTR
952 #define STATFS4
953 #define        USE_GETCWD
954 #endif
955
956 #ifdef QNX
957 #define STATFS4
958 #include <sys/statfs.h>
959 #include <sys/select.h>
960 #include <signal.h>
961 #include <sys/dir.h>
962 #define SIGNAL_CAST (void (*)())
963 #define USE_WAITPID
964 #define NO_INITGROUPS
965 #define NO_SETGROUPS
966 #define HAVE_TIMEZONE
967 #define USE_GETCWD
968 #define USE_SETSID
969 #define HAVE_FCNTL_LOCK 1
970 #define DEFAULT_PRINTING PRINT_QNX
971 #endif
972
973
974 #ifdef NEWS42
975 #include <string.h>
976 #include <dirent.h>
977 #include <sys/vfs.h>
978 #include <sys/timeb.h>
979 typedef int mode_t;
980 #endif
981
982 #ifdef OS2
983 #include <dirent.h>
984 #include <sys/statfs.h>
985 #include <string.h>
986 #include <limits.h>
987 #define SIGNAL_CAST (void (*)())
988 #define HAVE_FCNTL_LOCK 0
989 #define USE_WAITPID
990 #define NO_GET_BROADCAST
991 #define NO_EID
992 #define NO_SETGROUPS
993 #define NO_INITGROUPS
994 #define NO_CRYPT
995 #define NO_STATFS
996 #define NO_CHROOT
997 #define NO_CHOWN
998 #define strcasecmp stricmp
999 #define strncasecmp strnicmp
1000 #endif
1001
1002
1003 #ifdef LYNX
1004 #define SIGNAL_CAST (void (*)())
1005 #define WAIT3_CAST1 (union wait *)
1006 #define STATFS4
1007 #include <fcntl.h>
1008 #include <resource.h>
1009 #include <stat.h>
1010 #include <string.h>
1011 #include <dirent.h>
1012 #include <sys/statfs.h>
1013 #define USE_GETCWD
1014 #define USE_GETSID
1015 #endif
1016
1017
1018 #ifdef BOS
1019 #define SIGNAL_CAST (void (*)(int))
1020 #include <string.h>
1021 #include <sys/dir.h>
1022 #include <sys/select.h>
1023 #include <dirent.h>
1024 #include <fcntl.h>
1025 #include <signal.h>
1026 #include <sys/statfs.h>
1027 #include <sys/bsdioctl.h>
1028 #endif
1029
1030 #ifdef AMIGA
1031 #include <arpa/inet.h>
1032 #include <dirent.h>
1033 #include <string.h>
1034 #include <netinet/tcp.h>
1035 #include <sys/acct.h>
1036 #include <sys/fcntl.h>
1037 #include <sys/filio.h>
1038 #include <sys/sockio.h>
1039 #include <netinet/in_systm.h>
1040 #include <netinet/ip.h>
1041 #include <sys/termios.h>
1042 #include <limits.h>
1043 #include <sys/timeb.h>
1044
1045 #define SIGNAL_CAST (void (*)(int))
1046 #define USE_GETCWD
1047 #define HAVE_BZERO
1048 #define HAVE_MEMMOVE
1049 #define USE_SIGPROCMASK
1050 #define USE_WAITPID
1051 #define USE_DIRECT
1052 #define USE_F_FSIZE
1053 #define HAVE_FCNTL_LOCK 0
1054 #define HAVE_GETTIMEOFDAY
1055 #define HAVE_PATHCONF
1056
1057 #define HAVE_NO_PROC
1058 #define NO_FORK_DEBUG
1059 #define HAVE_FORK 0
1060 #define HAVE_VFORK 1
1061 #endif
1062
1063 /* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
1064 #ifdef IA_UINFO
1065 #include <iaf.h>
1066 #include <ia.h>
1067 #endif
1068
1069
1070 /*******************************************************************
1071 end of the platform specific sections
1072 ********************************************************************/
1073
1074 #if (!defined(USE_LDAP_DB) && !defined(USE_NISPLUS_DB))
1075 #define USE_SMBPASS_DB
1076 #endif
1077
1078 #if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
1079 #include <sys/mman.h>
1080 #endif
1081
1082 #ifdef SecureWare
1083 #define NEED_AUTH_PARAMETERS
1084 #endif
1085
1086 #ifdef REPLACE_GETPASS
1087 extern char    *getsmbpass(char *);
1088 #define getpass(s) getsmbpass(s)
1089 #endif
1090
1091 #ifdef REPLACE_INNETGR
1092 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
1093 #endif
1094
1095 #ifndef FD_SETSIZE
1096 #define FD_SETSIZE 255
1097 #endif
1098
1099 #ifndef __STDC__
1100 #define const
1101 #endif
1102
1103 /* Now for some other grungy stuff */
1104 #ifdef NO_GETSPNAM
1105 struct spwd { /* fake shadow password structure */
1106        char *sp_pwdp;
1107 };
1108 #endif
1109
1110 #ifndef HAVE_BZERO
1111 #ifndef bzero
1112 #define bzero(p,s) memset(p,0,s)
1113 #endif
1114 #endif
1115
1116 #ifndef HAVE_MEMMOVE
1117 #ifndef memmove
1118 #define memmove(d,s,n) MemMove(d,s,n)
1119 #endif
1120 #endif
1121
1122 #ifdef USE_DIRECT
1123 #include <sys/dir.h>
1124 #endif
1125
1126 /* some unixes have ENOTTY instead of TIOCNOTTY */
1127 #ifndef TIOCNOTTY
1128 #ifdef ENOTTY
1129 #define TIOCNOTTY ENOTTY
1130 #endif
1131 #endif
1132
1133 #ifndef SIGHUP
1134 #define SIGHUP 1
1135 #endif
1136
1137 /* if undefined then use bsd or sysv printing */
1138 #ifndef DEFAULT_PRINTING
1139 #ifdef SYSV
1140 #define DEFAULT_PRINTING PRINT_SYSV
1141 #else
1142 #define DEFAULT_PRINTING PRINT_BSD
1143 #endif
1144 #endif
1145
1146 /* This defines the name of the printcap file. It is MOST UNLIKELY that
1147    this will change BUT! Specifying a file with the format of a printcap
1148    file but containing only a subset of the printers actually in your real 
1149    printcap file is a quick-n-dirty way to allow dynamic access to a subset
1150    of available printers.
1151 */
1152 #ifndef PRINTCAP_NAME
1153 #ifdef AIX
1154 #define PRINTCAP_NAME "/etc/qconfig"
1155 #elif defined(SYSV)
1156 #define PRINTCAP_NAME "lpstat"
1157 #else
1158 #define PRINTCAP_NAME "/etc/printcap"
1159 #endif
1160 #endif
1161
1162
1163 #ifdef USE_SYSV_IPC
1164 #include <sys/ipc.h>
1165 #include <sys/sem.h>
1166 #include <sys/shm.h>
1167 #ifdef NO_SEMUN
1168 union semun {
1169         int val;
1170         struct semid_ds *buf;
1171         unsigned short *array;
1172 };
1173 #endif
1174 #if defined(HPUX) && defined(HPUX10)
1175 #ifdef SEMMSL
1176 #undef SEMMSL
1177 #endif /* SEMMSL */
1178 #endif /* HPUX && HPUX10 */
1179 #endif
1180
1181 #ifdef AFS_AUTH
1182 #include <afs/stds.h>
1183 #include <afs/kautils.h>
1184 #endif
1185
1186 #ifdef DFS_AUTH
1187 #include <dce/dce_error.h>
1188 #include <dce/sec_login.h>
1189 #endif
1190
1191 #ifdef KRB5_AUTH
1192 #include <krb5.h>
1193 #endif
1194
1195 #ifdef KRB4_AUTH
1196 #include <krb.h>
1197 #endif
1198
1199 #ifdef NO_UTIMBUF
1200 struct utimbuf {
1201   time_t actime;
1202   time_t modtime;
1203 };
1204 #endif
1205
1206 #ifdef NO_STRERROR
1207 #ifndef strerror
1208 extern char *sys_errlist[];
1209 #define strerror(i) sys_errlist[i]
1210 #endif
1211 #endif
1212
1213 #ifndef perror
1214 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1215 #endif
1216
1217 #ifndef MAXHOSTNAMELEN
1218 #define MAXHOSTNAMELEN 255
1219 #endif
1220
1221 #include "version.h"
1222 #include "smb.h"
1223 #include "nameserv.h"
1224
1225 #include "byteorder.h"
1226
1227 #include "kanji.h"
1228 #include "charset.h"
1229
1230 #ifndef MAXCODEPAGELINES
1231 #define MAXCODEPAGELINES 256
1232 #endif
1233
1234 /***** automatically generated prototypes *****/
1235 #include "proto.h"
1236
1237
1238
1239 #ifndef S_IFREG
1240 #define S_IFREG 0100000
1241 #endif
1242
1243 #ifndef S_ISREG
1244 #define S_ISREG(x) ((S_IFREG & (x))!=0)
1245 #endif
1246
1247 #ifndef S_ISDIR
1248 #define S_ISDIR(x) ((S_IFDIR & (x))!=0)
1249 #endif
1250
1251 #if !defined(S_ISLNK) && defined(S_IFLNK)
1252 #define S_ISLNK(x) ((S_IFLNK & (x))!=0)
1253 #endif
1254
1255 #ifdef UFC_CRYPT
1256 #define crypt ufc_crypt
1257 #endif
1258
1259 #ifdef REPLACE_STRLEN
1260 #define strlen(s) Strlen(s)
1261 #endif
1262
1263 #ifdef REPLACE_STRSTR
1264 #define strstr(s,p) Strstr(s,p)
1265 #endif
1266
1267 #ifdef REPLACE_MKTIME
1268 #define mktime(t) Mktime(t)
1269 #endif
1270
1271 #ifndef NGROUPS_MAX
1272 #define NGROUPS_MAX 128
1273 #endif
1274
1275 #ifndef EDQUOT
1276 #define EDQUOT ENOSPC
1277 #endif
1278
1279 #ifndef HAVE_GETGRNAM
1280 #define HAVE_GETGRNAM 1
1281 #endif
1282
1283 #ifndef SOL_TCP
1284 #define SOL_TCP 6
1285 #endif
1286
1287 /* default to using ftruncate workaround as this is safer than assuming
1288 it works and getting lots of bug reports */
1289 #ifndef FTRUNCATE_CAN_EXTEND
1290 #define FTRUNCATE_CAN_EXTEND 0
1291 #endif
1292
1293 /* maybe this unix doesn't separate RD and WR locks? */
1294 #ifndef F_RDLCK
1295 #define F_RDLCK F_WRLCK
1296 #endif
1297
1298 #ifndef ENOTSOCK
1299 #define ENOTSOCK EINVAL
1300 #endif
1301
1302 #ifndef SIGCLD
1303 #define SIGCLD SIGCHLD
1304 #endif 
1305
1306 #ifndef MAP_FILE
1307 #define MAP_FILE 0
1308 #endif
1309
1310 #ifndef HAVE_FCNTL_LOCK
1311 #define HAVE_FCNTL_LOCK 1
1312 #endif
1313
1314 #ifndef WAIT3_CAST2
1315 #define WAIT3_CAST2 (struct rusage *)
1316 #endif
1317
1318 #ifndef WAIT3_CAST1
1319 #define WAIT3_CAST1 (int *)
1320 #endif
1321
1322 #ifndef QSORT_CAST
1323 #define QSORT_CAST (int (*)())
1324 #endif
1325
1326 #ifndef INADDR_LOOPBACK
1327 #define INADDR_LOOPBACK 0x7f000001
1328 #endif /* INADDR_LOOPBACK */
1329
1330 /* this is a rough check to see if this machine has a lstat() call.
1331    it is not guaranteed to work */
1332 #if !defined(S_ISLNK)
1333 #define lstat stat
1334 #endif
1335
1336 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1337 #ifndef errno
1338 extern int errno;
1339 #endif 
1340
1341
1342 #ifdef NO_EID
1343 #define geteuid() getuid()
1344 #define getegid() getgid()
1345 #define seteuid(x) setuid(x)
1346 #define setegid(x) setgid(x)
1347 #endif
1348
1349
1350 #if (HAVE_FCNTL_LOCK == 0)
1351 /* since there is no locking available, system includes  */
1352 /* for DomainOS 10.4 do not contain any of the following */
1353 /* #define's. So, to satisfy the compiler, add these     */
1354 /* #define's, although they arn't really necessary.      */
1355 #define F_GETLK 0
1356 #define F_SETLK 0
1357 #define F_WRLCK 0
1358 #define F_UNLCK 0
1359 #endif /* HAVE_FCNTL_LOCK == 0 */
1360
1361 #ifdef NOSTRCASECMP
1362 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1363 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1364 #endif
1365
1366 #ifdef strcpy
1367 #undef strcpy
1368 #endif /* strcpy */
1369 #define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
1370
1371 #ifdef strcat
1372 #undef strcat
1373 #endif /* strcat */
1374 #define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
1375
1376 #ifdef sprintf
1377 #undef sprintf
1378 #endif /* sprintf */
1379 #define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
1380
1381 #define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
1382 #define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
1383 #define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
1384 #define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
1385
1386 #if MEM_MAN
1387 #include "mem_man/mem_man.h"
1388 #endif /* MEM_MAN */
1389
1390
1391 /* -------------------------------------------------------------------------- **
1392  * Lists, trees, and caching...
1393  */
1394 #include "ubiqx/ubi_sLinkList.h"
1395 #include "ubiqx/ubi_dLinkList.h"
1396
1397 #ifndef UBI_BINTREE_H
1398 #include "ubiqx/ubi_SplayTree.h"
1399 #include "ubiqx/ubi_Cache.h"
1400 #endif /* UBI_BINTREE_H */
1401
1402 #endif /* _INCLUDES_H */