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