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