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