Makefile: Added krb5 option from Nathan Neulinger <nneul@umr.edu>
[kai/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-1997
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 #include <net/if.h>
186 #endif
187 #endif
188
189 #if defined(GETPWANAM)
190 #include <sys/types.h>
191 #include <sys/label.h>
192 #include <sys/audit.h>
193 #include <pwdadj.h>
194 #endif
195
196 #if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX)
197 #include <shadow.h>
198 #endif
199
200 #ifdef SYSLOG
201 #include <syslog.h>
202 #endif
203
204
205
206 /***************************************************************************
207 Here come some platform specific sections
208 ***************************************************************************/
209
210
211 #ifdef LINUX
212 #include <arpa/inet.h>
213 #include <dirent.h>
214 #include <string.h>
215 #include <sys/vfs.h>
216 #include <netinet/in.h>
217 #ifndef NO_ASMSIGNALH
218 #include <asm/signal.h>
219 #endif
220 #define SIGNAL_CAST (__sighandler_t)
221 #define USE_GETCWD
222 #define USE_SETSID
223 #define HAVE_BZERO
224 #define HAVE_MEMMOVE
225 #define USE_SIGPROCMASK
226 #define USE_WAITPID
227 #if 0
228 /* SETFS disabled until we can check on some bug reports */
229 #if _LINUX_C_LIB_VERSION_MAJOR >= 5
230 #define USE_SETFS
231 #endif
232 #endif
233 #ifdef SHADOW_PWD
234 #if _LINUX_C_LIB_VERSION_MAJOR < 5
235 #ifndef crypt
236 #define crypt pw_encrypt
237 #endif
238 #endif
239 #endif
240 #endif
241
242 #ifdef SUNOS4
243 #define SIGNAL_CAST (void (*)(int))
244 #include <netinet/tcp.h>
245 #include <dirent.h>
246 #include <sys/acct.h>
247 #include <sys/vfs.h>
248 #include <string.h>
249 #include <errno.h>
250 #include <sys/wait.h>
251 #include <signal.h>
252 /* #include <termios.h> */
253 #ifdef sun386
254 #define NO_STRFTIME
255 #define NO_UTIMBUF
256 #define mktime timelocal
257 typedef unsigned short mode_t;
258 #else
259 #include <utime.h>
260 #define NO_STRERROR
261 #endif
262 #ifndef REPLACE_GETPASS
263 #define REPLACE_GETPASS
264 #endif
265 #ifndef BSD_TERMIO
266 #define BSD_TERMIO
267 #endif
268 #ifndef USE_SIGPROCMASK
269 #define USE_SIGPROCMASK
270 #endif
271 #ifndef USE_WAITPID
272 #define USE_WAITPID
273 #endif
274 /* SunOS doesn't have POSIX atexit */
275 #define atexit on_exit
276 #endif
277
278
279 #ifdef SUNOS5
280 #include <fcntl.h>
281 #include <dirent.h>
282 #include <sys/acct.h>
283 #include <sys/statfs.h>
284 #include <sys/statvfs.h>
285 #include <sys/filio.h>
286 #include <sys/sockio.h>
287 #include <netinet/in_systm.h>
288 #include <netinet/tcp.h>
289 #include <netinet/ip.h>
290 #include <string.h>
291 #include <arpa/inet.h>
292 #include <rpcsvc/ypclnt.h>
293 #include <termios.h>
294 #include <sys/stropts.h>
295 #ifndef USE_LIBDES
296 #include <crypt.h>
297 #endif /* USE_LIBDES */
298 extern int gettimeofday (struct timeval *, void *);
299 extern int gethostname (char *name, int namelen);
300 extern int innetgr (const char *, const char *, const char *, const char *);
301 #define USE_SETVBUF
302 #define SIGNAL_CAST (void (*)(int))
303 #ifndef SYSV
304 #define SYSV
305 #endif
306 #define USE_WAITPID
307 #define REPLACE_STRLEN
308 #define USE_STATVFS
309 #define USE_GETCWD
310 #define USE_SETSID
311 #define REPLACE_GETPASS
312 #define USE_SIGPROCMASK
313 #endif
314
315
316 #ifdef ULTRIX
317 #include <strings.h>
318 #include <nfs/nfs_clnt.h>
319 #include <nfs/vfs.h>
320 #include <netinet/tcp.h>
321 #ifdef ULTRIX_AUTH
322 #include <auth.h>
323 #endif
324 char *getwd(char *);
325 #define NOSTRDUP
326 #ifdef __STDC__
327 #define SIGNAL_CAST (void(*)(int))
328 #endif
329 #define USE_DIRECT
330 #define USE_WAITPID
331 #endif
332
333 #ifdef SGI
334 #include <netinet/tcp.h>
335 #include <sys/statfs.h>
336 #include <string.h>
337 #include <signal.h>
338 #ifndef SYSV
339 #define SYSV
340 #endif
341 #define SIGNAL_CAST (void (*)())
342 #define STATFS4
343 #define USE_WAITPID
344 #define USE_DIRECT
345 #define USE_SETSID
346 #endif
347
348 #ifdef SGI5
349 #include <arpa/inet.h>
350 #include <netinet/tcp.h>
351 #include <netinet/in_systm.h>
352 #include <netinet/ip.h>
353 #include <sys/statvfs.h>
354 #include <string.h>
355 #include <signal.h>
356 #include <dirent.h>
357 #define USE_WAITPID
358 #define NETGROUP 
359 #ifndef SYSV
360 #define SYSV
361 #endif
362 #define SIGNAL_CAST (void (*)())
363 #define USE_STATVFS
364 #define USE_WAITPID
365 #define USE_SETSID
366 #endif
367
368
369 #ifdef MIPS
370 #include <bsd/net/soioctl.h>
371 #include <string.h>
372 #include <dirent.h>
373 #include <fcntl.h>
374 #include <sys/statfs.h>
375 #include <sys/wait.h>
376 #include <sys/termio.h>
377 #define SIGNAL_CAST (void (*)())
378 typedef int mode_t;
379 extern struct group *getgrnam();
380 extern struct passwd *getpwnam();
381 #define STATFS4
382 #define NO_STRERROR
383 #define REPLACE_STRSTR
384 #endif /* MIPS */
385
386
387
388 #ifdef DGUX
389 #include <string.h>
390 #include <dirent.h>
391 #include <sys/statfs.h>
392 #include <sys/statvfs.h>
393 #include <fcntl.h>
394 #include <termios.h>
395 #define SYSV
396 #define USE_WAITPID
397 #define SIGNAL_CAST (void (*)(int))
398 #define STATFS4
399 #define USE_GETCWD
400 #endif
401
402
403 #ifdef SVR4
404 #include <string.h>
405 #include <sys/dir.h>
406 #include <dirent.h>
407 #include <sys/statfs.h>
408 #include <sys/statvfs.h>
409 #include <sys/vfs.h>
410 #include <sys/filio.h>
411 #include <fcntl.h>
412 #include <sys/sockio.h>
413 #include <netinet/tcp.h>
414 #include <stropts.h>
415 #include <termios.h>
416 #define SYSV
417 #define USE_WAITPID
418 #define SIGNAL_CAST (void (*)(int))
419 #define USE_STATVFS
420 #define USE_GETCWD
421 #define USE_SETSID
422 #endif
423
424
425 #ifdef OSF1
426 #include <termios.h>
427 #include <strings.h>
428 #include <dirent.h>
429 char *getwd(char *);
430 char *mktemp(char *); /* No standard include */
431 #include <netinet/in.h>
432 #include <arpa/inet.h> /* both for inet_ntoa */
433 #define SIGNAL_CAST ( void (*) (int) )
434 #define STATFS3
435 #define USE_F_FSIZE
436 #define USE_SETSID
437 #include <netinet/tcp.h>
438 #ifdef OSF1_ENH_SEC
439 #include <pwd.h>
440 #include <sys/types.h>
441 #include <sys/security.h>
442 #include <prot.h>
443 #include <unistd.h>
444 #define PASSWORD_LENGTH 16
445 #define NEED_AUTH_PARAMETERS
446 #endif  /* OSF1_ENH_SEC */
447 #endif
448
449
450 #ifdef CLIX
451 #include <dirent.h>
452 #define SIGNAL_CAST     (void (*)())
453 #include <sys/fcntl.h>
454 #include <sys/statfs.h>
455 #include <string.h>
456 #define NO_EID
457 #define USE_WAITPID
458 #define STATFS4
459 #define NO_FSYNC
460 #define USE_GETCWD
461 #define USE_SETSID
462 #define REPLACE_GETPASS
463 #define NO_GETRLIMIT
464 #endif  /* CLIX */
465
466
467
468 #ifdef BSDI
469 #include <string.h>
470 #include <netinet/tcp.h>
471 #define SIGNAL_CAST (void (*)())
472 #define USE_DIRECT
473 #endif
474
475
476 #ifdef NETBSD
477 #include <strings.h>
478 #include <netinet/tcp.h>
479 /* you may not need this */
480 #define NO_GETSPNAM
481 #define SIGNAL_CAST (void (*)())
482 #define USE_DIRECT
483 #define REPLACE_INNETGR
484 #endif 
485
486
487
488 #ifdef FreeBSD
489 #include <arpa/inet.h>
490 #include <strings.h>
491 #include <netinet/tcp.h>
492 #include <netinet/in_systm.h>
493 #include <netinet/ip.h>
494 #define SIGNAL_CAST (void (*)())
495 #define USE_SETVBUF
496 #define USE_SETSID
497 #define USE_GETCWD
498 #define USE_WAITPID
499 #define USE_DIRECT
500 #define HAVE_MEMMOVE
501 #define HAVE_BZERO
502 #define HAVE_GETTIMEOFDAY
503 #define HAVE_PATHCONF
504 #define HAVE_GETGRNAM 1
505 #endif 
506
507
508
509 #ifdef AIX
510 #include <strings.h>
511 #include <sys/dir.h>
512 #include <sys/select.h>
513 #include <dirent.h>
514 #include <sys/statfs.h>
515 #include <sys/vfs.h>
516 #include <sys/id.h>
517 #include <sys/priv.h>
518 #include <netinet/tcp.h>
519 #include <locale.h>
520 #define SYSV
521 #define USE_WAITPID
522 #define USE_SIGBLOCK
523 #define SIGNAL_CAST (void (*)())
524 #define DEFAULT_PRINTING PRINT_AIX
525 /* we undef this because sys/param.h is broken in aix. uggh. */
526 #undef MAXHOSTNAMELEN
527 #endif
528
529
530 #ifdef HPUX
531 #include <string.h>
532 #include <dirent.h>
533 #include <fcntl.h>
534 #include <sys/vfs.h>
535 #include <sys/types.h>
536 #include <sys/termios.h>
537 #include <netinet/tcp.h>
538 #ifdef HPUX_10_TRUSTED
539 #include <hpsecurity.h>
540 #include <prot.h>
541 #define NEED_AUTH_PARAMETERS
542 #endif
543 #define SIGNAL_CAST (void (*)(__harg))
544 #define SELECT_CAST (int *)
545 #define SYSV
546 #define USE_WAITPID
547 #define WAIT3_CAST2 (int *)
548 #define USE_GETCWD
549 #define USE_SETSID
550 #define USE_SETRES
551 #define DEFAULT_PRINTING PRINT_HPUX
552 #define SIGCLD_IGNORE
553 #endif
554
555
556 #ifdef SEQUENT
557 #include <signal.h>
558 #include <string.h>
559 #include <dirent.h>
560 #include <sys/types.h>
561 #include <sys/statfs.h>
562 #include <sys/stat.h>
563 #include <sys/buf.h>
564 #include <sys/socket.h>
565 #include <unistd.h>
566 #include <fcntl.h>
567 #define SIGNAL_CAST (void (*)(int))
568 #define USE_WAITPID
569 #define USE_GETCWD
570 #define NO_EID
571 #define STATFS4
572 #define USE_DIRECT
573 #ifdef PTX4
574 #undef USE_DIRECT
575 #endif
576 #endif
577
578
579
580 #ifdef SEQUENT_PTX4
581 #include <string.h>
582 #include <sys/dir.h>
583 #include <dirent.h>
584 #include <sys/statfs.h>
585 #include <sys/statvfs.h>
586 #include <sys/vfs.h>
587 #include <fcntl.h>
588 #include <sys/sockio.h>
589 #include <netinet/tcp.h>
590 #include <stropts.h>
591 #include <termios.h>
592 #define SYSV
593 #define USE_WAITPID
594 #define SIGNAL_CAST (void (*)(int))
595 #define USE_STATVFS
596 #define USE_GETCWD
597 #ifndef seteuid
598 #define seteuid(uid) setreuid(-1,uid)
599 #endif
600 #ifndef setegid
601 #define setegid(gid) setregid(-1,gid)
602 #endif
603 #endif
604
605
606 #ifdef NEXT2
607 #include <sys/types.h>
608 #include <strings.h>
609 #include <dirent.h>
610 #include <sys/vfs.h>
611 #define bzero(b,len) memset(b,0,len)
612 #define mode_t int
613 #define NO_UTIMBUF
614 #include <libc.h>
615 #define NOSTRDUP
616 #define USE_DIRECT
617 #define USE_WAITPID
618 #endif 
619
620
621 #ifdef NEXT3_0
622 #include <strings.h>
623 #include <sys/dir.h>
624 #include <sys/vfs.h>
625 #define bzero(b,len) memset(b,0,len)
626 #define NO_UTIMBUF
627 #include <libc.h>
628 #define NOSTRDUP
629 #define USE_DIRECT
630 #define mode_t int
631 #define GID_TYPE int
632 #define gid_t int
633 #define pid_t int
634 #define SIGNAL_CAST (void (*)(int))
635 #define WAIT3_CAST1 (union wait *)
636 #define HAVE_GMTOFF
637 #endif
638
639
640
641 #ifdef APOLLO
642 #include <string.h>
643 #include <fcntl.h>
644 #include <sys/statfs.h>
645 #define NO_UTIMBUF
646 #define USE_DIRECT
647 #define USE_GETCWD
648 #define SIGNAL_CAST     (void (*)())
649 #define HAVE_FCNTL_LOCK 0
650 #define HAVE_GETTIMEOFDAY
651 #define STATFS4
652 #endif
653
654
655
656 #ifdef SCO
657 #include <sys/netinet/tcp.h>
658 #include <sys/netinet/in_systm.h>
659 #include <sys/netinet/ip.h>
660 #include <dirent.h>
661 #include <string.h>
662 #include <fcntl.h>
663 #include <sys/statfs.h>
664 #include <sys/stropts.h>
665 #include <limits.h>
666 #include <locale.h>
667 #ifdef EVEREST
668 #include <unistd.h> 
669 #endif
670 #ifdef NETGROUP
671 #include <rpcsvc/ypclnt.h>
672 #endif
673 #ifdef SecureWare
674 #include <sys/security.h>
675 #include <sys/audit.h>
676 #include <prot.h>
677 #define crypt bigcrypt
678 #endif
679 #ifndef EVEREST
680  #define ftruncate(f,l) syscall(0x0a28,f,l)
681 #endif 
682 #define SIGNAL_CAST (void (*)(int))
683 #define USE_WAITPID
684 #define USE_GETCWD
685 #define USE_SETSID
686 #ifdef SCO3_2_2
687 #define NO_EID
688 #else
689 #ifndef EVEREST
690 #define USE_IFREQ
691 #endif
692 #endif
693 #define STATFS4
694 #define NO_FSYNC
695 #ifndef EVEREST
696 #define NO_INITGROUPS
697 #endif
698 #define HAVE_PATHCONF
699 #define NO_GETRLIMIT
700 #endif
701
702
703
704 /* Definitions for RiscIX */
705 #ifdef RiscIX
706 #define SIGNAL_CAST (void (*)(int))
707 #include <sys/dirent.h>
708 #include <sys/acct.h>
709 #include <sys/vfs.h>
710 #include <string.h>
711 #include <utime.h>
712 #include <signal.h>
713 #define HAVE_GETTIMEOFDAY
714 #define NOSTRCASECMP
715 #define NOSTRDUP
716 #endif
717
718
719
720 #ifdef ISC
721 #include <net/errno.h>
722 #include <string.h>
723 #include <sys/dir.h>
724 #include <dirent.h>
725 #include <sys/statfs.h>
726 #include <fcntl.h>
727 #include <sys/sioctl.h>
728 #include <stropts.h>
729 #include <limits.h>
730 #include <netinet/tcp.h>
731 #define FIONREAD FIORDCHK
732 #define SYSV
733 #define USE_WAITPID
734 #define SIGNAL_CAST (void (*)(int))
735 #define USE_GETCWD
736 #define USE_SETSID
737 #define USE_IFREQ
738 #define NO_FTRUNCATE
739 #define STATFS4
740 #define NO_FSYNC
741 #endif
742
743
744
745 #ifdef AUX
746 #include <fstab.h>
747 #include <string.h>
748 #include <dirent.h>
749 #include <sys/vfs.h>
750 #include <fcntl.h>
751 #include <termios.h>
752 #define SYSV
753 #define USE_WAITPID
754 #define SIGNAL_CAST (void (*)(int))
755 char *strdup (char *);
756 #define USE_GETCWD
757 #endif
758
759
760 #ifdef M88K_R3
761 #include <string.h>
762 #include <dirent.h>
763 #include <fcntl.h>
764 #include <termios.h>
765 #define STATFS4
766 #define SYSV
767 #define USE_WAITPID
768 #define SIGNAL_CAST (void (*)(int))
769 char *strdup (char *);
770 #define USE_GETCWD
771 #define NO_FSYNC
772 #define NO_EID
773 #endif
774
775
776 #ifdef DNIX
777 #include <dirent.h>
778 #include <string.h>
779 #include <fcntl.h>
780 #include <sys/statfs.h>
781 #include <sys/stropts.h>
782 #define NO_GET_BROADCAST
783 #define USE_WAITPID
784 #define USE_GETCWD
785 #define USE_SETSID
786 #define STATFS4
787 #define NO_EID
788 #define PF_INET AF_INET
789 #define NO_STRERROR
790 #define ftruncate(f,l) chsize(f,l)
791 #endif /* DNIX */
792
793 #ifdef CONVEX
794 #include <netinet/tcp.h>
795 #include <arpa/inet.h>
796 #include <dirent.h>
797 #include <string.h>
798 #include <sys/vfs.h>
799 #include <fcntl.h>
800 #define DONT_REINSTALL_SIG
801 #define USE_SIGBLOCK
802 #define USE_WAITPID
803 #define SIGNAL_CAST (_SigFunc_Ptr_t)
804 #define NO_GETSPNAM
805 #define HAVE_MEMMOVE
806 extern char *mktemp(char *);
807 extern int  fsync(int);
808 extern int  seteuid(uid_t);
809 extern int  setgroups(int, int *);
810 extern int  initgroups(char *, int);
811 extern int  statfs(char *, struct statfs *);
812 extern int  setegid(gid_t);
813 extern int  getopt(int, char *const *, const char *);
814 extern int  chroot(char *);
815 extern int  gettimeofday(struct timeval *, struct timezone *);
816 extern int  gethostname(char *, int);
817 extern char *crypt(char *, char *);
818 extern char *getpass(char *);
819 #endif
820
821
822 #ifdef CRAY
823 #define MAXPATHLEN 1024
824 #include <dirent.h>
825 #include <string.h>
826 #include <fcntl.h>
827 #include <sys/statfs.h>
828 #define SIGNAL_CAST (void (*)(int))
829 #define SIGCLD_IGNORE
830 #define HAVE_FCNTL_LOCK 1
831 #define USE_SETSID
832 #define STATFS4
833 #endif
834
835
836 #ifdef ALTOS
837 #include <unistd.h>
838 #include <string.h>
839 #include <dirent.h>
840 #include <sys/fcntl.h>
841 #include <sys/statfs.h>
842 #define        const
843 #define        uid_t           int
844 #define        gid_t           int
845 #define        mode_t          int
846 #define        ptrdiff_t       int
847 #define HAVE_GETGRNAM  0
848 #define NO_EID
849 #define NO_FSYNC
850 #define        NO_FTRUNCATE
851 #define        NO_GETRLIMIT
852 #define        NO_INITGROUPS
853 #define NO_SELECT
854 #define NO_SETGROUPS
855 #define NO_STRERROR
856 #define NO_STRFTIME
857 #define        NO_TM_NAME
858 #define NO_UTIMEH
859 #define NOSTRCASECMP
860 #define REPLACE_MKTIME
861 #define REPLACE_RENAME
862 #define REPLACE_STRSTR
863 #define STATFS4
864 #define        USE_GETCWD
865 #endif
866
867 #ifdef QNX
868 #define STATFS4
869 #include <sys/statfs.h>
870 #include <sys/select.h>
871 #include <signal.h>
872 #include <sys/dir.h>
873 #define SIGNAL_CAST (void (*)())
874 #define USE_WAITPID
875 #define NO_INITGROUPS
876 #define NO_SETGROUPS
877 #define HAVE_TIMEZONE
878 #define USE_GETCWD
879 #define USE_SETSID
880 #define HAVE_FCNTL_LOCK 1
881 #define DEFAULT_PRINTING PRINT_QNX
882 #endif
883
884
885 #ifdef NEWS42
886 #include <string.h>
887 #include <dirent.h>
888 #include <sys/vfs.h>
889 #include <sys/timeb.h>
890 typedef int mode_t;
891 #endif
892
893 #ifdef OS2
894 #include <dirent.h>
895 #include <sys/statfs.h>
896 #include <string.h>
897 #include <limits.h>
898 #define SIGNAL_CAST (void (*)())
899 #define HAVE_FCNTL_LOCK 0
900 #define USE_WAITPID
901 #define NO_GET_BROADCAST
902 #define NO_EID
903 #define NO_SETGROUPS
904 #define NO_INITGROUPS
905 #define NO_CRYPT
906 #define NO_STATFS
907 #define NO_CHROOT
908 #define NO_CHOWN
909 #define strcasecmp stricmp
910 #define strncasecmp strnicmp
911 #endif
912
913
914 #ifdef LYNX
915 #define SIGNAL_CAST (void (*)())
916 #define WAIT3_CAST1 (union wait *)
917 #define STATFS4
918 #include <fcntl.h>
919 #include <resource.h>
920 #include <stat.h>
921 #include <string.h>
922 #include <dirent.h>
923 #include <sys/statfs.h>
924 #define USE_GETCWD
925 #define USE_GETSID
926 #endif
927
928
929 #ifdef BOS
930 #define SIGNAL_CAST (void (*)(int))
931 #include <string.h>
932 #include <sys/dir.h>
933 #include <sys/select.h>
934 #include <dirent.h>
935 #include <fcntl.h>
936 #include <signal.h>
937 #include <sys/statfs.h>
938 #include <sys/bsdioctl.h>
939 #endif
940
941 #ifdef AMIGA
942 #include <arpa/inet.h>
943 #include <dirent.h>
944 #include <string.h>
945 #include <netinet/tcp.h>
946 #include <sys/acct.h>
947 #include <sys/fcntl.h>
948 #include <sys/filio.h>
949 #include <sys/sockio.h>
950 #include <netinet/in_systm.h>
951 #include <netinet/ip.h>
952 #include <sys/termios.h>
953 #include <limits.h>
954 #include <sys/timeb.h>
955
956 #define SIGNAL_CAST (void (*)(int))
957 #define USE_GETCWD
958 #define HAVE_BZERO
959 #define HAVE_MEMMOVE
960 #define USE_SIGPROCMASK
961 #define USE_WAITPID
962 #define USE_DIRECT
963 #define USE_F_FSIZE
964 #define HAVE_FCNTL_LOCK 0
965 #define HAVE_GETTIMEOFDAY
966 #define HAVE_PATHCONF
967
968 #define HAVE_NO_PROC
969 #define NO_FORK_DEBUG
970 #define HAVE_FORK 0
971 #define HAVE_VFORK 1
972 #endif
973
974 /* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
975 #ifdef IA_UINFO
976 #include <iaf.h>
977 #include <ia.h>
978 #endif
979
980
981 /*******************************************************************
982 end of the platform specific sections
983 ********************************************************************/
984
985 #if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
986 #include <sys/mman.h>
987 #endif
988
989 #ifdef SecureWare
990 #define NEED_AUTH_PARAMETERS
991 #endif
992
993 #ifdef REPLACE_GETPASS
994 extern char    *getsmbpass(char *);
995 #define getpass(s) getsmbpass(s)
996 #endif
997
998 #ifdef REPLACE_INNETGR
999 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
1000 #endif
1001
1002 #ifndef FD_SETSIZE
1003 #define FD_SETSIZE 255
1004 #endif
1005
1006 #ifndef __STDC__
1007 #define const
1008 #endif
1009
1010 /* Now for some other grungy stuff */
1011 #ifdef NO_GETSPNAM
1012 struct spwd { /* fake shadow password structure */
1013        char *sp_pwdp;
1014 };
1015 #endif
1016
1017 #ifndef HAVE_BZERO
1018 #ifndef bzero
1019 #define bzero(p,s) memset(p,0,s)
1020 #endif
1021 #endif
1022
1023 #ifndef HAVE_MEMMOVE
1024 #ifndef memmove
1025 #define memmove(d,s,n) MemMove(d,s,n)
1026 #endif
1027 #endif
1028
1029 #ifdef USE_DIRECT
1030 #include <sys/dir.h>
1031 #endif
1032
1033 /* some unixes have ENOTTY instead of TIOCNOTTY */
1034 #ifndef TIOCNOTTY
1035 #ifdef ENOTTY
1036 #define TIOCNOTTY ENOTTY
1037 #endif
1038 #endif
1039
1040 #ifndef SIGHUP
1041 #define SIGHUP 1
1042 #endif
1043
1044 /* if undefined then use bsd or sysv printing */
1045 #ifndef DEFAULT_PRINTING
1046 #ifdef SYSV
1047 #define DEFAULT_PRINTING PRINT_SYSV
1048 #else
1049 #define DEFAULT_PRINTING PRINT_BSD
1050 #endif
1051 #endif
1052
1053
1054 #ifdef AFS_AUTH
1055 #include <afs/stds.h>
1056 #include <afs/kautils.h>
1057 #endif
1058
1059 #ifdef DFS_AUTH
1060 #include <dce/dce_error.h>
1061 #include <dce/sec_login.h>
1062 #endif
1063
1064 #ifdef KRB5_AUTH
1065 #include <krb5.h>
1066 #endif
1067
1068 #ifdef NO_UTIMBUF
1069 struct utimbuf {
1070   time_t actime;
1071   time_t modtime;
1072 };
1073 #endif
1074
1075 #ifdef NO_STRERROR
1076 #ifndef strerror
1077 extern char *sys_errlist[];
1078 #define strerror(i) sys_errlist[i]
1079 #endif
1080 #endif
1081
1082 #ifndef perror
1083 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1084 #endif
1085
1086 #ifndef MAXHOSTNAMELEN
1087 #define MAXHOSTNAMELEN 255
1088 #endif
1089
1090 #include "version.h"
1091 #include "smb.h"
1092 #include "nameserv.h"
1093 #include "proto.h"
1094 #include "byteorder.h"
1095
1096 #include "kanji.h"
1097 #include "charset.h"
1098
1099 #ifndef S_IFREG
1100 #define S_IFREG 0100000
1101 #endif
1102
1103 #ifndef S_ISREG
1104 #define S_ISREG(x) ((S_IFREG & x)!=0)
1105 #endif
1106
1107 #ifndef S_ISDIR
1108 #define S_ISDIR(x) ((S_IFDIR & x)!=0)
1109 #endif
1110
1111 #ifdef UFC_CRYPT
1112 #define crypt ufc_crypt
1113 #endif
1114
1115 #ifdef REPLACE_STRLEN
1116 #define strlen(s) Strlen(s)
1117 #endif
1118
1119 #ifdef REPLACE_STRSTR
1120 #define strstr(s,p) Strstr(s,p)
1121 #endif
1122
1123 #ifdef REPLACE_MKTIME
1124 #define mktime(t) Mktime(t)
1125 #endif
1126
1127 #ifndef NGROUPS_MAX
1128 #define NGROUPS_MAX 128
1129 #endif
1130
1131 #ifndef EDQUOT
1132 #define EDQUOT ENOSPC
1133 #endif
1134
1135 #ifndef HAVE_GETGRNAM
1136 #define HAVE_GETGRNAM 1
1137 #endif
1138
1139 #ifndef SOL_TCP
1140 #define SOL_TCP 6
1141 #endif
1142
1143 /* default to using ftruncate workaround as this is safer than assuming
1144 it works and getting lots of bug reports */
1145 #ifndef FTRUNCATE_CAN_EXTEND
1146 #define FTRUNCATE_CAN_EXTEND 0
1147 #endif
1148
1149 /* maybe this unix doesn't separate RD and WR locks? */
1150 #ifndef F_RDLCK
1151 #define F_RDLCK F_WRLCK
1152 #endif
1153
1154 #ifndef ENOTSOCK
1155 #define ENOTSOCK EINVAL
1156 #endif
1157
1158 #ifndef SIGCLD
1159 #define SIGCLD SIGCHLD
1160 #endif 
1161
1162 #ifndef MAP_FILE
1163 #define MAP_FILE 0
1164 #endif
1165
1166 #ifndef HAVE_FCNTL_LOCK
1167 #define HAVE_FCNTL_LOCK 1
1168 #endif
1169
1170 #ifndef WAIT3_CAST2
1171 #define WAIT3_CAST2 (struct rusage *)
1172 #endif
1173
1174 #ifndef WAIT3_CAST1
1175 #define WAIT3_CAST1 (int *)
1176 #endif
1177
1178 #ifndef QSORT_CAST
1179 #define QSORT_CAST (int (*)())
1180 #endif
1181
1182 /* this is a rough check to see if this machine has a lstat() call.
1183    it is not guaranteed to work */
1184 #if !(defined(S_ISLNK) || defined(S_IFLNK))
1185 #define lstat stat
1186 #endif
1187
1188 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1189 #ifndef errno
1190 extern int errno;
1191 #endif 
1192
1193
1194 #ifdef NO_EID
1195 #define geteuid() getuid()
1196 #define getegid() getgid()
1197 #define seteuid(x) setuid(x)
1198 #define setegid(x) setgid(x)
1199 #endif
1200
1201
1202 #if (HAVE_FCNTL_LOCK == 0)
1203 /* since there is no locking available, system includes  */
1204 /* for DomainOS 10.4 do not contain any of the following */
1205 /* #define's. So, to satisfy the compiler, add these     */
1206 /* #define's, although they arn't really necessary.      */
1207 #define F_GETLK 0
1208 #define F_SETLK 0
1209 #define F_WRLCK 0
1210 #define F_UNLCK 0
1211 #endif /* HAVE_FCNTL_LOCK == 0 */
1212
1213 #ifdef NOSTRCASECMP
1214 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1215 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1216 #endif
1217
1218 #ifndef strcpy
1219 #define strcpy(dest,src) StrCpy(dest,src)
1220 #endif
1221
1222
1223 /* possibly wrap the malloc calls */
1224 #if WRAP_MALLOC
1225
1226 /* undo the old malloc def if necessary */
1227 #ifdef malloc
1228 #define xx_old_malloc malloc
1229 #undef malloc
1230 #endif
1231
1232 #define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
1233
1234 /* undo the old realloc def if necessary */
1235 #ifdef realloc
1236 #define xx_old_realloc realloc
1237 #undef realloc
1238 #endif
1239
1240 #define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
1241
1242 /* undo the old free def if necessary */
1243 #ifdef free
1244 #define xx_old_free free
1245 #undef free
1246 #endif
1247
1248 #define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
1249
1250 /* and the malloc prototypes */
1251 void *malloc_wrapped(int,char *,int);
1252 void *realloc_wrapped(void *,int,char *,int);
1253 void free_wrapped(void *,char *,int);
1254
1255 #endif
1256
1257
1258 #if WRAP_MEMCPY
1259 /* undo the old memcpy def if necessary */
1260 #ifdef memcpy
1261 #define xx_old_memcpy memcpy
1262 #undef memcpy
1263 #endif
1264
1265 #define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
1266 void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
1267 #endif
1268
1269 #endif