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