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