Makefile: Added AIX targets from Ole Holm Nielsen <Ole.H.Nielsen@uni-c.dk>
[Samba.git] / source / include / includes.h
bloba5adb350775a021e2b1589d5e1724872455c338a
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
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.
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.
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.
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.
30 /* the first OS dependent section is to setup what includes will be used.
31 the main OS dependent section comes later on
34 #ifdef ALTOS
35 #define NO_UTIMEH
36 #endif
38 #ifdef MIPS
39 #define POSIX_H
40 #define NO_UTIMEH
41 #endif
43 #ifdef sun386
44 #define NO_UTIMEH
45 #endif
47 #ifdef NEXT2
48 #define NO_UTIMEH
49 #endif
51 #ifdef NEXT3_0
52 #define NO_UTIMEH
53 #define NO_UNISTDH
54 #endif
56 #ifdef APOLLO
57 #define NO_UTIMEH
58 #define NO_SYSMOUNTH
59 #define NO_UNISTDH
60 #endif
62 #ifdef AIX
63 #define NO_SYSMOUNTH
64 #endif
66 #ifdef M88K_R3
67 #define SVR3H
68 #define NO_RESOURCEH
69 #endif
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
80 #ifdef ISC
81 #define SYSSTREAMH
82 #define NO_RESOURCEH
83 #endif
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
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
102 #ifdef OS2
103 #define NO_SYSMOUNTH
104 #define NO_NETIFH
105 #endif
107 #ifdef LYNX
108 #define NO_SYSMOUNTH
109 #endif
112 #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
113 #define PASSWORD_LENGTH 16
114 #endif
116 /* here is the general includes section - with some ifdefs generated
117 by the previous section
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>
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
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
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
196 #if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX)
197 #include <shadow.h>
198 #endif
200 #ifdef SYSLOG
201 #include <syslog.h>
202 #endif
206 /***************************************************************************
207 Here come some platform specific sections
208 ***************************************************************************/
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
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
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
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
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
348 #ifdef SGI5
349 #include <arpa/inet.h>
350 #include <netinet/tcp.h>
351 #include <sys/statvfs.h>
352 #include <string.h>
353 #include <signal.h>
354 #include <dirent.h>
355 #define USE_WAITPID
356 #define NETGROUP
357 #ifndef SYSV
358 #define SYSV
359 #endif
360 #define SIGNAL_CAST (void (*)())
361 #define USE_STATVFS
362 #define USE_WAITPID
363 #define USE_SETSID
364 #endif
367 #ifdef MIPS
368 #include <bsd/net/soioctl.h>
369 #include <string.h>
370 #include <dirent.h>
371 #include <fcntl.h>
372 #include <sys/statfs.h>
373 #include <sys/wait.h>
374 #include <sys/termio.h>
375 #define SIGNAL_CAST (void (*)())
376 typedef int mode_t;
377 extern struct group *getgrnam();
378 extern struct passwd *getpwnam();
379 #define STATFS4
380 #define NO_STRERROR
381 #define REPLACE_STRSTR
382 #endif /* MIPS */
386 #ifdef DGUX
387 #include <string.h>
388 #include <dirent.h>
389 #include <sys/statfs.h>
390 #include <sys/statvfs.h>
391 #include <fcntl.h>
392 #include <termios.h>
393 #define SYSV
394 #define USE_WAITPID
395 #define SIGNAL_CAST (void (*)(int))
396 #define STATFS4
397 #define USE_GETCWD
398 #endif
401 #ifdef SVR4
402 #include <string.h>
403 #include <sys/dir.h>
404 #include <dirent.h>
405 #include <sys/statfs.h>
406 #include <sys/statvfs.h>
407 #include <sys/vfs.h>
408 #include <sys/filio.h>
409 #include <fcntl.h>
410 #include <sys/sockio.h>
411 #include <netinet/tcp.h>
412 #include <stropts.h>
413 #include <termios.h>
414 #define SYSV
415 #define USE_WAITPID
416 #define SIGNAL_CAST (void (*)(int))
417 #define USE_STATVFS
418 #define USE_GETCWD
419 #define USE_SETSID
420 #endif
423 #ifdef OSF1
424 #include <termios.h>
425 #include <strings.h>
426 #include <dirent.h>
427 char *getwd(char *);
428 char *mktemp(char *); /* No standard include */
429 #include <netinet/in.h>
430 #include <arpa/inet.h> /* both for inet_ntoa */
431 #define SIGNAL_CAST ( void (*) (int) )
432 #define STATFS3
433 #define USE_F_FSIZE
434 #define USE_SETSID
435 #include <netinet/tcp.h>
436 #ifdef OSF1_ENH_SEC
437 #include <pwd.h>
438 #include <sys/types.h>
439 #include <sys/security.h>
440 #include <prot.h>
441 #include <unistd.h>
442 #define PASSWORD_LENGTH 16
443 #define NEED_AUTH_PARAMETERS
444 #endif /* OSF1_ENH_SEC */
445 #endif
448 #ifdef CLIX
449 #include <dirent.h>
450 #define SIGNAL_CAST (void (*)())
451 #include <sys/fcntl.h>
452 #include <sys/statfs.h>
453 #include <string.h>
454 #define NO_EID
455 #define USE_WAITPID
456 #define STATFS4
457 #define NO_FSYNC
458 #define USE_GETCWD
459 #define USE_SETSID
460 #define REPLACE_GETPASS
461 #define NO_GETRLIMIT
462 #endif /* CLIX */
466 #ifdef BSDI
467 #include <string.h>
468 #include <netinet/tcp.h>
469 #define SIGNAL_CAST (void (*)())
470 #define USE_DIRECT
471 #endif
474 #ifdef NETBSD
475 #include <strings.h>
476 #include <netinet/tcp.h>
477 /* you may not need this */
478 #define NO_GETSPNAM
479 #define SIGNAL_CAST (void (*)())
480 #define USE_DIRECT
481 #define REPLACE_INNETGR
482 #endif
486 #ifdef FreeBSD
487 #include <arpa/inet.h>
488 #include <strings.h>
489 #include <netinet/tcp.h>
490 #include <netinet/in_systm.h>
491 #include <netinet/ip.h>
492 #define SIGNAL_CAST (void (*)())
493 #define USE_SETVBUF
494 #define USE_SETSID
495 #define USE_GETCWD
496 #define USE_WAITPID
497 #define USE_DIRECT
498 #define HAVE_MEMMOVE
499 #define HAVE_BZERO
500 #define HAVE_GETTIMEOFDAY
501 #define HAVE_PATHCONF
502 #define HAVE_GETGRNAM 1
503 #endif
507 #ifdef AIX
508 #include <strings.h>
509 #include <sys/dir.h>
510 #include <sys/select.h>
511 #include <dirent.h>
512 #include <sys/statfs.h>
513 #include <sys/vfs.h>
514 #include <sys/id.h>
515 #include <sys/priv.h>
516 #include <netinet/tcp.h>
517 #include <locale.h>
518 #define SYSV
519 #define USE_WAITPID
520 #define USE_SIGBLOCK
521 #define SIGNAL_CAST (void (*)())
522 #define DEFAULT_PRINTING PRINT_AIX
523 /* we undef this because sys/param.h is broken in aix. uggh. */
524 #undef MAXHOSTNAMELEN
525 #endif
528 #ifdef HPUX
529 #include <string.h>
530 #include <dirent.h>
531 #include <fcntl.h>
532 #include <sys/vfs.h>
533 #include <sys/types.h>
534 #include <sys/termios.h>
535 #include <netinet/tcp.h>
536 #ifdef HPUX_10_TRUSTED
537 #include <hpsecurity.h>
538 #include <prot.h>
539 #define NEED_AUTH_PARAMETERS
540 #endif
541 #define SIGNAL_CAST (void (*)(__harg))
542 #define SELECT_CAST (int *)
543 #define SYSV
544 #define USE_WAITPID
545 #define WAIT3_CAST2 (int *)
546 #define USE_GETCWD
547 #define USE_SETSID
548 #define USE_SETRES
549 #define DEFAULT_PRINTING PRINT_HPUX
550 #define SIGCLD_IGNORE
551 #endif
554 #ifdef SEQUENT
555 #include <signal.h>
556 #include <string.h>
557 #include <dirent.h>
558 #include <sys/types.h>
559 #include <sys/statfs.h>
560 #include <sys/stat.h>
561 #include <sys/buf.h>
562 #include <sys/socket.h>
563 #include <unistd.h>
564 #include <fcntl.h>
565 #define SIGNAL_CAST (void (*)(int))
566 #define USE_WAITPID
567 #define USE_GETCWD
568 #define NO_EID
569 #define STATFS4
570 #define USE_DIRECT
571 #ifdef PTX4
572 #undef USE_DIRECT
573 #endif
574 #endif
578 #ifdef SEQUENT_PTX4
579 #include <string.h>
580 #include <sys/dir.h>
581 #include <dirent.h>
582 #include <sys/statfs.h>
583 #include <sys/statvfs.h>
584 #include <sys/vfs.h>
585 #include <fcntl.h>
586 #include <sys/sockio.h>
587 #include <netinet/tcp.h>
588 #include <stropts.h>
589 #include <termios.h>
590 #define SYSV
591 #define USE_WAITPID
592 #define SIGNAL_CAST (void (*)(int))
593 #define USE_STATVFS
594 #define USE_GETCWD
595 #ifndef seteuid
596 #define seteuid(uid) setreuid(-1,uid)
597 #endif
598 #ifndef setegid
599 #define setegid(gid) setregid(-1,gid)
600 #endif
601 #endif
604 #ifdef NEXT2
605 #include <sys/types.h>
606 #include <strings.h>
607 #include <dirent.h>
608 #include <sys/vfs.h>
609 #define bzero(b,len) memset(b,0,len)
610 #define mode_t int
611 #define NO_UTIMBUF
612 #include <libc.h>
613 #define NOSTRDUP
614 #define USE_DIRECT
615 #define USE_WAITPID
616 #endif
619 #ifdef NEXT3_0
620 #include <strings.h>
621 #include <sys/dir.h>
622 #include <sys/vfs.h>
623 #define bzero(b,len) memset(b,0,len)
624 #define NO_UTIMBUF
625 #include <libc.h>
626 #define NOSTRDUP
627 #define USE_DIRECT
628 #define mode_t int
629 #define GID_TYPE int
630 #define gid_t int
631 #define pid_t int
632 #define SIGNAL_CAST (void (*)(int))
633 #define WAIT3_CAST1 (union wait *)
634 #define HAVE_GMTOFF
635 #endif
639 #ifdef APOLLO
640 #include <string.h>
641 #include <fcntl.h>
642 #include <sys/statfs.h>
643 #define NO_UTIMBUF
644 #define USE_DIRECT
645 #define USE_GETCWD
646 #define SIGNAL_CAST (void (*)())
647 #define HAVE_FCNTL_LOCK 0
648 #define HAVE_GETTIMEOFDAY
649 #define STATFS4
650 #endif
654 #ifdef SCO
655 #include <sys/netinet/tcp.h>
656 #include <sys/netinet/in_systm.h>
657 #include <sys/netinet/ip.h>
658 #include <dirent.h>
659 #include <string.h>
660 #include <fcntl.h>
661 #include <sys/statfs.h>
662 #include <sys/stropts.h>
663 #include <limits.h>
664 #include <locale.h>
665 #ifdef EVEREST
666 #include <unistd.h>
667 #endif
668 #ifdef NETGROUP
669 #include <rpcsvc/ypclnt.h>
670 #endif
671 #ifdef SecureWare
672 #include <sys/security.h>
673 #include <sys/audit.h>
674 #include <prot.h>
675 #define crypt bigcrypt
676 #endif
677 #ifndef EVEREST
678 #define ftruncate(f,l) syscall(0x0a28,f,l)
679 #endif
680 #define SIGNAL_CAST (void (*)(int))
681 #define USE_WAITPID
682 #define USE_GETCWD
683 #define USE_SETSID
684 #ifdef SCO3_2_2
685 #define NO_EID
686 #else
687 #ifndef EVEREST
688 #define USE_IFREQ
689 #endif
690 #endif
691 #define STATFS4
692 #define NO_FSYNC
693 #ifndef EVEREST
694 #define NO_INITGROUPS
695 #endif
696 #define HAVE_PATHCONF
697 #define NO_GETRLIMIT
698 #endif
702 /* Definitions for RiscIX */
703 #ifdef RiscIX
704 #define SIGNAL_CAST (void (*)(int))
705 #include <sys/dirent.h>
706 #include <sys/acct.h>
707 #include <sys/vfs.h>
708 #include <string.h>
709 #include <utime.h>
710 #include <signal.h>
711 #define HAVE_GETTIMEOFDAY
712 #define NOSTRCASECMP
713 #define NOSTRDUP
714 #endif
718 #ifdef ISC
719 #include <net/errno.h>
720 #include <string.h>
721 #include <sys/dir.h>
722 #include <dirent.h>
723 #include <sys/statfs.h>
724 #include <fcntl.h>
725 #include <sys/sioctl.h>
726 #include <stropts.h>
727 #include <limits.h>
728 #include <netinet/tcp.h>
729 #define FIONREAD FIORDCHK
730 #define SYSV
731 #define USE_WAITPID
732 #define SIGNAL_CAST (void (*)(int))
733 #define USE_GETCWD
734 #define USE_SETSID
735 #define USE_IFREQ
736 #define NO_FTRUNCATE
737 #define STATFS4
738 #define NO_FSYNC
739 #endif
743 #ifdef AUX
744 #include <fstab.h>
745 #include <string.h>
746 #include <dirent.h>
747 #include <sys/vfs.h>
748 #include <fcntl.h>
749 #include <termios.h>
750 #define SYSV
751 #define USE_WAITPID
752 #define SIGNAL_CAST (void (*)(int))
753 char *strdup (char *);
754 #define USE_GETCWD
755 #endif
758 #ifdef M88K_R3
759 #include <string.h>
760 #include <dirent.h>
761 #include <fcntl.h>
762 #include <termios.h>
763 #define STATFS4
764 #define SYSV
765 #define USE_WAITPID
766 #define SIGNAL_CAST (void (*)(int))
767 char *strdup (char *);
768 #define USE_GETCWD
769 #define NO_FSYNC
770 #define NO_EID
771 #endif
774 #ifdef DNIX
775 #include <dirent.h>
776 #include <string.h>
777 #include <fcntl.h>
778 #include <sys/statfs.h>
779 #include <sys/stropts.h>
780 #define NO_GET_BROADCAST
781 #define USE_WAITPID
782 #define USE_GETCWD
783 #define USE_SETSID
784 #define STATFS4
785 #define NO_EID
786 #define PF_INET AF_INET
787 #define NO_STRERROR
788 #define ftruncate(f,l) chsize(f,l)
789 #endif /* DNIX */
791 #ifdef CONVEX
792 #include <netinet/tcp.h>
793 #include <arpa/inet.h>
794 #include <dirent.h>
795 #include <string.h>
796 #include <sys/vfs.h>
797 #include <fcntl.h>
798 #define DONT_REINSTALL_SIG
799 #define USE_SIGBLOCK
800 #define USE_WAITPID
801 #define SIGNAL_CAST (_SigFunc_Ptr_t)
802 #define NO_GETSPNAM
803 #define HAVE_MEMMOVE
804 extern char *mktemp(char *);
805 extern int fsync(int);
806 extern int seteuid(uid_t);
807 extern int setgroups(int, int *);
808 extern int initgroups(char *, int);
809 extern int statfs(char *, struct statfs *);
810 extern int setegid(gid_t);
811 extern int getopt(int, char *const *, const char *);
812 extern int chroot(char *);
813 extern int gettimeofday(struct timeval *, struct timezone *);
814 extern int gethostname(char *, int);
815 extern char *crypt(char *, char *);
816 extern char *getpass(char *);
817 #endif
820 #ifdef CRAY
821 #define MAXPATHLEN 1024
822 #include <dirent.h>
823 #include <string.h>
824 #include <fcntl.h>
825 #include <sys/statfs.h>
826 #define SIGNAL_CAST (void (*)(int))
827 #define SIGCLD_IGNORE
828 #define HAVE_FCNTL_LOCK 1
829 #define USE_SETSID
830 #define STATFS4
831 #endif
834 #ifdef ALTOS
835 #include <unistd.h>
836 #include <string.h>
837 #include <dirent.h>
838 #include <sys/fcntl.h>
839 #include <sys/statfs.h>
840 #define const
841 #define uid_t int
842 #define gid_t int
843 #define mode_t int
844 #define ptrdiff_t int
845 #define HAVE_GETGRNAM 0
846 #define NO_EID
847 #define NO_FSYNC
848 #define NO_FTRUNCATE
849 #define NO_GETRLIMIT
850 #define NO_INITGROUPS
851 #define NO_SELECT
852 #define NO_SETGROUPS
853 #define NO_STRERROR
854 #define NO_STRFTIME
855 #define NO_TM_NAME
856 #define NO_UTIMEH
857 #define NOSTRCASECMP
858 #define REPLACE_MKTIME
859 #define REPLACE_RENAME
860 #define REPLACE_STRSTR
861 #define STATFS4
862 #define USE_GETCWD
863 #endif
865 #ifdef QNX
866 #define STATFS4
867 #include <sys/statfs.h>
868 #include <sys/select.h>
869 #include <signal.h>
870 #include <sys/dir.h>
871 #define SIGNAL_CAST (void (*)())
872 #define USE_WAITPID
873 #define NO_INITGROUPS
874 #define NO_SETGROUPS
875 #define HAVE_TIMEZONE
876 #define USE_GETCWD
877 #define USE_SETSID
878 #define HAVE_FCNTL_LOCK 1
879 #define DEFAULT_PRINTING PRINT_QNX
880 #endif
883 #ifdef NEWS42
884 #include <string.h>
885 #include <dirent.h>
886 #include <sys/vfs.h>
887 #include <sys/timeb.h>
888 typedef int mode_t;
889 #endif
891 #ifdef OS2
892 #include <dirent.h>
893 #include <sys/statfs.h>
894 #include <string.h>
895 #include <limits.h>
896 #define SIGNAL_CAST (void (*)())
897 #define HAVE_FCNTL_LOCK 0
898 #define USE_WAITPID
899 #define NO_GET_BROADCAST
900 #define NO_EID
901 #define NO_SETGROUPS
902 #define NO_INITGROUPS
903 #define NO_CRYPT
904 #define NO_STATFS
905 #define NO_CHROOT
906 #define NO_CHOWN
907 #define strcasecmp stricmp
908 #define strncasecmp strnicmp
909 #endif
912 #ifdef LYNX
913 #define SIGNAL_CAST (void (*)())
914 #define WAIT3_CAST1 (union wait *)
915 #define STATFS4
916 #include <fcntl.h>
917 #include <resource.h>
918 #include <stat.h>
919 #include <string.h>
920 #include <dirent.h>
921 #include <sys/statfs.h>
922 #define USE_GETCWD
923 #define USE_GETSID
924 #endif
927 #ifdef BOS
928 #define SIGNAL_CAST (void (*)(int))
929 #include <string.h>
930 #include <sys/dir.h>
931 #include <sys/select.h>
932 #include <dirent.h>
933 #include <fcntl.h>
934 #include <signal.h>
935 #include <sys/statfs.h>
936 #include <sys/bsdioctl.h>
937 #endif
939 #ifdef AMIGA
940 #include <arpa/inet.h>
941 #include <dirent.h>
942 #include <string.h>
943 #include <netinet/tcp.h>
944 #include <sys/acct.h>
945 #include <sys/fcntl.h>
946 #include <sys/filio.h>
947 #include <sys/sockio.h>
948 #include <netinet/in_systm.h>
949 #include <netinet/ip.h>
950 #include <sys/termios.h>
951 #include <limits.h>
952 #include <sys/timeb.h>
954 #define SIGNAL_CAST (void (*)(int))
955 #define USE_GETCWD
956 #define HAVE_BZERO
957 #define HAVE_MEMMOVE
958 #define USE_SIGPROCMASK
959 #define USE_WAITPID
960 #define USE_DIRECT
961 #define USE_F_FSIZE
962 #define HAVE_FCNTL_LOCK 0
963 #define HAVE_GETTIMEOFDAY
964 #define HAVE_PATHCONF
966 #define HAVE_NO_PROC
967 #define NO_FORK_DEBUG
968 #define HAVE_FORK 0
969 #define HAVE_VFORK 1
970 #endif
972 /* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
973 #ifdef IA_UINFO
974 #include <iaf.h>
975 #include <ia.h>
976 #endif
979 /*******************************************************************
980 end of the platform specific sections
981 ********************************************************************/
983 #if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
984 #include <sys/mman.h>
985 #endif
987 #ifdef SecureWare
988 #define NEED_AUTH_PARAMETERS
989 #endif
991 #ifdef REPLACE_GETPASS
992 extern char *getsmbpass(char *);
993 #define getpass(s) getsmbpass(s)
994 #endif
996 #ifdef REPLACE_INNETGR
997 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
998 #endif
1000 #ifndef FD_SETSIZE
1001 #define FD_SETSIZE 255
1002 #endif
1004 #ifndef __STDC__
1005 #define const
1006 #endif
1008 /* Now for some other grungy stuff */
1009 #ifdef NO_GETSPNAM
1010 struct spwd { /* fake shadow password structure */
1011 char *sp_pwdp;
1013 #endif
1015 #ifndef HAVE_BZERO
1016 #ifndef bzero
1017 #define bzero(p,s) memset(p,0,s)
1018 #endif
1019 #endif
1021 #ifndef HAVE_MEMMOVE
1022 #ifndef memmove
1023 #define memmove(d,s,n) MemMove(d,s,n)
1024 #endif
1025 #endif
1027 #ifdef USE_DIRECT
1028 #include <sys/dir.h>
1029 #endif
1031 /* some unixes have ENOTTY instead of TIOCNOTTY */
1032 #ifndef TIOCNOTTY
1033 #ifdef ENOTTY
1034 #define TIOCNOTTY ENOTTY
1035 #endif
1036 #endif
1038 #ifndef SIGHUP
1039 #define SIGHUP 1
1040 #endif
1042 /* if undefined then use bsd or sysv printing */
1043 #ifndef DEFAULT_PRINTING
1044 #ifdef SYSV
1045 #define DEFAULT_PRINTING PRINT_SYSV
1046 #else
1047 #define DEFAULT_PRINTING PRINT_BSD
1048 #endif
1049 #endif
1052 #ifdef AFS_AUTH
1053 #include <afs/stds.h>
1054 #include <afs/kautils.h>
1055 #endif
1057 #ifdef DFS_AUTH
1058 #include <dce/dce_error.h>
1059 #include <dce/sec_login.h>
1060 #endif
1062 #ifdef NO_UTIMBUF
1063 struct utimbuf {
1064 time_t actime;
1065 time_t modtime;
1067 #endif
1069 #ifdef NO_STRERROR
1070 #ifndef strerror
1071 extern char *sys_errlist[];
1072 #define strerror(i) sys_errlist[i]
1073 #endif
1074 #endif
1076 #ifndef perror
1077 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1078 #endif
1080 #ifndef MAXHOSTNAMELEN
1081 #define MAXHOSTNAMELEN 255
1082 #endif
1084 #include "version.h"
1085 #include "smb.h"
1086 #include "nameserv.h"
1087 #include "proto.h"
1088 #include "byteorder.h"
1090 #include "kanji.h"
1091 #include "charset.h"
1093 #ifndef S_IFREG
1094 #define S_IFREG 0100000
1095 #endif
1097 #ifndef S_ISREG
1098 #define S_ISREG(x) ((S_IFREG & x)!=0)
1099 #endif
1101 #ifndef S_ISDIR
1102 #define S_ISDIR(x) ((S_IFDIR & x)!=0)
1103 #endif
1105 #ifdef UFC_CRYPT
1106 #define crypt ufc_crypt
1107 #endif
1109 #ifdef REPLACE_STRLEN
1110 #define strlen(s) Strlen(s)
1111 #endif
1113 #ifdef REPLACE_STRSTR
1114 #define strstr(s,p) Strstr(s,p)
1115 #endif
1117 #ifdef REPLACE_MKTIME
1118 #define mktime(t) Mktime(t)
1119 #endif
1121 #ifndef NGROUPS_MAX
1122 #define NGROUPS_MAX 128
1123 #endif
1125 #ifndef EDQUOT
1126 #define EDQUOT ENOSPC
1127 #endif
1129 #ifndef HAVE_GETGRNAM
1130 #define HAVE_GETGRNAM 1
1131 #endif
1133 #ifndef SOL_TCP
1134 #define SOL_TCP 6
1135 #endif
1137 /* default to using ftruncate workaround as this is safer than assuming
1138 it works and getting lots of bug reports */
1139 #ifndef FTRUNCATE_CAN_EXTEND
1140 #define FTRUNCATE_CAN_EXTEND 0
1141 #endif
1143 /* maybe this unix doesn't separate RD and WR locks? */
1144 #ifndef F_RDLCK
1145 #define F_RDLCK F_WRLCK
1146 #endif
1148 #ifndef ENOTSOCK
1149 #define ENOTSOCK EINVAL
1150 #endif
1152 #ifndef SIGCLD
1153 #define SIGCLD SIGCHLD
1154 #endif
1156 #ifndef MAP_FILE
1157 #define MAP_FILE 0
1158 #endif
1160 #ifndef HAVE_FCNTL_LOCK
1161 #define HAVE_FCNTL_LOCK 1
1162 #endif
1164 #ifndef WAIT3_CAST2
1165 #define WAIT3_CAST2 (struct rusage *)
1166 #endif
1168 #ifndef WAIT3_CAST1
1169 #define WAIT3_CAST1 (int *)
1170 #endif
1172 #ifndef QSORT_CAST
1173 #define QSORT_CAST (int (*)())
1174 #endif
1176 /* this is a rough check to see if this machine has a lstat() call.
1177 it is not guaranteed to work */
1178 #if !(defined(S_ISLNK) || defined(S_IFLNK))
1179 #define lstat stat
1180 #endif
1182 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1183 #ifndef errno
1184 extern int errno;
1185 #endif
1188 #ifdef NO_EID
1189 #define geteuid() getuid()
1190 #define getegid() getgid()
1191 #define seteuid(x) setuid(x)
1192 #define setegid(x) setgid(x)
1193 #endif
1196 #if (HAVE_FCNTL_LOCK == 0)
1197 /* since there is no locking available, system includes */
1198 /* for DomainOS 10.4 do not contain any of the following */
1199 /* #define's. So, to satisfy the compiler, add these */
1200 /* #define's, although they arn't really necessary. */
1201 #define F_GETLK 0
1202 #define F_SETLK 0
1203 #define F_WRLCK 0
1204 #define F_UNLCK 0
1205 #endif /* HAVE_FCNTL_LOCK == 0 */
1207 #ifdef NOSTRCASECMP
1208 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1209 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1210 #endif
1212 #ifndef strcpy
1213 #define strcpy(dest,src) StrCpy(dest,src)
1214 #endif
1217 /* possibly wrap the malloc calls */
1218 #if WRAP_MALLOC
1220 /* undo the old malloc def if necessary */
1221 #ifdef malloc
1222 #define xx_old_malloc malloc
1223 #undef malloc
1224 #endif
1226 #define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
1228 /* undo the old realloc def if necessary */
1229 #ifdef realloc
1230 #define xx_old_realloc realloc
1231 #undef realloc
1232 #endif
1234 #define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
1236 /* undo the old free def if necessary */
1237 #ifdef free
1238 #define xx_old_free free
1239 #undef free
1240 #endif
1242 #define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
1244 /* and the malloc prototypes */
1245 void *malloc_wrapped(int,char *,int);
1246 void *realloc_wrapped(void *,int,char *,int);
1247 void free_wrapped(void *,char *,int);
1249 #endif
1252 #if WRAP_MEMCPY
1253 /* undo the old memcpy def if necessary */
1254 #ifdef memcpy
1255 #define xx_old_memcpy memcpy
1256 #undef memcpy
1257 #endif
1259 #define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
1260 void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
1261 #endif
1263 #endif