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