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