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