put the default PRINTCAP_NAME def in includes.h not local.h so that
[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-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 #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
527
528 #ifdef AIX
529 #include <strings.h>
530 #include <sys/dir.h>
531 #include <sys/select.h>
532 #include <dirent.h>
533 #include <sys/statfs.h>
534 #include <sys/vfs.h>
535 #include <sys/id.h>
536 #include <sys/priv.h>
537 #include <netinet/tcp.h>
538 #include <locale.h>
539 #define SYSV
540 #define USE_WAITPID
541 #define USE_SIGBLOCK
542 #define SIGNAL_CAST (void (*)())
543 #define DEFAULT_PRINTING PRINT_AIX
544 /* we undef this because sys/param.h is broken in aix. uggh. */
545 #undef MAXHOSTNAMELEN
546 #endif
547
548
549 #ifdef HPUX
550 #include <string.h>
551 #include <dirent.h>
552 #include <fcntl.h>
553 #include <sys/vfs.h>
554 #include <sys/types.h>
555 #include <sys/termios.h>
556 #include <netinet/tcp.h>
557 #ifdef HPUX_10_TRUSTED
558 #include <hpsecurity.h>
559 #include <prot.h>
560 #define NEED_AUTH_PARAMETERS
561 #endif
562 #define SIGNAL_CAST (void (*)(__harg))
563 #ifndef HPUX10 /* This is only needed for HPUX 9.x */
564 #define SELECT_CAST (int *)
565 #endif /* HPUX10 */
566 #define SYSV
567 #define USE_WAITPID
568 #define WAIT3_CAST2 (int *)
569 #define USE_GETCWD
570 #define USE_SETSID
571 #define USE_SETRES
572 #define USE_SYSV_IPC
573 #define NO_SEMUN
574 #define DEFAULT_PRINTING PRINT_HPUX
575 /* Ken Weiss <krweiss@ucdavis.edu> tells us that SIGCLD_IGNORE is
576    not good for HPUX */
577 /* #define SIGCLD_IGNORE */
578 #endif /* HPUX */
579
580
581 #ifdef SEQUENT
582 #include <signal.h>
583 #include <string.h>
584 #include <dirent.h>
585 #include <sys/types.h>
586 #include <sys/statfs.h>
587 #include <sys/stat.h>
588 #include <sys/buf.h>
589 #include <sys/socket.h>
590 #include <unistd.h>
591 #include <fcntl.h>
592 #define SIGNAL_CAST (void (*)(int))
593 #define USE_WAITPID
594 #define USE_GETCWD
595 #define NO_EID
596 #define STATFS4
597 #define USE_DIRECT
598 #ifdef PTX4
599 #undef USE_DIRECT
600 #endif
601 #endif
602
603
604
605 #ifdef SEQUENT_PTX4
606 #include <string.h>
607 #include <sys/dir.h>
608 #include <dirent.h>
609 #include <sys/statfs.h>
610 #include <sys/statvfs.h>
611 #include <sys/vfs.h>
612 #include <fcntl.h>
613 #include <sys/sockio.h>
614 #include <netinet/tcp.h>
615 #include <stropts.h>
616 #include <termios.h>
617 #define SYSV
618 #define USE_WAITPID
619 #define SIGNAL_CAST (void (*)(int))
620 #define USE_STATVFS
621 #define USE_GETCWD
622 #ifndef seteuid
623 #define seteuid(uid) setreuid(-1,uid)
624 #endif
625 #ifndef setegid
626 #define setegid(gid) setregid(-1,gid)
627 #endif
628 #endif
629
630
631 #ifdef NEXT2
632 #include <sys/types.h>
633 #include <strings.h>
634 #include <dirent.h>
635 #include <sys/vfs.h>
636 #define bzero(b,len) memset(b,0,len)
637 #define mode_t int
638 #define NO_UTIMBUF
639 #include <libc.h>
640 #define NOSTRDUP
641 #define USE_DIRECT
642 #define USE_WAITPID
643 #endif 
644
645
646 #ifdef NEXT3_0
647 #include <strings.h>
648 #include <sys/dir.h>
649 #include <sys/vfs.h>
650 #define bzero(b,len) memset(b,0,len)
651 #define NO_UTIMBUF
652 #include <libc.h>
653 #define NOSTRDUP
654 #define USE_DIRECT
655 #define mode_t int
656 #define GID_TYPE int
657 #define gid_t int
658 #define pid_t int
659 #define SIGNAL_CAST (void (*)(int))
660 #define WAIT3_CAST1 (union wait *)
661 #define HAVE_GMTOFF
662 #endif
663
664
665
666 #ifdef APOLLO
667 #include <string.h>
668 #include <fcntl.h>
669 #include <sys/statfs.h>
670 #define NO_UTIMBUF
671 #define USE_DIRECT
672 #define USE_GETCWD
673 #define SIGNAL_CAST     (void (*)())
674 #define HAVE_FCNTL_LOCK 0
675 #define HAVE_GETTIMEOFDAY
676 #define STATFS4
677 #endif
678
679
680
681 #ifdef SCO
682 #include <sys/netinet/tcp.h>
683 #include <sys/netinet/in_systm.h>
684 #include <sys/netinet/ip.h>
685 #include <dirent.h>
686 #include <string.h>
687 #include <termios.h>
688 #include <fcntl.h>
689 #include <sys/statfs.h>
690 #include <sys/stropts.h>
691 #include <limits.h>
692 #include <locale.h>
693 #ifdef EVEREST
694 #include <unistd.h> 
695 #endif /* EVEREST */
696 #ifdef NETGROUP
697 #include <rpcsvc/ypclnt.h>
698 #endif /* NETGROUP */
699 #ifdef SecureWare
700 #include <sys/security.h>
701 #include <sys/audit.h>
702 #include <prot.h>
703 #define crypt bigcrypt
704 #endif /* SecureWare */
705 #define SIGNAL_CAST (void (*)(int))
706 #define USE_WAITPID
707 #define USE_GETCWD
708 #define USE_SETSID
709 #ifdef SCO3_2_2
710 #define setuid(u) setreuid(u,-1)
711 #define seteuid(u) setreuid(-1,u)
712 #else /* SCO3_2_2 */
713 #ifndef EVEREST
714 #define ftruncate(f,l) syscall(0x0a28,f,l)
715 #define USE_IFREQ
716 #define NO_INITGROUPS
717 #endif /* EVEREST */
718 #endif /* SCO3_2_2 */
719 #define STATFS4
720 #define NO_FSYNC
721 #define HAVE_PATHCONF
722 #define NO_GETRLIMIT
723 #endif /* SCO */
724
725
726
727 /* Definitions for RiscIX */
728 #ifdef RiscIX
729 #define SIGNAL_CAST (void (*)(int))
730 #include <sys/dirent.h>
731 #include <sys/acct.h>
732 #include <sys/vfs.h>
733 #include <string.h>
734 #include <utime.h>
735 #include <signal.h>
736 #define HAVE_GETTIMEOFDAY
737 #define NOSTRCASECMP
738 #define NOSTRDUP
739 #endif
740
741
742
743 #ifdef ISC
744 #include <net/errno.h>
745 #include <string.h>
746 #include <sys/dir.h>
747 #include <dirent.h>
748 #include <sys/statfs.h>
749 #include <fcntl.h>
750 #include <sys/sioctl.h>
751 #include <stropts.h>
752 #include <limits.h>
753 #include <netinet/tcp.h>
754 #define FIONREAD FIORDCHK
755 #define SYSV
756 #define USE_WAITPID
757 #define SIGNAL_CAST (void (*)(int))
758 #define USE_GETCWD
759 #define USE_SETSID
760 #define USE_IFREQ
761 #define NO_FTRUNCATE
762 #define STATFS4
763 #define NO_FSYNC
764 #endif
765
766
767
768 #ifdef AUX
769 #include <fstab.h>
770 #include <string.h>
771 #include <dirent.h>
772 #include <sys/vfs.h>
773 #include <fcntl.h>
774 #include <termios.h>
775 #define SYSV
776 #define USE_WAITPID
777 #define SIGNAL_CAST (void (*)(int))
778 char *strdup (char *);
779 #define USE_GETCWD
780 #endif
781
782
783 #ifdef M88K_R3
784 #include <string.h>
785 #include <dirent.h>
786 #include <fcntl.h>
787 #include <termios.h>
788 #define STATFS4
789 #define SYSV
790 #define USE_WAITPID
791 #define SIGNAL_CAST (void (*)(int))
792 char *strdup (char *);
793 #define USE_GETCWD
794 #define NO_FSYNC
795 #define NO_EID
796 #endif
797
798
799 #ifdef DNIX
800 #include <dirent.h>
801 #include <string.h>
802 #include <fcntl.h>
803 #include <sys/statfs.h>
804 #include <sys/stropts.h>
805 #define NO_GET_BROADCAST
806 #define USE_WAITPID
807 #define USE_GETCWD
808 #define USE_SETSID
809 #define STATFS4
810 #define NO_EID
811 #define PF_INET AF_INET
812 #define NO_STRERROR
813 #define ftruncate(f,l) chsize(f,l)
814 #endif /* DNIX */
815
816 #ifdef CONVEX
817 #include <netinet/tcp.h>
818 #include <arpa/inet.h>
819 #include <dirent.h>
820 #include <string.h>
821 #include <sys/vfs.h>
822 #include <fcntl.h>
823 #define DONT_REINSTALL_SIG
824 #define USE_SIGBLOCK
825 #define USE_WAITPID
826 #define SIGNAL_CAST (_SigFunc_Ptr_t)
827 #define NO_GETSPNAM
828 #define HAVE_MEMMOVE
829 extern char *mktemp(char *);
830 extern int  fsync(int);
831 extern int  seteuid(uid_t);
832 extern int  setgroups(int, int *);
833 extern int  initgroups(char *, int);
834 extern int  statfs(char *, struct statfs *);
835 extern int  setegid(gid_t);
836 extern int  getopt(int, char *const *, const char *);
837 extern int  chroot(char *);
838 extern int  gettimeofday(struct timeval *, struct timezone *);
839 extern int  gethostname(char *, int);
840 extern char *crypt(char *, char *);
841 extern char *getpass(char *);
842 #endif
843
844
845 #ifdef CRAY
846 #define MAXPATHLEN 1024
847 #include <dirent.h>
848 #include <string.h>
849 #include <fcntl.h>
850 #include <sys/statfs.h>
851 #define SIGNAL_CAST (void (*)(int))
852 #define SIGCLD_IGNORE
853 #define HAVE_FCNTL_LOCK 1
854 #define USE_SETSID
855 #define STATFS4
856 #endif
857
858
859 #ifdef ALTOS
860 #include <unistd.h>
861 #include <string.h>
862 #include <dirent.h>
863 #include <sys/fcntl.h>
864 #include <sys/statfs.h>
865 #define        const
866 #define        uid_t           int
867 #define        gid_t           int
868 #define        mode_t          int
869 #define        ptrdiff_t       int
870 #define HAVE_GETGRNAM  0
871 #define NO_EID
872 #define NO_FSYNC
873 #define        NO_FTRUNCATE
874 #define        NO_GETRLIMIT
875 #define        NO_INITGROUPS
876 #define NO_SELECT
877 #define NO_SETGROUPS
878 #define NO_STRERROR
879 #define NO_STRFTIME
880 #define        NO_TM_NAME
881 #define NO_UTIMEH
882 #define NOSTRCASECMP
883 #define REPLACE_MKTIME
884 #define REPLACE_RENAME
885 #define REPLACE_STRSTR
886 #define STATFS4
887 #define        USE_GETCWD
888 #endif
889
890 #ifdef QNX
891 #define STATFS4
892 #include <sys/statfs.h>
893 #include <sys/select.h>
894 #include <signal.h>
895 #include <sys/dir.h>
896 #define SIGNAL_CAST (void (*)())
897 #define USE_WAITPID
898 #define NO_INITGROUPS
899 #define NO_SETGROUPS
900 #define HAVE_TIMEZONE
901 #define USE_GETCWD
902 #define USE_SETSID
903 #define HAVE_FCNTL_LOCK 1
904 #define DEFAULT_PRINTING PRINT_QNX
905 #endif
906
907
908 #ifdef NEWS42
909 #include <string.h>
910 #include <dirent.h>
911 #include <sys/vfs.h>
912 #include <sys/timeb.h>
913 typedef int mode_t;
914 #endif
915
916 #ifdef OS2
917 #include <dirent.h>
918 #include <sys/statfs.h>
919 #include <string.h>
920 #include <limits.h>
921 #define SIGNAL_CAST (void (*)())
922 #define HAVE_FCNTL_LOCK 0
923 #define USE_WAITPID
924 #define NO_GET_BROADCAST
925 #define NO_EID
926 #define NO_SETGROUPS
927 #define NO_INITGROUPS
928 #define NO_CRYPT
929 #define NO_STATFS
930 #define NO_CHROOT
931 #define NO_CHOWN
932 #define strcasecmp stricmp
933 #define strncasecmp strnicmp
934 #endif
935
936
937 #ifdef LYNX
938 #define SIGNAL_CAST (void (*)())
939 #define WAIT3_CAST1 (union wait *)
940 #define STATFS4
941 #include <fcntl.h>
942 #include <resource.h>
943 #include <stat.h>
944 #include <string.h>
945 #include <dirent.h>
946 #include <sys/statfs.h>
947 #define USE_GETCWD
948 #define USE_GETSID
949 #endif
950
951
952 #ifdef BOS
953 #define SIGNAL_CAST (void (*)(int))
954 #include <string.h>
955 #include <sys/dir.h>
956 #include <sys/select.h>
957 #include <dirent.h>
958 #include <fcntl.h>
959 #include <signal.h>
960 #include <sys/statfs.h>
961 #include <sys/bsdioctl.h>
962 #endif
963
964 #ifdef AMIGA
965 #include <arpa/inet.h>
966 #include <dirent.h>
967 #include <string.h>
968 #include <netinet/tcp.h>
969 #include <sys/acct.h>
970 #include <sys/fcntl.h>
971 #include <sys/filio.h>
972 #include <sys/sockio.h>
973 #include <netinet/in_systm.h>
974 #include <netinet/ip.h>
975 #include <sys/termios.h>
976 #include <limits.h>
977 #include <sys/timeb.h>
978
979 #define SIGNAL_CAST (void (*)(int))
980 #define USE_GETCWD
981 #define HAVE_BZERO
982 #define HAVE_MEMMOVE
983 #define USE_SIGPROCMASK
984 #define USE_WAITPID
985 #define USE_DIRECT
986 #define USE_F_FSIZE
987 #define HAVE_FCNTL_LOCK 0
988 #define HAVE_GETTIMEOFDAY
989 #define HAVE_PATHCONF
990
991 #define HAVE_NO_PROC
992 #define NO_FORK_DEBUG
993 #define HAVE_FORK 0
994 #define HAVE_VFORK 1
995 #endif
996
997 /* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
998 #ifdef IA_UINFO
999 #include <iaf.h>
1000 #include <ia.h>
1001 #endif
1002
1003
1004 /*******************************************************************
1005 end of the platform specific sections
1006 ********************************************************************/
1007
1008 #if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
1009 #include <sys/mman.h>
1010 #endif
1011
1012 #ifdef SecureWare
1013 #define NEED_AUTH_PARAMETERS
1014 #endif
1015
1016 #ifdef REPLACE_GETPASS
1017 extern char    *getsmbpass(char *);
1018 #define getpass(s) getsmbpass(s)
1019 #endif
1020
1021 #ifdef REPLACE_INNETGR
1022 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
1023 #endif
1024
1025 #ifndef FD_SETSIZE
1026 #define FD_SETSIZE 255
1027 #endif
1028
1029 #ifndef __STDC__
1030 #define const
1031 #endif
1032
1033 /* Now for some other grungy stuff */
1034 #ifdef NO_GETSPNAM
1035 struct spwd { /* fake shadow password structure */
1036        char *sp_pwdp;
1037 };
1038 #endif
1039
1040 #ifndef HAVE_BZERO
1041 #ifndef bzero
1042 #define bzero(p,s) memset(p,0,s)
1043 #endif
1044 #endif
1045
1046 #ifndef HAVE_MEMMOVE
1047 #ifndef memmove
1048 #define memmove(d,s,n) MemMove(d,s,n)
1049 #endif
1050 #endif
1051
1052 #ifdef USE_DIRECT
1053 #include <sys/dir.h>
1054 #endif
1055
1056 /* some unixes have ENOTTY instead of TIOCNOTTY */
1057 #ifndef TIOCNOTTY
1058 #ifdef ENOTTY
1059 #define TIOCNOTTY ENOTTY
1060 #endif
1061 #endif
1062
1063 #ifndef SIGHUP
1064 #define SIGHUP 1
1065 #endif
1066
1067 /* if undefined then use bsd or sysv printing */
1068 #ifndef DEFAULT_PRINTING
1069 #ifdef SYSV
1070 #define DEFAULT_PRINTING PRINT_SYSV
1071 #else
1072 #define DEFAULT_PRINTING PRINT_BSD
1073 #endif
1074 #endif
1075
1076 /* This defines the name of the printcap file. It is MOST UNLIKELY that
1077    this will change BUT! Specifying a file with the format of a printcap
1078    file but containing only a subset of the printers actually in your real 
1079    printcap file is a quick-n-dirty way to allow dynamic access to a subset
1080    of available printers.
1081 */
1082 #ifndef PRINTCAP_NAME
1083 #ifdef AIX
1084 #define PRINTCAP_NAME "/etc/qconfig"
1085 #elif defined(SYSV)
1086 #define PRINTCAP_NAME "lpstat"
1087 #else
1088 #define PRINTCAP_NAME "/etc/printcap"
1089 #endif
1090 #endif
1091
1092
1093 #ifdef USE_SYSV_IPC
1094 #include <sys/ipc.h>
1095 #include <sys/sem.h>
1096 #include <sys/shm.h>
1097 #ifdef NO_SEMUN
1098 union semun {
1099         int val;
1100         struct semid_ds *buf;
1101         unsigned short *array;
1102 };
1103 #endif
1104 #endif
1105
1106 #ifdef AFS_AUTH
1107 #include <afs/stds.h>
1108 #include <afs/kautils.h>
1109 #endif
1110
1111 #ifdef DFS_AUTH
1112 #include <dce/dce_error.h>
1113 #include <dce/sec_login.h>
1114 #endif
1115
1116 #ifdef KRB5_AUTH
1117 #include <krb5.h>
1118 #endif
1119
1120 #ifdef NO_UTIMBUF
1121 struct utimbuf {
1122   time_t actime;
1123   time_t modtime;
1124 };
1125 #endif
1126
1127 #ifdef NO_STRERROR
1128 #ifndef strerror
1129 extern char *sys_errlist[];
1130 #define strerror(i) sys_errlist[i]
1131 #endif
1132 #endif
1133
1134 #ifndef perror
1135 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1136 #endif
1137
1138 #ifndef MAXHOSTNAMELEN
1139 #define MAXHOSTNAMELEN 255
1140 #endif
1141
1142 #include "version.h"
1143 #include "smb.h"
1144 #include "nameserv.h"
1145 #include "ubiqx/ubi_dLinkList.h"
1146
1147 #include "byteorder.h"
1148
1149 #include "kanji.h"
1150 #include "charset.h"
1151
1152 /***** automatically generated prototypes *****/
1153 #include "proto.h"
1154
1155
1156
1157 #ifndef S_IFREG
1158 #define S_IFREG 0100000
1159 #endif
1160
1161 #ifndef S_ISREG
1162 #define S_ISREG(x) ((S_IFREG & (x))!=0)
1163 #endif
1164
1165 #ifndef S_ISDIR
1166 #define S_ISDIR(x) ((S_IFDIR & (x))!=0)
1167 #endif
1168
1169 #if !defined(S_ISLNK) && defined(S_IFLNK)
1170 #define S_ISLNK(x) ((S_IFLNK & (x))!=0)
1171 #endif
1172
1173 #ifdef UFC_CRYPT
1174 #define crypt ufc_crypt
1175 #endif
1176
1177 #ifdef REPLACE_STRLEN
1178 #define strlen(s) Strlen(s)
1179 #endif
1180
1181 #ifdef REPLACE_STRSTR
1182 #define strstr(s,p) Strstr(s,p)
1183 #endif
1184
1185 #ifdef REPLACE_MKTIME
1186 #define mktime(t) Mktime(t)
1187 #endif
1188
1189 #ifndef NGROUPS_MAX
1190 #define NGROUPS_MAX 128
1191 #endif
1192
1193 #ifndef EDQUOT
1194 #define EDQUOT ENOSPC
1195 #endif
1196
1197 #ifndef HAVE_GETGRNAM
1198 #define HAVE_GETGRNAM 1
1199 #endif
1200
1201 #ifndef SOL_TCP
1202 #define SOL_TCP 6
1203 #endif
1204
1205 /* default to using ftruncate workaround as this is safer than assuming
1206 it works and getting lots of bug reports */
1207 #ifndef FTRUNCATE_CAN_EXTEND
1208 #define FTRUNCATE_CAN_EXTEND 0
1209 #endif
1210
1211 /* maybe this unix doesn't separate RD and WR locks? */
1212 #ifndef F_RDLCK
1213 #define F_RDLCK F_WRLCK
1214 #endif
1215
1216 #ifndef ENOTSOCK
1217 #define ENOTSOCK EINVAL
1218 #endif
1219
1220 #ifndef SIGCLD
1221 #define SIGCLD SIGCHLD
1222 #endif 
1223
1224 #ifndef MAP_FILE
1225 #define MAP_FILE 0
1226 #endif
1227
1228 #ifndef HAVE_FCNTL_LOCK
1229 #define HAVE_FCNTL_LOCK 1
1230 #endif
1231
1232 #ifndef WAIT3_CAST2
1233 #define WAIT3_CAST2 (struct rusage *)
1234 #endif
1235
1236 #ifndef WAIT3_CAST1
1237 #define WAIT3_CAST1 (int *)
1238 #endif
1239
1240 #ifndef QSORT_CAST
1241 #define QSORT_CAST (int (*)())
1242 #endif
1243
1244 #ifndef INADDR_LOOPBACK
1245 #define INADDR_LOOPBACK 0x7f000001
1246 #endif /* INADDR_LOOPBACK */
1247
1248 /* this is a rough check to see if this machine has a lstat() call.
1249    it is not guaranteed to work */
1250 #if !defined(S_ISLNK)
1251 #define lstat stat
1252 #endif
1253
1254 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1255 #ifndef errno
1256 extern int errno;
1257 #endif 
1258
1259
1260 #ifdef NO_EID
1261 #define geteuid() getuid()
1262 #define getegid() getgid()
1263 #define seteuid(x) setuid(x)
1264 #define setegid(x) setgid(x)
1265 #endif
1266
1267
1268 #if (HAVE_FCNTL_LOCK == 0)
1269 /* since there is no locking available, system includes  */
1270 /* for DomainOS 10.4 do not contain any of the following */
1271 /* #define's. So, to satisfy the compiler, add these     */
1272 /* #define's, although they arn't really necessary.      */
1273 #define F_GETLK 0
1274 #define F_SETLK 0
1275 #define F_WRLCK 0
1276 #define F_UNLCK 0
1277 #endif /* HAVE_FCNTL_LOCK == 0 */
1278
1279 #ifdef NOSTRCASECMP
1280 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1281 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1282 #endif
1283
1284 #ifndef strcpy
1285 #define strcpy(dest,src) StrCpy(dest,src)
1286 #endif
1287
1288
1289 /* possibly wrap the malloc calls */
1290 #if WRAP_MALLOC
1291
1292 /* undo the old malloc def if necessary */
1293 #ifdef malloc
1294 #define xx_old_malloc malloc
1295 #undef malloc
1296 #endif
1297
1298 #define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
1299
1300 /* undo the old realloc def if necessary */
1301 #ifdef realloc
1302 #define xx_old_realloc realloc
1303 #undef realloc
1304 #endif
1305
1306 #define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
1307
1308 /* undo the old free def if necessary */
1309 #ifdef free
1310 #define xx_old_free free
1311 #undef free
1312 #endif
1313
1314 #define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
1315
1316 /* and the malloc prototypes */
1317 void *malloc_wrapped(int,char *,int);
1318 void *realloc_wrapped(void *,int,char *,int);
1319 void free_wrapped(void *,char *,int);
1320
1321 #endif
1322
1323
1324 #if WRAP_MEMCPY
1325 /* undo the old memcpy def if necessary */
1326 #ifdef memcpy
1327 #define xx_old_memcpy memcpy
1328 #undef memcpy
1329 #endif
1330
1331 #define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
1332 void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
1333 #endif
1334
1335 #endif