Fixes to compile under OpenBSD from "Todd T. Fries" <toddf@acm.org>
[samba.git] / source3 / include / includes.h
1 #ifndef _INCLUDES_H
2 #define _INCLUDES_H
3 /* 
4    Unix SMB/Netbios implementation.
5    Version 1.9.
6    Machine customisation and include handling
7    Copyright (C) Andrew Tridgell 1994-1997
8    
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13    
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18    
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23 /*
24    This file does all the #includes's. This makes it easier to
25    port to a new unix. Hopefully a port will only have to edit the Makefile
26    and add a section for the new unix below.
27 */
28
29
30 /* the first OS dependent section is to setup what includes will be used.
31    the main OS dependent section comes later on 
32 */
33
34 #ifdef ALTOS
35 #define NO_UTIMEH
36 #endif
37
38 #ifdef MIPS
39 #define POSIX_H
40 #define NO_UTIMEH
41 #endif
42
43 #ifdef sun386
44 #define NO_UTIMEH
45 #endif
46
47 #ifdef NEXT2
48 #define NO_UTIMEH
49 #endif
50
51 #ifdef NEXT3_0
52 #define NO_UTIMEH
53 #define NO_UNISTDH
54 #endif
55
56 #ifdef APOLLO
57 #define NO_UTIMEH
58 #define NO_SYSMOUNTH
59 #define NO_UNISTDH
60 #endif
61
62 #ifdef AIX
63 #define NO_SYSMOUNTH
64 #endif
65
66 #ifdef M88K_R3
67 #define SVR3H
68 #define NO_RESOURCEH
69 #endif
70
71 #ifdef DNIX
72 #define NO_SYSMOUNTH
73 #define NO_NETIFH
74 #define NO_RESOURCEH
75 #define PRIME_NMBD 0
76 #define NO_SETGROUPS
77 #endif
78
79
80 #ifdef ISC
81 #define SYSSTREAMH
82 #define NO_RESOURCEH
83 #endif
84
85 #ifdef QNX
86 #define NO_RESOURCEH
87 #define NO_SYSMOUNTH
88 #define USE_MMAP 1
89 #ifdef __386__
90    #define __i386__
91 #endif
92 #endif
93
94 #ifdef NEWS42
95 #define NO_UTIMEH
96 #define NO_STRFTIME
97 #define NO_UTIMBUF
98 #define REPLACE_MKTIME
99 #define NO_TM_NAME
100 #endif
101
102 #ifdef OS2
103 #define NO_SYSMOUNTH
104 #define NO_NETIFH
105 #endif
106
107 #ifdef LYNX
108 #define NO_SYSMOUNTH
109 #endif
110
111
112 #if (defined(SHADOW_PWD)||defined(OSF1_ENH_SEC)||defined(SecureWare)||defined(PWDAUTH))
113 #define PASSWORD_LENGTH 16
114 #endif
115
116 /* here is the general includes section - with some ifdefs generated 
117    by the previous section 
118 */
119 #include "local.h"
120 #include <stdio.h>
121 #ifdef POSIX_STDLIBH
122 #include <posix/stdlib.h>
123 #else
124 #include <stdlib.h>
125 #endif
126 #include <ctype.h>
127 #include <time.h>
128 #ifndef NO_UTIMEH
129 #include <utime.h>
130 #endif
131 #include <sys/types.h>
132
133 #ifdef SVR3H
134 #include <sys/statfs.h>
135 #include <sys/stream.h>
136 #include <netinet/types.h>
137 #include <netinet/ether.h>
138 #include <netinet/ip_if.h>
139 #endif
140
141 #include <sys/socket.h>
142 #ifdef AXPROC
143 #include <termio.h>
144 #endif
145 #include <sys/ioctl.h>
146 #include <stddef.h>
147 #ifdef POSIX_H
148 #include <posix/utime.h>
149 #include <bsd/sys/time.h>
150 #include <bsd/netinet/in.h>
151 #else
152 #include <sys/time.h>
153 #include <netinet/in.h>
154 #endif 
155 #include <netdb.h>
156 #include <signal.h>
157 #include <errno.h>
158 #include <sys/file.h>
159 #include <sys/stat.h>
160 #include <sys/param.h>
161 #include <grp.h>
162 #ifndef NO_RESOURCEH
163 #include <sys/resource.h>
164 #endif
165 #ifndef NO_SYSMOUNTH
166 #include <sys/mount.h>
167 #endif
168 #include <pwd.h>
169 #ifdef __STDC__
170 #include <stdarg.h>
171 #else
172 #include <varargs.h>
173 #endif
174 #ifndef NO_UNISTDH
175 #include <unistd.h>
176 #endif
177 #include <sys/wait.h>
178 #ifdef SYSSTREAMH
179 #include <sys/stream.h>
180 #endif
181 #ifndef NO_NETIFH
182 #ifdef POSIX_H
183 #include <bsd/net/if.h>
184 #else
185 #include <net/if.h>
186 #endif
187 #endif
188
189 #if defined(GETPWANAM)
190 #include <sys/types.h>
191 #include <sys/label.h>
192 #include <sys/audit.h>
193 #include <pwdadj.h>
194 #endif
195
196 #if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX) && !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 #define SIGNAL_CAST (void (*)())
514 #define USE_SETVBUF
515 #define USE_SETSID
516 #define USE_GETCWD
517 #define USE_WAITPID
518 #define USE_DIRECT
519 #define HAVE_MEMMOVE
520 #define HAVE_BZERO
521 #define HAVE_GETTIMEOFDAY
522 #define HAVE_PATHCONF
523 #define HAVE_GETGRNAM 1
524 #endif 
525
526 #ifdef __OpenBSD__
527 #include <strings.h>
528 #include <netinet/tcp.h>
529 #define NO_GETSPNAM
530 #define SIGNAL_CAST (void (*)())
531 #define USE_DIRECT
532 #define REPLACE_INNETGR
533 #define HAVE_BZERO
534 #define HAVE_PATHCONF
535 #define HAVE_GETGRNAM 1
536 #define HAVE_GETTIMEOFDAY
537 #define HAVE_MEMMOVE
538 #define USE_GETCWD
539 #define USE_SETSID
540 #endif 
541
542 #ifdef AIX
543 #include <strings.h>
544 #include <sys/dir.h>
545 #include <sys/select.h>
546 #include <dirent.h>
547 #include <sys/statfs.h>
548 #include <sys/vfs.h>
549 #include <sys/id.h>
550 #include <sys/priv.h>
551 #include <netinet/tcp.h>
552 #include <locale.h>
553 #define SYSV
554 #define USE_WAITPID
555 #define USE_SIGBLOCK
556 #define SIGNAL_CAST (void (*)())
557 #define DEFAULT_PRINTING PRINT_AIX
558 /* we undef this because sys/param.h is broken in aix. uggh. */
559 #undef MAXHOSTNAMELEN
560 #endif
561
562
563 #ifdef HPUX
564 #include <string.h>
565 #include <dirent.h>
566 #include <fcntl.h>
567 #include <sys/vfs.h>
568 #include <sys/types.h>
569 #include <sys/termios.h>
570 #include <netinet/tcp.h>
571 #ifdef HPUX_10_TRUSTED
572 #include <hpsecurity.h>
573 #include <prot.h>
574 #define NEED_AUTH_PARAMETERS
575 #endif
576 #define SIGNAL_CAST (void (*)(__harg))
577 #ifndef HPUX10 /* This is only needed for HPUX 9.x */
578 #define SELECT_CAST (int *)
579 #endif /* HPUX10 */
580 #define SYSV
581 #define USE_WAITPID
582 #define WAIT3_CAST2 (int *)
583 #define USE_GETCWD
584 #define USE_SETSID
585 #define USE_SETRES
586 #define USE_SYSV_IPC
587 #define NO_SEMUN
588 #define DEFAULT_PRINTING PRINT_HPUX
589 /* Ken Weiss <krweiss@ucdavis.edu> tells us that SIGCLD_IGNORE is
590    not good for HPUX */
591 /* #define SIGCLD_IGNORE */
592 #endif /* HPUX */
593
594
595 #ifdef SEQUENT
596 #include <signal.h>
597 #include <string.h>
598 #include <dirent.h>
599 #include <sys/types.h>
600 #include <sys/statfs.h>
601 #include <sys/stat.h>
602 #include <sys/buf.h>
603 #include <sys/socket.h>
604 #include <unistd.h>
605 #include <fcntl.h>
606 #define SIGNAL_CAST (void (*)(int))
607 #define USE_WAITPID
608 #define USE_GETCWD
609 #define NO_EID
610 #define STATFS4
611 #define USE_DIRECT
612 #ifdef PTX4
613 #undef USE_DIRECT
614 #endif
615 #endif
616
617
618
619 #ifdef SEQUENT_PTX4
620 #include <string.h>
621 #include <sys/dir.h>
622 #include <dirent.h>
623 #include <sys/statfs.h>
624 #include <sys/statvfs.h>
625 #include <sys/vfs.h>
626 #include <fcntl.h>
627 #include <sys/sockio.h>
628 #include <netinet/tcp.h>
629 #include <stropts.h>
630 #include <termios.h>
631 #define SYSV
632 #define USE_WAITPID
633 #define SIGNAL_CAST (void (*)(int))
634 #define USE_STATVFS
635 #define USE_GETCWD
636 #ifndef seteuid
637 #define seteuid(uid) setreuid(-1,uid)
638 #endif
639 #ifndef setegid
640 #define setegid(gid) setregid(-1,gid)
641 #endif
642 #endif
643
644
645 #ifdef NEXT2
646 #include <sys/types.h>
647 #include <strings.h>
648 #include <dirent.h>
649 #include <sys/vfs.h>
650 #define bzero(b,len) memset(b,0,len)
651 #define mode_t int
652 #define NO_UTIMBUF
653 #include <libc.h>
654 #define NOSTRDUP
655 #define USE_DIRECT
656 #define USE_WAITPID
657 #endif 
658
659
660 #ifdef NEXT3_0
661 #include <strings.h>
662 #include <sys/dir.h>
663 #include <sys/vfs.h>
664 #define bzero(b,len) memset(b,0,len)
665 #define NO_UTIMBUF
666 #include <libc.h>
667 #define NOSTRDUP
668 #define USE_DIRECT
669 #define mode_t int
670 #define GID_TYPE int
671 #define gid_t int
672 #define pid_t int
673 #define SIGNAL_CAST (void (*)(int))
674 #define WAIT3_CAST1 (union wait *)
675 #define HAVE_GMTOFF
676 #endif
677
678
679
680 #ifdef APOLLO
681 #include <string.h>
682 #include <fcntl.h>
683 #include <sys/statfs.h>
684 #define NO_UTIMBUF
685 #define USE_DIRECT
686 #define USE_GETCWD
687 #define SIGNAL_CAST     (void (*)())
688 #define HAVE_FCNTL_LOCK 0
689 #define HAVE_GETTIMEOFDAY
690 #define STATFS4
691 #endif
692
693
694
695 #ifdef SCO
696 #include <sys/netinet/tcp.h>
697 #include <sys/netinet/in_systm.h>
698 #include <sys/netinet/ip.h>
699 #include <dirent.h>
700 #include <string.h>
701 #include <termios.h>
702 #include <fcntl.h>
703 #include <sys/statfs.h>
704 #include <sys/stropts.h>
705 #include <limits.h>
706 #include <locale.h>
707 #ifdef EVEREST
708 #include <unistd.h> 
709 #endif /* EVEREST */
710 #ifdef NETGROUP
711 #include <rpcsvc/ypclnt.h>
712 #endif /* NETGROUP */
713 #ifdef SecureWare
714 #include <sys/security.h>
715 #include <sys/audit.h>
716 #include <prot.h>
717 #define crypt bigcrypt
718 #endif /* SecureWare */
719 #define SIGNAL_CAST (void (*)(int))
720 #define USE_WAITPID
721 #define USE_GETCWD
722 #define USE_SETSID
723 #ifdef SCO3_2_2
724 #define setuid(u) setreuid(u,-1)
725 #define seteuid(u) setreuid(-1,u)
726 #else /* SCO3_2_2 */
727 #ifndef EVEREST
728 #define ftruncate(f,l) syscall(0x0a28,f,l)
729 #define USE_IFREQ
730 #define NO_INITGROUPS
731 #endif /* EVEREST */
732 #endif /* SCO3_2_2 */
733 #define STATFS4
734 #define NO_FSYNC
735 #define HAVE_PATHCONF
736 #define NO_GETRLIMIT
737 #endif /* SCO */
738
739
740
741 /* Definitions for RiscIX */
742 #ifdef RiscIX
743 #define SIGNAL_CAST (void (*)(int))
744 #include <sys/dirent.h>
745 #include <sys/acct.h>
746 #include <sys/vfs.h>
747 #include <string.h>
748 #include <utime.h>
749 #include <signal.h>
750 #define HAVE_GETTIMEOFDAY
751 #define NOSTRCASECMP
752 #define NOSTRDUP
753 #endif
754
755
756
757 #ifdef ISC
758 #include <net/errno.h>
759 #include <string.h>
760 #include <sys/dir.h>
761 #include <dirent.h>
762 #include <sys/statfs.h>
763 #include <fcntl.h>
764 #include <sys/sioctl.h>
765 #include <stropts.h>
766 #include <limits.h>
767 #include <netinet/tcp.h>
768 #define FIONREAD FIORDCHK
769 #define SYSV
770 #define USE_WAITPID
771 #define SIGNAL_CAST (void (*)(int))
772 #define USE_GETCWD
773 #define USE_SETSID
774 #define USE_IFREQ
775 #define NO_FTRUNCATE
776 #define STATFS4
777 #define NO_FSYNC
778 #endif
779
780
781
782 #ifdef AUX
783 #include <fstab.h>
784 #include <string.h>
785 #include <dirent.h>
786 #include <sys/vfs.h>
787 #include <fcntl.h>
788 #include <termios.h>
789 #define SYSV
790 #define USE_WAITPID
791 #define SIGNAL_CAST (void (*)(int))
792 char *strdup (char *);
793 #define USE_GETCWD
794 #endif
795
796
797 #ifdef M88K_R3
798 #include <string.h>
799 #include <dirent.h>
800 #include <fcntl.h>
801 #include <termios.h>
802 #define STATFS4
803 #define SYSV
804 #define USE_WAITPID
805 #define SIGNAL_CAST (void (*)(int))
806 char *strdup (char *);
807 #define USE_GETCWD
808 #define NO_FSYNC
809 #define NO_EID
810 #endif
811
812
813 #ifdef DNIX
814 #include <dirent.h>
815 #include <string.h>
816 #include <fcntl.h>
817 #include <sys/statfs.h>
818 #include <sys/stropts.h>
819 #define NO_GET_BROADCAST
820 #define USE_WAITPID
821 #define USE_GETCWD
822 #define USE_SETSID
823 #define STATFS4
824 #define NO_EID
825 #define PF_INET AF_INET
826 #define NO_STRERROR
827 #define ftruncate(f,l) chsize(f,l)
828 #endif /* DNIX */
829
830 #ifdef CONVEX
831 #include <netinet/tcp.h>
832 #include <arpa/inet.h>
833 #include <dirent.h>
834 #include <string.h>
835 #include <sys/vfs.h>
836 #include <fcntl.h>
837 #define DONT_REINSTALL_SIG
838 #define USE_SIGBLOCK
839 #define USE_WAITPID
840 #define SIGNAL_CAST (_SigFunc_Ptr_t)
841 #define NO_GETSPNAM
842 #define HAVE_MEMMOVE
843 extern char *mktemp(char *);
844 extern int  fsync(int);
845 extern int  seteuid(uid_t);
846 extern int  setgroups(int, int *);
847 extern int  initgroups(char *, int);
848 extern int  statfs(char *, struct statfs *);
849 extern int  setegid(gid_t);
850 extern int  getopt(int, char *const *, const char *);
851 extern int  chroot(char *);
852 extern int  gettimeofday(struct timeval *, struct timezone *);
853 extern int  gethostname(char *, int);
854 extern char *crypt(char *, char *);
855 extern char *getpass(char *);
856 #endif
857
858
859 #ifdef CRAY
860 #define MAXPATHLEN 1024
861 #include <dirent.h>
862 #include <string.h>
863 #include <fcntl.h>
864 #include <sys/statfs.h>
865 #define SIGNAL_CAST (void (*)(int))
866 #define SIGCLD_IGNORE
867 #define HAVE_FCNTL_LOCK 1
868 #define USE_SETSID
869 #define STATFS4
870 #endif
871
872
873 #ifdef ALTOS
874 #include <unistd.h>
875 #include <string.h>
876 #include <dirent.h>
877 #include <sys/fcntl.h>
878 #include <sys/statfs.h>
879 #define        const
880 #define        uid_t           int
881 #define        gid_t           int
882 #define        mode_t          int
883 #define        ptrdiff_t       int
884 #define HAVE_GETGRNAM  0
885 #define NO_EID
886 #define NO_FSYNC
887 #define        NO_FTRUNCATE
888 #define        NO_GETRLIMIT
889 #define        NO_INITGROUPS
890 #define NO_SELECT
891 #define NO_SETGROUPS
892 #define NO_STRERROR
893 #define NO_STRFTIME
894 #define        NO_TM_NAME
895 #define NO_UTIMEH
896 #define NOSTRCASECMP
897 #define REPLACE_MKTIME
898 #define REPLACE_RENAME
899 #define REPLACE_STRSTR
900 #define STATFS4
901 #define        USE_GETCWD
902 #endif
903
904 #ifdef QNX
905 #define STATFS4
906 #include <sys/statfs.h>
907 #include <sys/select.h>
908 #include <signal.h>
909 #include <sys/dir.h>
910 #define SIGNAL_CAST (void (*)())
911 #define USE_WAITPID
912 #define NO_INITGROUPS
913 #define NO_SETGROUPS
914 #define HAVE_TIMEZONE
915 #define USE_GETCWD
916 #define USE_SETSID
917 #define HAVE_FCNTL_LOCK 1
918 #define DEFAULT_PRINTING PRINT_QNX
919 #endif
920
921
922 #ifdef NEWS42
923 #include <string.h>
924 #include <dirent.h>
925 #include <sys/vfs.h>
926 #include <sys/timeb.h>
927 typedef int mode_t;
928 #endif
929
930 #ifdef OS2
931 #include <dirent.h>
932 #include <sys/statfs.h>
933 #include <string.h>
934 #include <limits.h>
935 #define SIGNAL_CAST (void (*)())
936 #define HAVE_FCNTL_LOCK 0
937 #define USE_WAITPID
938 #define NO_GET_BROADCAST
939 #define NO_EID
940 #define NO_SETGROUPS
941 #define NO_INITGROUPS
942 #define NO_CRYPT
943 #define NO_STATFS
944 #define NO_CHROOT
945 #define NO_CHOWN
946 #define strcasecmp stricmp
947 #define strncasecmp strnicmp
948 #endif
949
950
951 #ifdef LYNX
952 #define SIGNAL_CAST (void (*)())
953 #define WAIT3_CAST1 (union wait *)
954 #define STATFS4
955 #include <fcntl.h>
956 #include <resource.h>
957 #include <stat.h>
958 #include <string.h>
959 #include <dirent.h>
960 #include <sys/statfs.h>
961 #define USE_GETCWD
962 #define USE_GETSID
963 #endif
964
965
966 #ifdef BOS
967 #define SIGNAL_CAST (void (*)(int))
968 #include <string.h>
969 #include <sys/dir.h>
970 #include <sys/select.h>
971 #include <dirent.h>
972 #include <fcntl.h>
973 #include <signal.h>
974 #include <sys/statfs.h>
975 #include <sys/bsdioctl.h>
976 #endif
977
978 #ifdef AMIGA
979 #include <arpa/inet.h>
980 #include <dirent.h>
981 #include <string.h>
982 #include <netinet/tcp.h>
983 #include <sys/acct.h>
984 #include <sys/fcntl.h>
985 #include <sys/filio.h>
986 #include <sys/sockio.h>
987 #include <netinet/in_systm.h>
988 #include <netinet/ip.h>
989 #include <sys/termios.h>
990 #include <limits.h>
991 #include <sys/timeb.h>
992
993 #define SIGNAL_CAST (void (*)(int))
994 #define USE_GETCWD
995 #define HAVE_BZERO
996 #define HAVE_MEMMOVE
997 #define USE_SIGPROCMASK
998 #define USE_WAITPID
999 #define USE_DIRECT
1000 #define USE_F_FSIZE
1001 #define HAVE_FCNTL_LOCK 0
1002 #define HAVE_GETTIMEOFDAY
1003 #define HAVE_PATHCONF
1004
1005 #define HAVE_NO_PROC
1006 #define NO_FORK_DEBUG
1007 #define HAVE_FORK 0
1008 #define HAVE_VFORK 1
1009 #endif
1010
1011 /* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
1012 #ifdef IA_UINFO
1013 #include <iaf.h>
1014 #include <ia.h>
1015 #endif
1016
1017
1018 /*******************************************************************
1019 end of the platform specific sections
1020 ********************************************************************/
1021
1022 #if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
1023 #include <sys/mman.h>
1024 #endif
1025
1026 #ifdef SecureWare
1027 #define NEED_AUTH_PARAMETERS
1028 #endif
1029
1030 #ifdef REPLACE_GETPASS
1031 extern char    *getsmbpass(char *);
1032 #define getpass(s) getsmbpass(s)
1033 #endif
1034
1035 #ifdef REPLACE_INNETGR
1036 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
1037 #endif
1038
1039 #ifndef FD_SETSIZE
1040 #define FD_SETSIZE 255
1041 #endif
1042
1043 #ifndef __STDC__
1044 #define const
1045 #endif
1046
1047 /* Now for some other grungy stuff */
1048 #ifdef NO_GETSPNAM
1049 struct spwd { /* fake shadow password structure */
1050        char *sp_pwdp;
1051 };
1052 #endif
1053
1054 #ifndef HAVE_BZERO
1055 #ifndef bzero
1056 #define bzero(p,s) memset(p,0,s)
1057 #endif
1058 #endif
1059
1060 #ifndef HAVE_MEMMOVE
1061 #ifndef memmove
1062 #define memmove(d,s,n) MemMove(d,s,n)
1063 #endif
1064 #endif
1065
1066 #ifdef USE_DIRECT
1067 #include <sys/dir.h>
1068 #endif
1069
1070 /* some unixes have ENOTTY instead of TIOCNOTTY */
1071 #ifndef TIOCNOTTY
1072 #ifdef ENOTTY
1073 #define TIOCNOTTY ENOTTY
1074 #endif
1075 #endif
1076
1077 #ifndef SIGHUP
1078 #define SIGHUP 1
1079 #endif
1080
1081 /* if undefined then use bsd or sysv printing */
1082 #ifndef DEFAULT_PRINTING
1083 #ifdef SYSV
1084 #define DEFAULT_PRINTING PRINT_SYSV
1085 #else
1086 #define DEFAULT_PRINTING PRINT_BSD
1087 #endif
1088 #endif
1089
1090 /* This defines the name of the printcap file. It is MOST UNLIKELY that
1091    this will change BUT! Specifying a file with the format of a printcap
1092    file but containing only a subset of the printers actually in your real 
1093    printcap file is a quick-n-dirty way to allow dynamic access to a subset
1094    of available printers.
1095 */
1096 #ifndef PRINTCAP_NAME
1097 #ifdef AIX
1098 #define PRINTCAP_NAME "/etc/qconfig"
1099 #elif defined(SYSV)
1100 #define PRINTCAP_NAME "lpstat"
1101 #else
1102 #define PRINTCAP_NAME "/etc/printcap"
1103 #endif
1104 #endif
1105
1106
1107 #ifdef USE_SYSV_IPC
1108 #include <sys/ipc.h>
1109 #include <sys/sem.h>
1110 #include <sys/shm.h>
1111 #ifdef NO_SEMUN
1112 union semun {
1113         int val;
1114         struct semid_ds *buf;
1115         unsigned short *array;
1116 };
1117 #endif
1118 #endif
1119
1120 #ifdef AFS_AUTH
1121 #include <afs/stds.h>
1122 #include <afs/kautils.h>
1123 #endif
1124
1125 #ifdef DFS_AUTH
1126 #include <dce/dce_error.h>
1127 #include <dce/sec_login.h>
1128 #endif
1129
1130 #ifdef KRB5_AUTH
1131 #include <krb5.h>
1132 #endif
1133
1134 #ifdef NO_UTIMBUF
1135 struct utimbuf {
1136   time_t actime;
1137   time_t modtime;
1138 };
1139 #endif
1140
1141 #ifdef NO_STRERROR
1142 #ifndef strerror
1143 extern char *sys_errlist[];
1144 #define strerror(i) sys_errlist[i]
1145 #endif
1146 #endif
1147
1148 #ifndef perror
1149 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1150 #endif
1151
1152 #ifndef MAXHOSTNAMELEN
1153 #define MAXHOSTNAMELEN 255
1154 #endif
1155
1156 #include "version.h"
1157 #include "smb.h"
1158 #include "nameserv.h"
1159 #include "ubiqx/ubi_dLinkList.h"
1160
1161 #include "byteorder.h"
1162
1163 #include "kanji.h"
1164 #include "charset.h"
1165
1166 /***** automatically generated prototypes *****/
1167 #include "proto.h"
1168
1169
1170
1171 #ifndef S_IFREG
1172 #define S_IFREG 0100000
1173 #endif
1174
1175 #ifndef S_ISREG
1176 #define S_ISREG(x) ((S_IFREG & (x))!=0)
1177 #endif
1178
1179 #ifndef S_ISDIR
1180 #define S_ISDIR(x) ((S_IFDIR & (x))!=0)
1181 #endif
1182
1183 #if !defined(S_ISLNK) && defined(S_IFLNK)
1184 #define S_ISLNK(x) ((S_IFLNK & (x))!=0)
1185 #endif
1186
1187 #ifdef UFC_CRYPT
1188 #define crypt ufc_crypt
1189 #endif
1190
1191 #ifdef REPLACE_STRLEN
1192 #define strlen(s) Strlen(s)
1193 #endif
1194
1195 #ifdef REPLACE_STRSTR
1196 #define strstr(s,p) Strstr(s,p)
1197 #endif
1198
1199 #ifdef REPLACE_MKTIME
1200 #define mktime(t) Mktime(t)
1201 #endif
1202
1203 #ifndef NGROUPS_MAX
1204 #define NGROUPS_MAX 128
1205 #endif
1206
1207 #ifndef EDQUOT
1208 #define EDQUOT ENOSPC
1209 #endif
1210
1211 #ifndef HAVE_GETGRNAM
1212 #define HAVE_GETGRNAM 1
1213 #endif
1214
1215 #ifndef SOL_TCP
1216 #define SOL_TCP 6
1217 #endif
1218
1219 /* default to using ftruncate workaround as this is safer than assuming
1220 it works and getting lots of bug reports */
1221 #ifndef FTRUNCATE_CAN_EXTEND
1222 #define FTRUNCATE_CAN_EXTEND 0
1223 #endif
1224
1225 /* maybe this unix doesn't separate RD and WR locks? */
1226 #ifndef F_RDLCK
1227 #define F_RDLCK F_WRLCK
1228 #endif
1229
1230 #ifndef ENOTSOCK
1231 #define ENOTSOCK EINVAL
1232 #endif
1233
1234 #ifndef SIGCLD
1235 #define SIGCLD SIGCHLD
1236 #endif 
1237
1238 #ifndef MAP_FILE
1239 #define MAP_FILE 0
1240 #endif
1241
1242 #ifndef HAVE_FCNTL_LOCK
1243 #define HAVE_FCNTL_LOCK 1
1244 #endif
1245
1246 #ifndef WAIT3_CAST2
1247 #define WAIT3_CAST2 (struct rusage *)
1248 #endif
1249
1250 #ifndef WAIT3_CAST1
1251 #define WAIT3_CAST1 (int *)
1252 #endif
1253
1254 #ifndef QSORT_CAST
1255 #define QSORT_CAST (int (*)())
1256 #endif
1257
1258 #ifndef INADDR_LOOPBACK
1259 #define INADDR_LOOPBACK 0x7f000001
1260 #endif /* INADDR_LOOPBACK */
1261
1262 /* this is a rough check to see if this machine has a lstat() call.
1263    it is not guaranteed to work */
1264 #if !defined(S_ISLNK)
1265 #define lstat stat
1266 #endif
1267
1268 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1269 #ifndef errno
1270 extern int errno;
1271 #endif 
1272
1273
1274 #ifdef NO_EID
1275 #define geteuid() getuid()
1276 #define getegid() getgid()
1277 #define seteuid(x) setuid(x)
1278 #define setegid(x) setgid(x)
1279 #endif
1280
1281
1282 #if (HAVE_FCNTL_LOCK == 0)
1283 /* since there is no locking available, system includes  */
1284 /* for DomainOS 10.4 do not contain any of the following */
1285 /* #define's. So, to satisfy the compiler, add these     */
1286 /* #define's, although they arn't really necessary.      */
1287 #define F_GETLK 0
1288 #define F_SETLK 0
1289 #define F_WRLCK 0
1290 #define F_UNLCK 0
1291 #endif /* HAVE_FCNTL_LOCK == 0 */
1292
1293 #ifdef NOSTRCASECMP
1294 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1295 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1296 #endif
1297
1298 #ifndef strcpy
1299 #define strcpy(dest,src) StrCpy(dest,src)
1300 #endif
1301
1302 #if MEM_MAN
1303 #include "mem_man/mem_man.h"
1304 #endif
1305
1306 #endif