- use workgroup from smb.conf in smbclient
[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(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 #define USE_WAITPID
224 #if 0
225 /* SETFS disabled until we can check on some bug reports */
226 #if _LINUX_C_LIB_VERSION_MAJOR >= 5
227 #define USE_SETFS
228 #endif
229 #endif
230 #ifdef SHADOW_PWD
231 #if _LINUX_C_LIB_VERSION_MAJOR < 5
232 #ifndef crypt
233 #define crypt pw_encrypt
234 #endif
235 #endif
236 #endif
237 #endif
238
239 #ifdef SUNOS4
240 #define SIGNAL_CAST (void (*)(int))
241 #include <netinet/tcp.h>
242 #include <dirent.h>
243 #include <sys/acct.h>
244 #include <sys/vfs.h>
245 #include <string.h>
246 #include <errno.h>
247 #include <sys/wait.h>
248 #include <signal.h>
249 /* #include <termios.h> */
250 #ifdef sun386
251 #define NO_STRFTIME
252 #define NO_UTIMBUF
253 #define mktime timelocal
254 typedef unsigned short mode_t;
255 #else
256 #include <utime.h>
257 #define NO_STRERROR
258 #endif
259 #define REPLACE_GETPASS
260 #define BSD_TERMIO
261 #define USE_SIGPROCMASK
262 #define USE_WAITPID
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 #ifdef BOS
895 #define SIGNAL_CAST (void (*)(int))
896 #include <string.h>
897 #include <sys/dir.h>
898 #include <sys/select.h>
899 #include <dirent.h>
900 #include <fcntl.h>
901 #include <signal.h>
902 #include <sys/statfs.h>
903 #include <sys/bsdioctl.h>
904 #endif
905
906
907
908 /*******************************************************************
909 end of the platform specific sections
910 ********************************************************************/
911
912 #if defined(USE_MMAP) || FAST_SHARE_MODES
913 #include <sys/mman.h>
914 #endif
915
916 #ifdef SecureWare
917 #define NEED_AUTH_PARAMETERS
918 #endif
919
920 #ifdef REPLACE_GETPASS
921 extern char    *getsmbpass(char *);
922 #define getpass(s) getsmbpass(s)
923 #endif
924
925 #ifdef REPLACE_INNETGR
926 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
927 #endif
928
929 #ifndef FD_SETSIZE
930 #define FD_SETSIZE 255
931 #endif
932
933 #ifndef __STDC__
934 #define const
935 #endif
936
937 /* Now for some other grungy stuff */
938 #ifdef NO_GETSPNAM
939 struct spwd { /* fake shadow password structure */
940        char *sp_pwdp;
941 };
942 #endif
943
944 #ifndef HAVE_BZERO
945 #ifndef bzero
946 #define bzero(p,s) memset(p,0,s)
947 #endif
948 #endif
949
950 #ifndef HAVE_MEMMOVE
951 #ifndef memmove
952 #define memmove(d,s,n) MemMove(d,s,n)
953 #endif
954 #endif
955
956 #ifdef USE_DIRECT
957 #include <sys/dir.h>
958 #endif
959
960 /* some unixes have ENOTTY instead of TIOCNOTTY */
961 #ifndef TIOCNOTTY
962 #ifdef ENOTTY
963 #define TIOCNOTTY ENOTTY
964 #endif
965 #endif
966
967 #ifndef SIGHUP
968 #define SIGHUP 1
969 #endif
970
971 /* if undefined then use bsd or sysv printing */
972 #ifndef DEFAULT_PRINTING
973 #ifdef SYSV
974 #define DEFAULT_PRINTING PRINT_SYSV
975 #else
976 #define DEFAULT_PRINTING PRINT_BSD
977 #endif
978 #endif
979
980
981 #ifdef AFS_AUTH
982 #include <afs/stds.h>
983 #include <afs/kautils.h>
984 #endif
985
986 #ifdef DFS_AUTH
987 #include <dce/dce_error.h>
988 #include <dce/sec_login.h>
989 #endif
990
991 #ifdef NO_UTIMBUF
992 struct utimbuf {
993   time_t actime;
994   time_t modtime;
995 };
996 #endif
997
998 #ifdef NO_STRERROR
999 #ifndef strerror
1000 extern char *sys_errlist[];
1001 #define strerror(i) sys_errlist[i]
1002 #endif
1003 #endif
1004
1005 #ifndef perror
1006 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1007 #endif
1008
1009 #ifndef MAXHOSTNAMELEN
1010 #define MAXHOSTNAMELEN 255
1011 #endif
1012
1013 #include "version.h"
1014 #include "smb.h"
1015 #include "nameserv.h"
1016 #include "proto.h"
1017 #include "byteorder.h"
1018
1019 #include "kanji.h"
1020 #include "charset.h"
1021
1022 #ifndef S_IFREG
1023 #define S_IFREG 0100000
1024 #endif
1025
1026 #ifndef S_ISREG
1027 #define S_ISREG(x) ((S_IFREG & x)!=0)
1028 #endif
1029
1030 #ifndef S_ISDIR
1031 #define S_ISDIR(x) ((S_IFDIR & x)!=0)
1032 #endif
1033
1034 #ifdef UFC_CRYPT
1035 #define crypt ufc_crypt
1036 #endif
1037
1038 #ifdef REPLACE_STRLEN
1039 #define strlen(s) Strlen(s)
1040 #endif
1041
1042 #ifdef REPLACE_STRSTR
1043 #define strstr(s,p) Strstr(s,p)
1044 #endif
1045
1046 #ifdef REPLACE_MKTIME
1047 #define mktime(t) Mktime(t)
1048 #endif
1049
1050 #ifndef NGROUPS_MAX
1051 #define NGROUPS_MAX 128
1052 #endif
1053
1054 #ifndef EDQUOT
1055 #define EDQUOT ENOSPC
1056 #endif
1057
1058 #ifndef HAVE_GETGRNAM
1059 #define HAVE_GETGRNAM 1
1060 #endif
1061
1062 #ifndef SOL_TCP
1063 #define SOL_TCP 6
1064 #endif
1065
1066 /* default to using ftruncate workaround as this is safer than assuming
1067 it works and getting lots of bug reports */
1068 #ifndef FTRUNCATE_CAN_EXTEND
1069 #define FTRUNCATE_CAN_EXTEND 0
1070 #endif
1071
1072 /* maybe this unix doesn't separate RD and WR locks? */
1073 #ifndef F_RDLCK
1074 #define F_RDLCK F_WRLCK
1075 #endif
1076
1077 #ifndef ENOTSOCK
1078 #define ENOTSOCK EINVAL
1079 #endif
1080
1081 #ifndef SIGCLD
1082 #define SIGCLD SIGCHLD
1083 #endif 
1084
1085 #ifndef MAP_FILE
1086 #define MAP_FILE 0
1087 #endif
1088
1089 #ifndef HAVE_FCNTL_LOCK
1090 #define HAVE_FCNTL_LOCK 1
1091 #endif
1092
1093 #ifndef WAIT3_CAST2
1094 #define WAIT3_CAST2 (struct rusage *)
1095 #endif
1096
1097 #ifndef WAIT3_CAST1
1098 #define WAIT3_CAST1 (int *)
1099 #endif
1100
1101 #ifndef QSORT_CAST
1102 #define QSORT_CAST (int (*)())
1103 #endif
1104
1105 /* this is a rough check to see if this machine has a lstat() call.
1106    it is not guaranteed to work */
1107 #if !(defined(S_ISLNK) || defined(S_IFLNK))
1108 #define lstat stat
1109 #endif
1110
1111 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1112 #ifndef errno
1113 extern int errno;
1114 #endif 
1115
1116
1117 #ifdef NO_EID
1118 #define geteuid() getuid()
1119 #define getegid() getgid()
1120 #define seteuid(x) setuid(x)
1121 #define setegid(x) setgid(x)
1122 #endif
1123
1124
1125 #if (HAVE_FCNTL_LOCK == 0)
1126 /* since there is no locking available, system includes  */
1127 /* for DomainOS 10.4 do not contain any of the following */
1128 /* #define's. So, to satisfy the compiler, add these     */
1129 /* #define's, although they arn't really necessary.      */
1130 #define F_GETLK 0
1131 #define F_SETLK 0
1132 #define F_WRLCK 0
1133 #define F_UNLCK 0
1134 #endif /* HAVE_FCNTL_LOCK == 0 */
1135
1136 #ifdef NOSTRCASECMP
1137 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1138 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1139 #endif
1140
1141 #ifndef strcpy
1142 #define strcpy(dest,src) StrCpy(dest,src)
1143 #endif
1144
1145
1146 /* possibly wrap the malloc calls */
1147 #if WRAP_MALLOC
1148
1149 /* undo the old malloc def if necessary */
1150 #ifdef malloc
1151 #define xx_old_malloc malloc
1152 #undef malloc
1153 #endif
1154
1155 #define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
1156
1157 /* undo the old realloc def if necessary */
1158 #ifdef realloc
1159 #define xx_old_realloc realloc
1160 #undef realloc
1161 #endif
1162
1163 #define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
1164
1165 /* undo the old free def if necessary */
1166 #ifdef free
1167 #define xx_old_free free
1168 #undef free
1169 #endif
1170
1171 #define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
1172
1173 /* and the malloc prototypes */
1174 void *malloc_wrapped(int,char *,int);
1175 void *realloc_wrapped(void *,int,char *,int);
1176 void free_wrapped(void *,char *,int);
1177
1178 #endif
1179
1180
1181 #if WRAP_MEMCPY
1182 /* undo the old memcpy def if necessary */
1183 #ifdef memcpy
1184 #define xx_old_memcpy memcpy
1185 #undef memcpy
1186 #endif
1187
1188 #define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
1189 void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
1190 #endif
1191
1192 #endif