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