Initial version imported to CVS
[ira/wip.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 #define REPLACE_INNETGR
485 #endif 
486
487
488
489 #ifdef AIX
490 #include <strings.h>
491 #include <sys/dir.h>
492 #include <sys/select.h>
493 #include <dirent.h>
494 #include <sys/statfs.h>
495 #include <sys/vfs.h>
496 #include <sys/id.h>
497 #include <sys/priv.h>
498 #include <netinet/tcp.h>
499 #define SYSV
500 #define USE_WAITPID
501 #define SIGNAL_CAST (void (*)())
502 #define DEFAULT_PRINTING PRINT_AIX
503 #endif
504
505
506 #ifdef HPUX
507 #include <string.h>
508 #include <dirent.h>
509 #include <fcntl.h>
510 #include <sys/vfs.h>
511 #include <sys/types.h>
512 #include <sys/termios.h>
513 #include <netinet/tcp.h>
514 #ifdef HPUX_10_TRUSTED
515 #include <hpsecurity.h>
516 #include <prot.h>
517 #define NEED_AUTH_PARAMETERS
518 #endif
519 #define SIGNAL_CAST (void (*)(__harg))
520 #define SELECT_CAST (int *)
521 #define SYSV
522 #define USE_WAITPID
523 #define WAIT3_CAST2 (int *)
524 #define USE_GETCWD
525 #define USE_SETSID
526 #define USE_SETRES
527 #define DEFAULT_PRINTING PRINT_HPUX
528 #define SIGCLD_IGNORE
529 #endif
530
531
532 #ifdef SEQUENT
533 #include <signal.h>
534 #include <string.h>
535 #include <dirent.h>
536 #include <sys/types.h>
537 #include <sys/statfs.h>
538 #include <sys/stat.h>
539 #include <sys/buf.h>
540 #include <sys/socket.h>
541 #include <unistd.h>
542 #include <fcntl.h>
543 #define SIGNAL_CAST (void (*)(int))
544 #define USE_WAITPID
545 #define USE_GETCWD
546 #define NO_EID
547 #define STATFS4
548 #define USE_DIRECT
549 #endif
550
551 #ifdef NEXT2
552 #include <sys/types.h>
553 #include <strings.h>
554 #include <dirent.h>
555 #include <sys/vfs.h>
556 #define bzero(b,len) memset(b,0,len)
557 #define mode_t int
558 #define NO_UTIMBUF
559 #include <libc.h>
560 #define NOSTRDUP
561 #define USE_DIRECT
562 #define USE_WAITPID
563 #endif 
564
565
566 #ifdef NEXT3_0
567 #include <strings.h>
568 #include <sys/dir.h>
569 #include <sys/vfs.h>
570 #define bzero(b,len) memset(b,0,len)
571 #define NO_UTIMBUF
572 #include <libc.h>
573 #define NOSTRDUP
574 #define USE_DIRECT
575 #define mode_t int
576 #define GID_TYPE int
577 #define gid_t int
578 #define SIGNAL_CAST (void (*)(int))
579 #define WAIT3_CAST1 (union wait *)
580 #define HAVE_GMTOFF
581 #endif
582
583
584
585 #ifdef APOLLO
586 #include <string.h>
587 #include <fcntl.h>
588 #include <sys/statfs.h>
589 #define NO_UTIMBUF
590 #define USE_DIRECT
591 #define USE_GETCWD
592 #define SIGNAL_CAST     (void (*)())
593 #define HAVE_FCNTL_LOCK 0
594 #define HAVE_GETTIMEOFDAY
595 #define STATFS4
596 #endif
597
598
599
600 #ifdef SCO
601 #include <sys/netinet/tcp.h>
602 #include <sys/netinet/in_systm.h>
603 #include <sys/netinet/ip.h>
604 #include <dirent.h>
605 #include <string.h>
606 #include <fcntl.h>
607 #include <sys/statfs.h>
608 #include <sys/stropts.h>
609 #include <limits.h>
610 #ifdef EVEREST
611 #include <unistd.h> 
612 #endif
613 #ifdef NETGROUP
614 #include <rpcsvc/ypclnt.h>
615 #endif
616 #ifdef SecureWare
617 #include <sys/security.h>
618 #include <sys/audit.h>
619 #include <prot.h>
620 #define crypt bigcrypt
621 #endif
622 #ifndef EVEREST
623  #define ftruncate(f,l) syscall(0x0a28,f,l)
624 #endif 
625 #define SIGNAL_CAST (void (*)(int))
626 #define USE_WAITPID
627 #define USE_GETCWD
628 #define USE_SETSID
629 #ifdef SCO3_2_2
630 #define NO_EID
631 #else
632 #ifndef EVEREST
633 #define USE_IFREQ
634 #endif
635 #endif
636 #define STATFS4
637 #define NO_FSYNC
638 #ifndef EVEREST
639 #define NO_INITGROUPS
640 #endif
641 #define HAVE_PATHCONF
642 #define NO_GETRLIMIT
643 #endif
644
645
646
647 /* Definitions for RiscIX */
648 #ifdef RiscIX
649 #define SIGNAL_CAST (void (*)(int))
650 #include <sys/dirent.h>
651 #include <sys/acct.h>
652 #include <sys/vfs.h>
653 #include <string.h>
654 #include <utime.h>
655 #include <signal.h>
656 #define HAVE_GETTIMEOFDAY
657 #define NOSTRCASECMP
658 #define NOSTRDUP
659 #endif
660
661
662
663 #ifdef ISC
664 #include <net/errno.h>
665 #include <string.h>
666 #include <sys/dir.h>
667 #include <dirent.h>
668 #include <sys/statfs.h>
669 #include <fcntl.h>
670 #include <sys/sioctl.h>
671 #include <stropts.h>
672 #include <limits.h>
673 #include <netinet/tcp.h>
674 #define FIONREAD FIORDCHK
675 #define SYSV
676 #define USE_WAITPID
677 #define SIGNAL_CAST (void (*)(int))
678 #define USE_GETCWD
679 #define USE_SETSID
680 #define USE_IFREQ
681 #define NO_FTRUNCATE
682 #define STATFS4
683 #define NO_FSYNC
684 #endif
685
686
687
688 #ifdef AUX
689 #include <fstab.h>
690 #include <string.h>
691 #include <dirent.h>
692 #include <sys/vfs.h>
693 #include <fcntl.h>
694 #include <termios.h>
695 #define SYSV
696 #define USE_WAITPID
697 #define SIGNAL_CAST (void (*)(int))
698 char *strdup (char *);
699 #define USE_GETCWD
700 #endif
701
702
703 #ifdef M88K_R3
704 #include <string.h>
705 #include <dirent.h>
706 #include <fcntl.h>
707 #include <termios.h>
708 #define STATFS4
709 #define SYSV
710 #define USE_WAITPID
711 #define SIGNAL_CAST (void (*)(int))
712 char *strdup (char *);
713 #define USE_GETCWD
714 #define NO_FSYNC
715 #define NO_EID
716 #endif
717
718
719 #ifdef DNIX
720 #include <dirent.h>
721 #include <string.h>
722 #include <fcntl.h>
723 #include <sys/statfs.h>
724 #include <sys/stropts.h>
725 #define NO_GET_BROADCAST
726 #define USE_WAITPID
727 #define USE_GETCWD
728 #define USE_SETSID
729 #define STATFS4
730 #define NO_EID
731 #define PF_INET AF_INET
732 #define NO_STRERROR
733 #define ftruncate(f,l) chsize(f,l)
734 #endif /* DNIX */
735
736 #ifdef CONVEX
737 #define SIGNAL_CAST (void (*)(int))
738 #include <netinet/tcp.h>
739 #include <arpa/inet.h>
740 #include <dirent.h>
741 #include <string.h>
742 #include <sys/vfs.h>
743 #include <fcntl.h>
744 #define DONT_REINSTALL_SIG
745 #define USE_SIGBLOCK
746 #define USE_WAITPID
747 #define SIGNAL_CAST (_SigFunc_Ptr_t)
748 #define NO_GETSPNAM
749 #define HAVE_MEMMOVE
750 extern char *mktemp(char *);
751 extern int  fsync(int);
752 extern int  seteuid(uid_t);
753 extern int  setgroups(int, int *);
754 extern int  initgroups(char *, int);
755 extern int  statfs(char *, struct statfs *);
756 extern int  setegid(gid_t);
757 extern int  getopt(int, char *const *, const char *);
758 extern int  chroot(char *);
759 extern int  gettimeofday(struct timeval *, struct timezone *);
760 extern int  gethostname(char *, int);
761 extern char *crypt(char *, char *);
762 extern char *getpass(char *);
763 #endif
764
765
766 #ifdef CRAY
767 #define MAXPATHLEN 1024
768 #include <dirent.h>
769 #include <string.h>
770 #include <fcntl.h>
771 #include <sys/statfs.h>
772 #define SIGNAL_CAST (void (*)(int))
773 #define SIGCLD_IGNORE
774 #define HAVE_FCNTL_LOCK 1
775 #define USE_SETSID
776 #define STATFS4
777 #endif
778
779
780 #ifdef ALTOS
781 #include <unistd.h>
782 #include <string.h>
783 #include <dirent.h>
784 #include <sys/fcntl.h>
785 #include <sys/statfs.h>
786 #define        const
787 #define        uid_t           int
788 #define        gid_t           int
789 #define        mode_t          int
790 #define        ptrdiff_t       int
791 #define HAVE_GETGRNAM  0
792 #define NO_EID
793 #define NO_FSYNC
794 #define        NO_FTRUNCATE
795 #define        NO_GETRLIMIT
796 #define        NO_INITGROUPS
797 #define NO_SELECT
798 #define NO_SETGROUPS
799 #define NO_STRERROR
800 #define NO_STRFTIME
801 #define        NO_TM_NAME
802 #define NO_UTIMEH
803 #define NOSTRCASECMP
804 #define REPLACE_MKTIME
805 #define REPLACE_RENAME
806 #define REPLACE_STRSTR
807 #define STATFS4
808 #define        USE_GETCWD
809 #endif
810
811 #ifdef QNX
812 #define STATFS4
813 #include <sys/statfs.h>
814 #include <sys/select.h>
815 #include <signal.h>
816 #include <sys/dir.h>
817 #define SIGNAL_CAST (void (*)())
818 #define USE_WAITPID
819 #define NO_INITGROUPS
820 #define NO_SETGROUPS
821 #define HAVE_TIMEZONE
822 #define USE_GETCWD
823 #define USE_SETSID
824 #define HAVE_FCNTL_LOCK 1
825 #define DEFAULT_PRINTING PRINT_QNX
826 #endif
827
828
829 #ifdef NEWS42
830 #include <string.h>
831 #include <dirent.h>
832 #include <sys/vfs.h>
833 #include <sys/timeb.h>
834 typedef int mode_t;
835 #endif
836
837 #ifdef OS2
838 #include <dirent.h>
839 #include <sys/statfs.h>
840 #include <string.h>
841 #include <limits.h>
842 #define SIGNAL_CAST (void (*)())
843 #define HAVE_FCNTL_LOCK 0
844 #define USE_WAITPID
845 #define NO_GET_BROADCAST
846 #define NO_EID
847 #define NO_SETGROUPS
848 #define NO_INITGROUPS
849 #define NO_CRYPT
850 #define NO_STATFS
851 #define NO_CHROOT
852 #define NO_CHOWN
853 #define strcasecmp stricmp
854 #define strncasecmp strnicmp
855 #endif
856
857
858 #ifdef LYNX
859 #define SIGNAL_CAST (void (*)())
860 #define WAIT3_CAST1 (union wait *)
861 #define STATFS4
862 #include <fcntl.h>
863 #include <resource.h>
864 #include <stat.h>
865 #include <string.h>
866 #include <dirent.h>
867 #include <sys/statfs.h>
868 #define USE_GETCWD
869 #define USE_GETSID
870 #endif
871
872
873 /*******************************************************************
874 end of the platform specific sections
875 ********************************************************************/
876
877 #ifdef SecureWare
878 #define NEED_AUTH_PARAMETERS
879 #endif
880
881 #ifdef REPLACE_GETPASS
882 extern char    *getsmbpass(char *);
883 #define getpass(s) getsmbpass(s)
884 #endif
885
886 #ifdef REPLACE_INNETGR
887 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
888 #endif
889
890 #ifndef FD_SETSIZE
891 #define FD_SETSIZE 255
892 #endif
893
894 #ifndef MAXINT
895 #define MAXINT ((((unsigned)1)<<(sizeof(int)*8-1))-1)
896 #endif
897
898 #ifndef __STDC__
899 #define const
900 #endif
901
902 /* Now for some other grungy stuff */
903 #ifdef NO_GETSPNAM
904 struct spwd { /* fake shadow password structure */
905        char *sp_pwdp;
906 };
907 #endif
908
909 #ifndef HAVE_BZERO
910 #ifndef bzero
911 #define bzero(p,s) memset(p,0,s)
912 #endif
913 #endif
914
915 #ifndef HAVE_MEMMOVE
916 #ifndef memmove
917 #define memmove(d,s,n) MemMove(d,s,n)
918 #endif
919 #endif
920
921 #ifdef USE_DIRECT
922 #include <sys/dir.h>
923 #endif
924
925 /* some unixes have ENOTTY instead of TIOCNOTTY */
926 #ifndef TIOCNOTTY
927 #ifdef ENOTTY
928 #define TIOCNOTTY ENOTTY
929 #endif
930 #endif
931
932 #ifndef SIGHUP
933 #define SIGHUP 1
934 #endif
935
936 /* if undefined then use bsd or sysv printing */
937 #ifndef DEFAULT_PRINTING
938 #ifdef SYSV
939 #define DEFAULT_PRINTING PRINT_SYSV
940 #else
941 #define DEFAULT_PRINTING PRINT_BSD
942 #endif
943 #endif
944
945
946 #ifdef AFS_AUTH
947 #include <afs/stds.h>
948 #include <afs/kautils.h>
949 #endif
950
951 #ifdef DFS_AUTH
952 #include <dce/dce_error.h>
953 #include <dce/sec_login.h>
954 #endif
955
956 #ifdef NO_UTIMBUF
957 struct utimbuf {
958   time_t actime;
959   time_t modtime;
960 };
961 #endif
962
963 #ifdef NO_STRERROR
964 #ifndef strerror
965 extern char *sys_errlist[];
966 #define strerror(i) sys_errlist[i]
967 #endif
968 #endif
969
970 #ifndef perror
971 #define perror(m) printf("%s: %s\n",m,strerror(errno))
972 #endif
973
974 #ifndef MAXHOSTNAMELEN
975 #define MAXHOSTNAMELEN 255
976 #endif
977
978 #include "version.h"
979 #include "smb.h"
980 #include "byteorder.h"
981 #ifdef SMB_PASSWD
982 #include "smbpass.h"
983 #endif
984
985 #include "kanji.h"
986 #include "charset.h"
987
988 #ifndef S_IFREG
989 #define S_IFREG 0100000
990 #endif
991
992 #ifndef S_ISREG
993 #define S_ISREG(x) ((S_IFREG & x)!=0)
994 #endif
995
996 #ifndef S_ISDIR
997 #define S_ISDIR(x) ((S_IFDIR & x)!=0)
998 #endif
999
1000 #ifdef UFC_CRYPT
1001 #define crypt ufc_crypt
1002 #endif
1003
1004 #ifdef REPLACE_STRLEN
1005 #define strlen(s) Strlen(s)
1006 #endif
1007
1008 #ifdef REPLACE_STRSTR
1009 #define strstr(s,p) Strstr(s,p)
1010 #endif
1011
1012 #ifdef REPLACE_MKTIME
1013 #define mktime(t) Mktime(t)
1014 #endif
1015
1016 #ifndef NGROUPS_MAX
1017 #define NGROUPS_MAX 128
1018 #endif
1019
1020 #ifndef EDQUOT
1021 #define EDQUOT ENOSPC
1022 #endif
1023
1024 #ifndef HAVE_GETGRNAM
1025 #define HAVE_GETGRNAM 1
1026 #endif
1027
1028 #ifndef SOL_TCP
1029 #define SOL_TCP 6
1030 #endif
1031
1032 /* default to using ftruncate workaround as this is safer than assuming
1033 it works and getting lots of bug reports */
1034 #ifndef FTRUNCATE_CAN_EXTEND
1035 #define FTRUNCATE_CAN_EXTEND 0
1036 #endif
1037
1038 /* maybe this unix doesn't separate RD and WR locks? */
1039 #ifndef F_RDLCK
1040 #define F_RDLCK F_WRLCK
1041 #endif
1042
1043 #ifndef ENOTSOCK
1044 #define ENOTSOCK EINVAL
1045 #endif
1046
1047 #ifndef SIGCLD
1048 #define SIGCLD SIGCHLD
1049 #endif 
1050
1051 #ifndef HAVE_FCNTL_LOCK
1052 #define HAVE_FCNTL_LOCK 1
1053 #endif
1054
1055 #ifndef WAIT3_CAST2
1056 #define WAIT3_CAST2 (struct rusage *)
1057 #endif
1058
1059 #ifndef WAIT3_CAST1
1060 #define WAIT3_CAST1 (int *)
1061 #endif
1062
1063 #ifndef QSORT_CAST
1064 #define QSORT_CAST (int (*)())
1065 #endif
1066
1067 /* this is a rough check to see if this machine has a lstat() call.
1068    it is not guaranteed to work */
1069 #if !(defined(S_ISLNK) || defined(S_IFLNK))
1070 #define lstat stat
1071 #endif
1072
1073 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1074 #ifndef errno
1075 extern int errno;
1076 #endif 
1077
1078
1079 #ifdef NO_EID
1080 #define geteuid() getuid()
1081 #define getegid() getgid()
1082 #define seteuid(x) setuid(x)
1083 #define setegid(x) setgid(x)
1084 #endif
1085
1086
1087 #if (HAVE_FCNTL_LOCK == 0)
1088 /* since there is no locking available, system includes  */
1089 /* for DomainOS 10.4 do not contain any of the following */
1090 /* #define's. So, to satisfy the compiler, add these     */
1091 /* #define's, although they arn't really necessary.      */
1092 #define F_GETLK 0
1093 #define F_SETLK 0
1094 #define F_WRLCK 0
1095 #define F_UNLCK 0
1096 #endif /* HAVE_FCNTL_LOCK == 0 */
1097
1098 #ifdef NOSTRCASECMP
1099 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1100 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1101 #endif
1102
1103 #ifndef strcpy
1104 #define strcpy(dest,src) StrCpy(dest,src)
1105 #endif
1106
1107
1108 /* possibly wrap the malloc calls */
1109 #if WRAP_MALLOC
1110
1111 /* undo the old malloc def if necessary */
1112 #ifdef malloc
1113 #define xx_old_malloc malloc
1114 #undef malloc
1115 #endif
1116
1117 #define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
1118
1119 /* undo the old realloc def if necessary */
1120 #ifdef realloc
1121 #define xx_old_realloc realloc
1122 #undef realloc
1123 #endif
1124
1125 #define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
1126
1127 /* undo the old free def if necessary */
1128 #ifdef free
1129 #define xx_old_free free
1130 #undef free
1131 #endif
1132
1133 #define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
1134
1135 /* and the malloc prototypes */
1136 void *malloc_wrapped(int,char *,int);
1137 void *realloc_wrapped(void *,int,char *,int);
1138 void free_wrapped(void *,char *,int);
1139
1140 #endif
1141
1142
1143 #if WRAP_MEMCPY
1144 /* undo the old memcpy def if necessary */
1145 #ifdef memcpy
1146 #define xx_old_memcpy memcpy
1147 #undef memcpy
1148 #endif
1149
1150 #define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
1151 void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
1152 #endif
1153
1154 #endif