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