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