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