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