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