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