Added definitions for vuid offset and invalid user smb_uid.
[Samba.git] / source / include / includes.h
blob9d6bde519755665193f04e5c825befbe188ba7e3
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-1995
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 #include <sys/ioctl.h>
143 #include <stddef.h>
144 #ifdef POSIX_H
145 #include <posix/utime.h>
146 #include <bsd/sys/time.h>
147 #include <bsd/netinet/in.h>
148 #else
149 #include <sys/time.h>
150 #include <netinet/in.h>
151 #endif
152 #include <netdb.h>
153 #include <signal.h>
154 #include <errno.h>
155 #include <sys/file.h>
156 #include <sys/stat.h>
157 #include <sys/param.h>
158 #include <grp.h>
159 #ifndef NO_RESOURCEH
160 #include <sys/resource.h>
161 #endif
162 #ifndef NO_SYSMOUNTH
163 #include <sys/mount.h>
164 #endif
165 #include <pwd.h>
166 #ifdef __STDC__
167 #include <stdarg.h>
168 #else
169 #include <varargs.h>
170 #endif
171 #ifndef NO_UNISTDH
172 #include <unistd.h>
173 #endif
174 #include <sys/wait.h>
175 #ifdef SYSSTREAMH
176 #include <sys/stream.h>
177 #endif
178 #ifndef NO_NETIFH
179 #ifdef POSIX_H
180 #include <bsd/net/if.h>
181 #else
182 #include <net/if.h>
183 #endif
184 #endif
186 #if defined(GETPWANAM)
187 #include <sys/types.h>
188 #include <sys/label.h>
189 #include <sys/audit.h>
190 #include <pwdadj.h>
191 #endif
193 #if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(CONVEX)
194 #include <shadow.h>
195 #endif
197 #ifdef SYSLOG
198 #include <syslog.h>
199 #endif
203 /***************************************************************************
204 Here come some platform specific sections
205 ***************************************************************************/
208 #ifdef LINUX
209 #include <arpa/inet.h>
210 #include <dirent.h>
211 #include <string.h>
212 #include <sys/vfs.h>
213 #include <netinet/in.h>
214 #ifndef NO_ASMSIGNALH
215 #include <asm/signal.h>
216 #endif
217 #define SIGNAL_CAST (__sighandler_t)
218 #define USE_GETCWD
219 #define USE_SETSID
220 #define HAVE_BZERO
221 #define HAVE_MEMMOVE
222 #define USE_SIGPROCMASK
223 #define USE_WAITPID
224 #if 0
225 /* SETFS disabled until we can check on some bug reports */
226 #if _LINUX_C_LIB_VERSION_MAJOR >= 5
227 #define USE_SETFS
228 #endif
229 #endif
230 #ifdef SHADOW_PWD
231 #if _LINUX_C_LIB_VERSION_MAJOR < 5
232 #ifndef crypt
233 #define crypt pw_encrypt
234 #endif
235 #endif
236 #endif
237 #endif
239 #ifdef SUNOS4
240 #define SIGNAL_CAST (void (*)(int))
241 #include <netinet/tcp.h>
242 #include <dirent.h>
243 #include <sys/acct.h>
244 #include <sys/vfs.h>
245 #include <string.h>
246 #include <errno.h>
247 #include <sys/wait.h>
248 #include <signal.h>
249 /* #include <termios.h> */
250 #ifdef sun386
251 #define NO_STRFTIME
252 #define NO_UTIMBUF
253 #define mktime timelocal
254 typedef unsigned short mode_t;
255 #else
256 #include <utime.h>
257 #define NO_STRERROR
258 #endif
259 #define REPLACE_GETPASS
260 #define BSD_TERMIO
261 #define USE_SIGPROCMASK
262 #define USE_WAITPID
263 #endif
266 #ifdef SUNOS5
267 #include <fcntl.h>
268 #include <dirent.h>
269 #include <sys/acct.h>
270 #include <sys/statfs.h>
271 #include <sys/statvfs.h>
272 #include <sys/filio.h>
273 #include <sys/sockio.h>
274 #include <netinet/in_systm.h>
275 #include <netinet/tcp.h>
276 #include <netinet/ip.h>
277 #include <string.h>
278 #include <arpa/inet.h>
279 #include <rpcsvc/ypclnt.h>
280 #include <crypt.h>
281 #include <termios.h>
282 extern int gettimeofday (struct timeval *, void *);
283 extern int gethostname (char *name, int namelen);
284 extern int innetgr (const char *, const char *, const char *, const char *);
285 #define USE_SETVBUF
286 #define SIGNAL_CAST (void (*)(int))
287 #ifndef SYSV
288 #define SYSV
289 #endif
290 #define USE_WAITPID
291 #define REPLACE_STRLEN
292 #define USE_STATVFS
293 #define USE_GETCWD
294 #define USE_SETSID
295 #define REPLACE_GETPASS
296 #define USE_SIGPROCMASK
297 #endif
300 #ifdef ULTRIX
301 #include <strings.h>
302 #include <nfs/nfs_clnt.h>
303 #include <nfs/vfs.h>
304 #include <netinet/tcp.h>
305 #ifdef ULTRIX_AUTH
306 #include <auth.h>
307 #endif
308 char *getwd(char *);
309 #define NOSTRDUP
310 #ifdef __STDC__
311 #define SIGNAL_CAST (void(*)(int))
312 #endif
313 #define USE_DIRECT
314 #define USE_WAITPID
315 #endif
317 #ifdef SGI
318 #include <netinet/tcp.h>
319 #include <sys/statfs.h>
320 #include <string.h>
321 #include <signal.h>
322 #ifndef SYSV
323 #define SYSV
324 #endif
325 #define SIGNAL_CAST (void (*)())
326 #define STATFS4
327 #define USE_WAITPID
328 #define USE_DIRECT
329 #endif
331 #ifdef SGI5
332 #include <netinet/tcp.h>
333 #include <sys/statvfs.h>
334 #include <string.h>
335 #include <signal.h>
336 #include <dirent.h>
337 #define USE_WAITPID
338 #define NETGROUP
339 #ifndef SYSV
340 #define SYSV
341 #endif
342 #define SIGNAL_CAST (void (*)())
343 #define USE_STATVFS
344 #define USE_WAITPID
345 #endif
348 #ifdef MIPS
349 #include <bsd/net/soioctl.h>
350 #include <string.h>
351 #include <dirent.h>
352 #include <fcntl.h>
353 #include <sys/statfs.h>
354 #include <sys/wait.h>
355 #include <sys/termio.h>
356 #define SIGNAL_CAST (void (*)())
357 typedef int mode_t;
358 extern struct group *getgrnam();
359 extern struct passwd *getpwnam();
360 #define STATFS4
361 #define NO_STRERROR
362 #define REPLACE_STRSTR
363 #endif /* MIPS */
367 #ifdef DGUX
368 #include <string.h>
369 #include <dirent.h>
370 #include <sys/statfs.h>
371 #include <sys/statvfs.h>
372 #include <fcntl.h>
373 #include <termios.h>
374 #define SYSV
375 #define USE_WAITPID
376 #define SIGNAL_CAST (void (*)(int))
377 #define STATFS4
378 #define USE_GETCWD
379 #endif
382 #ifdef SVR4
383 #include <string.h>
384 #include <sys/dir.h>
385 #include <dirent.h>
386 #include <sys/statfs.h>
387 #include <sys/statvfs.h>
388 #include <sys/vfs.h>
389 #include <sys/filio.h>
390 #include <fcntl.h>
391 #include <sys/sockio.h>
392 #include <netinet/tcp.h>
393 #include <stropts.h>
394 #include <termios.h>
395 #define SYSV
396 #define USE_WAITPID
397 #define SIGNAL_CAST (void (*)(int))
398 #define USE_STATVFS
399 #define USE_GETCWD
400 #define USE_SETSID
401 #endif
404 #ifdef OSF1
405 #include <termios.h>
406 #include <strings.h>
407 #include <dirent.h>
408 char *getwd(char *);
409 char *mktemp(char *); /* No standard include */
410 #include <netinet/in.h>
411 #include <arpa/inet.h> /* both for inet_ntoa */
412 #define SIGNAL_CAST ( void (*) (int) )
413 #define STATFS3
414 #define USE_F_FSIZE
415 #include <netinet/tcp.h>
416 #ifdef OSF1_ENH_SEC
417 #include <pwd.h>
418 #include <sys/types.h>
419 #include <sys/security.h>
420 #include <prot.h>
421 #include <unistd.h>
422 #define PASSWORD_LENGTH 16
423 #define NEED_AUTH_PARAMETERS
424 #endif /* OSF1_ENH_SEC */
425 #endif
428 #ifdef CLIX
429 #include <dirent.h>
430 #define SIGNAL_CAST (void (*)())
431 #include <sys/fcntl.h>
432 #include <sys/statfs.h>
433 #include <string.h>
434 #define NO_EID
435 #define USE_WAITPID
436 #define STATFS4
437 #define NO_FSYNC
438 #define USE_GETCWD
439 #define USE_SETSID
440 #define REPLACE_GETPASS
441 #define NO_GETRLIMIT
442 #endif /* CLIX */
446 #ifdef BSDI
447 #include <string.h>
448 #include <netinet/tcp.h>
449 #define SIGNAL_CAST (void (*)())
450 #define USE_DIRECT
451 #endif
454 #ifdef NETBSD
455 #include <strings.h>
456 #include <netinet/tcp.h>
457 /* you may not need this */
458 #define NO_GETSPNAM
459 #define SIGNAL_CAST (void (*)())
460 #define USE_DIRECT
461 #define REPLACE_INNETGR
462 #endif
466 #ifdef FreeBSD
467 #include <strings.h>
468 #include <netinet/tcp.h>
469 #include <netinet/in_systm.h>
470 #include <netinet/ip.h>
471 #define SIGNAL_CAST (void (*)())
472 #define USE_DIRECT
473 #endif
477 #ifdef AIX
478 #include <strings.h>
479 #include <sys/dir.h>
480 #include <sys/select.h>
481 #include <dirent.h>
482 #include <sys/statfs.h>
483 #include <sys/vfs.h>
484 #include <sys/id.h>
485 #include <sys/priv.h>
486 #include <netinet/tcp.h>
487 #define SYSV
488 #define USE_WAITPID
489 #define USE_SIGBLOCK
490 #define SIGNAL_CAST (void (*)())
491 #define DEFAULT_PRINTING PRINT_AIX
492 /* we undef this because sys/param.h is broken in aix. uggh. */
493 #undef MAXHOSTNAMELEN
494 #endif
497 #ifdef HPUX
498 #include <string.h>
499 #include <dirent.h>
500 #include <fcntl.h>
501 #include <sys/vfs.h>
502 #include <sys/types.h>
503 #include <sys/termios.h>
504 #include <netinet/tcp.h>
505 #ifdef HPUX_10_TRUSTED
506 #include <hpsecurity.h>
507 #include <prot.h>
508 #define NEED_AUTH_PARAMETERS
509 #endif
510 #define SIGNAL_CAST (void (*)(__harg))
511 #define SELECT_CAST (int *)
512 #define SYSV
513 #define USE_WAITPID
514 #define WAIT3_CAST2 (int *)
515 #define USE_GETCWD
516 #define USE_SETSID
517 #define USE_SETRES
518 #define DEFAULT_PRINTING PRINT_HPUX
519 #define SIGCLD_IGNORE
520 #endif
523 #ifdef SEQUENT
524 #include <signal.h>
525 #include <string.h>
526 #include <dirent.h>
527 #include <sys/types.h>
528 #include <sys/statfs.h>
529 #include <sys/stat.h>
530 #include <sys/buf.h>
531 #include <sys/socket.h>
532 #include <unistd.h>
533 #include <fcntl.h>
534 #define SIGNAL_CAST (void (*)(int))
535 #define USE_WAITPID
536 #define USE_GETCWD
537 #define NO_EID
538 #define STATFS4
539 #define USE_DIRECT
540 #ifdef PTX4
541 #undef USE_DIRECT
542 #endif
543 #endif
547 #ifdef SEQUENT_PTX4
548 #include <string.h>
549 #include <sys/dir.h>
550 #include <dirent.h>
551 #include <sys/statfs.h>
552 #include <sys/statvfs.h>
553 #include <sys/vfs.h>
554 #include <fcntl.h>
555 #include <sys/sockio.h>
556 #include <netinet/tcp.h>
557 #include <stropts.h>
558 #include <termios.h>
559 #define SYSV
560 #define USE_WAITPID
561 #define SIGNAL_CAST (void (*)(int))
562 #define USE_STATVFS
563 #define USE_GETCWD
564 #ifndef seteuid
565 #define seteuid(uid) setreuid(-1,uid)
566 #endif
567 #ifndef setegid
568 #define setegid(gid) setregid(-1,gid)
569 #endif
570 #endif
573 #ifdef NEXT2
574 #include <sys/types.h>
575 #include <strings.h>
576 #include <dirent.h>
577 #include <sys/vfs.h>
578 #define bzero(b,len) memset(b,0,len)
579 #define mode_t int
580 #define NO_UTIMBUF
581 #include <libc.h>
582 #define NOSTRDUP
583 #define USE_DIRECT
584 #define USE_WAITPID
585 #endif
588 #ifdef NEXT3_0
589 #include <strings.h>
590 #include <sys/dir.h>
591 #include <sys/vfs.h>
592 #define bzero(b,len) memset(b,0,len)
593 #define NO_UTIMBUF
594 #include <libc.h>
595 #define NOSTRDUP
596 #define USE_DIRECT
597 #define mode_t int
598 #define GID_TYPE int
599 #define gid_t int
600 #define pid_t int
601 #define SIGNAL_CAST (void (*)(int))
602 #define WAIT3_CAST1 (union wait *)
603 #define HAVE_GMTOFF
604 #endif
608 #ifdef APOLLO
609 #include <string.h>
610 #include <fcntl.h>
611 #include <sys/statfs.h>
612 #define NO_UTIMBUF
613 #define USE_DIRECT
614 #define USE_GETCWD
615 #define SIGNAL_CAST (void (*)())
616 #define HAVE_FCNTL_LOCK 0
617 #define HAVE_GETTIMEOFDAY
618 #define STATFS4
619 #endif
623 #ifdef SCO
624 #include <sys/netinet/tcp.h>
625 #include <sys/netinet/in_systm.h>
626 #include <sys/netinet/ip.h>
627 #include <dirent.h>
628 #include <string.h>
629 #include <fcntl.h>
630 #include <sys/statfs.h>
631 #include <sys/stropts.h>
632 #include <limits.h>
633 #ifdef EVEREST
634 #include <unistd.h>
635 #endif
636 #ifdef NETGROUP
637 #include <rpcsvc/ypclnt.h>
638 #endif
639 #ifdef SecureWare
640 #include <sys/security.h>
641 #include <sys/audit.h>
642 #include <prot.h>
643 #define crypt bigcrypt
644 #endif
645 #ifndef EVEREST
646 #define ftruncate(f,l) syscall(0x0a28,f,l)
647 #endif
648 #define SIGNAL_CAST (void (*)(int))
649 #define USE_WAITPID
650 #define USE_GETCWD
651 #define USE_SETSID
652 #ifdef SCO3_2_2
653 #define NO_EID
654 #else
655 #ifndef EVEREST
656 #define USE_IFREQ
657 #endif
658 #endif
659 #define STATFS4
660 #define NO_FSYNC
661 #ifndef EVEREST
662 #define NO_INITGROUPS
663 #endif
664 #define HAVE_PATHCONF
665 #define NO_GETRLIMIT
666 #endif
670 /* Definitions for RiscIX */
671 #ifdef RiscIX
672 #define SIGNAL_CAST (void (*)(int))
673 #include <sys/dirent.h>
674 #include <sys/acct.h>
675 #include <sys/vfs.h>
676 #include <string.h>
677 #include <utime.h>
678 #include <signal.h>
679 #define HAVE_GETTIMEOFDAY
680 #define NOSTRCASECMP
681 #define NOSTRDUP
682 #endif
686 #ifdef ISC
687 #include <net/errno.h>
688 #include <string.h>
689 #include <sys/dir.h>
690 #include <dirent.h>
691 #include <sys/statfs.h>
692 #include <fcntl.h>
693 #include <sys/sioctl.h>
694 #include <stropts.h>
695 #include <limits.h>
696 #include <netinet/tcp.h>
697 #define FIONREAD FIORDCHK
698 #define SYSV
699 #define USE_WAITPID
700 #define SIGNAL_CAST (void (*)(int))
701 #define USE_GETCWD
702 #define USE_SETSID
703 #define USE_IFREQ
704 #define NO_FTRUNCATE
705 #define STATFS4
706 #define NO_FSYNC
707 #endif
711 #ifdef AUX
712 #include <fstab.h>
713 #include <string.h>
714 #include <dirent.h>
715 #include <sys/vfs.h>
716 #include <fcntl.h>
717 #include <termios.h>
718 #define SYSV
719 #define USE_WAITPID
720 #define SIGNAL_CAST (void (*)(int))
721 char *strdup (char *);
722 #define USE_GETCWD
723 #endif
726 #ifdef M88K_R3
727 #include <string.h>
728 #include <dirent.h>
729 #include <fcntl.h>
730 #include <termios.h>
731 #define STATFS4
732 #define SYSV
733 #define USE_WAITPID
734 #define SIGNAL_CAST (void (*)(int))
735 char *strdup (char *);
736 #define USE_GETCWD
737 #define NO_FSYNC
738 #define NO_EID
739 #endif
742 #ifdef DNIX
743 #include <dirent.h>
744 #include <string.h>
745 #include <fcntl.h>
746 #include <sys/statfs.h>
747 #include <sys/stropts.h>
748 #define NO_GET_BROADCAST
749 #define USE_WAITPID
750 #define USE_GETCWD
751 #define USE_SETSID
752 #define STATFS4
753 #define NO_EID
754 #define PF_INET AF_INET
755 #define NO_STRERROR
756 #define ftruncate(f,l) chsize(f,l)
757 #endif /* DNIX */
759 #ifdef CONVEX
760 #include <netinet/tcp.h>
761 #include <arpa/inet.h>
762 #include <dirent.h>
763 #include <string.h>
764 #include <sys/vfs.h>
765 #include <fcntl.h>
766 #define DONT_REINSTALL_SIG
767 #define USE_SIGBLOCK
768 #define USE_WAITPID
769 #define SIGNAL_CAST (_SigFunc_Ptr_t)
770 #define NO_GETSPNAM
771 #define HAVE_MEMMOVE
772 extern char *mktemp(char *);
773 extern int fsync(int);
774 extern int seteuid(uid_t);
775 extern int setgroups(int, int *);
776 extern int initgroups(char *, int);
777 extern int statfs(char *, struct statfs *);
778 extern int setegid(gid_t);
779 extern int getopt(int, char *const *, const char *);
780 extern int chroot(char *);
781 extern int gettimeofday(struct timeval *, struct timezone *);
782 extern int gethostname(char *, int);
783 extern char *crypt(char *, char *);
784 extern char *getpass(char *);
785 #endif
788 #ifdef CRAY
789 #define MAXPATHLEN 1024
790 #include <dirent.h>
791 #include <string.h>
792 #include <fcntl.h>
793 #include <sys/statfs.h>
794 #define SIGNAL_CAST (void (*)(int))
795 #define SIGCLD_IGNORE
796 #define HAVE_FCNTL_LOCK 1
797 #define USE_SETSID
798 #define STATFS4
799 #endif
802 #ifdef ALTOS
803 #include <unistd.h>
804 #include <string.h>
805 #include <dirent.h>
806 #include <sys/fcntl.h>
807 #include <sys/statfs.h>
808 #define const
809 #define uid_t int
810 #define gid_t int
811 #define mode_t int
812 #define ptrdiff_t int
813 #define HAVE_GETGRNAM 0
814 #define NO_EID
815 #define NO_FSYNC
816 #define NO_FTRUNCATE
817 #define NO_GETRLIMIT
818 #define NO_INITGROUPS
819 #define NO_SELECT
820 #define NO_SETGROUPS
821 #define NO_STRERROR
822 #define NO_STRFTIME
823 #define NO_TM_NAME
824 #define NO_UTIMEH
825 #define NOSTRCASECMP
826 #define REPLACE_MKTIME
827 #define REPLACE_RENAME
828 #define REPLACE_STRSTR
829 #define STATFS4
830 #define USE_GETCWD
831 #endif
833 #ifdef QNX
834 #define STATFS4
835 #include <sys/statfs.h>
836 #include <sys/select.h>
837 #include <signal.h>
838 #include <sys/dir.h>
839 #define SIGNAL_CAST (void (*)())
840 #define USE_WAITPID
841 #define NO_INITGROUPS
842 #define NO_SETGROUPS
843 #define HAVE_TIMEZONE
844 #define USE_GETCWD
845 #define USE_SETSID
846 #define HAVE_FCNTL_LOCK 1
847 #define DEFAULT_PRINTING PRINT_QNX
848 #endif
851 #ifdef NEWS42
852 #include <string.h>
853 #include <dirent.h>
854 #include <sys/vfs.h>
855 #include <sys/timeb.h>
856 typedef int mode_t;
857 #endif
859 #ifdef OS2
860 #include <dirent.h>
861 #include <sys/statfs.h>
862 #include <string.h>
863 #include <limits.h>
864 #define SIGNAL_CAST (void (*)())
865 #define HAVE_FCNTL_LOCK 0
866 #define USE_WAITPID
867 #define NO_GET_BROADCAST
868 #define NO_EID
869 #define NO_SETGROUPS
870 #define NO_INITGROUPS
871 #define NO_CRYPT
872 #define NO_STATFS
873 #define NO_CHROOT
874 #define NO_CHOWN
875 #define strcasecmp stricmp
876 #define strncasecmp strnicmp
877 #endif
880 #ifdef LYNX
881 #define SIGNAL_CAST (void (*)())
882 #define WAIT3_CAST1 (union wait *)
883 #define STATFS4
884 #include <fcntl.h>
885 #include <resource.h>
886 #include <stat.h>
887 #include <string.h>
888 #include <dirent.h>
889 #include <sys/statfs.h>
890 #define USE_GETCWD
891 #define USE_GETSID
892 #endif
895 #ifdef BOS
896 #define SIGNAL_CAST (void (*)(int))
897 #include <string.h>
898 #include <sys/dir.h>
899 #include <sys/select.h>
900 #include <dirent.h>
901 #include <fcntl.h>
902 #include <signal.h>
903 #include <sys/statfs.h>
904 #include <sys/bsdioctl.h>
905 #endif
909 /*******************************************************************
910 end of the platform specific sections
911 ********************************************************************/
913 #if defined(USE_MMAP) || FAST_SHARE_MODES
914 #include <sys/mman.h>
915 #endif
917 #ifdef SecureWare
918 #define NEED_AUTH_PARAMETERS
919 #endif
921 #ifdef REPLACE_GETPASS
922 extern char *getsmbpass(char *);
923 #define getpass(s) getsmbpass(s)
924 #endif
926 #ifdef REPLACE_INNETGR
927 #define innetgr(group,host,user,dom) InNetGr(group,host,user,dom)
928 #endif
930 #ifndef FD_SETSIZE
931 #define FD_SETSIZE 255
932 #endif
934 #ifndef __STDC__
935 #define const
936 #endif
938 /* Now for some other grungy stuff */
939 #ifdef NO_GETSPNAM
940 struct spwd { /* fake shadow password structure */
941 char *sp_pwdp;
943 #endif
945 #ifndef HAVE_BZERO
946 #ifndef bzero
947 #define bzero(p,s) memset(p,0,s)
948 #endif
949 #endif
951 #ifndef HAVE_MEMMOVE
952 #ifndef memmove
953 #define memmove(d,s,n) MemMove(d,s,n)
954 #endif
955 #endif
957 #ifdef USE_DIRECT
958 #include <sys/dir.h>
959 #endif
961 /* some unixes have ENOTTY instead of TIOCNOTTY */
962 #ifndef TIOCNOTTY
963 #ifdef ENOTTY
964 #define TIOCNOTTY ENOTTY
965 #endif
966 #endif
968 #ifndef SIGHUP
969 #define SIGHUP 1
970 #endif
972 /* if undefined then use bsd or sysv printing */
973 #ifndef DEFAULT_PRINTING
974 #ifdef SYSV
975 #define DEFAULT_PRINTING PRINT_SYSV
976 #else
977 #define DEFAULT_PRINTING PRINT_BSD
978 #endif
979 #endif
982 #ifdef AFS_AUTH
983 #include <afs/stds.h>
984 #include <afs/kautils.h>
985 #endif
987 #ifdef DFS_AUTH
988 #include <dce/dce_error.h>
989 #include <dce/sec_login.h>
990 #endif
992 #ifdef NO_UTIMBUF
993 struct utimbuf {
994 time_t actime;
995 time_t modtime;
997 #endif
999 #ifdef NO_STRERROR
1000 #ifndef strerror
1001 extern char *sys_errlist[];
1002 #define strerror(i) sys_errlist[i]
1003 #endif
1004 #endif
1006 #ifndef perror
1007 #define perror(m) printf("%s: %s\n",m,strerror(errno))
1008 #endif
1010 #ifndef MAXHOSTNAMELEN
1011 #define MAXHOSTNAMELEN 255
1012 #endif
1014 #include "version.h"
1015 #include "smb.h"
1016 #include "nameserv.h"
1017 #include "proto.h"
1018 #include "byteorder.h"
1020 #include "kanji.h"
1021 #include "charset.h"
1023 #ifndef S_IFREG
1024 #define S_IFREG 0100000
1025 #endif
1027 #ifndef S_ISREG
1028 #define S_ISREG(x) ((S_IFREG & x)!=0)
1029 #endif
1031 #ifndef S_ISDIR
1032 #define S_ISDIR(x) ((S_IFDIR & x)!=0)
1033 #endif
1035 #ifdef UFC_CRYPT
1036 #define crypt ufc_crypt
1037 #endif
1039 #ifdef REPLACE_STRLEN
1040 #define strlen(s) Strlen(s)
1041 #endif
1043 #ifdef REPLACE_STRSTR
1044 #define strstr(s,p) Strstr(s,p)
1045 #endif
1047 #ifdef REPLACE_MKTIME
1048 #define mktime(t) Mktime(t)
1049 #endif
1051 #ifndef NGROUPS_MAX
1052 #define NGROUPS_MAX 128
1053 #endif
1055 #ifndef EDQUOT
1056 #define EDQUOT ENOSPC
1057 #endif
1059 #ifndef HAVE_GETGRNAM
1060 #define HAVE_GETGRNAM 1
1061 #endif
1063 #ifndef SOL_TCP
1064 #define SOL_TCP 6
1065 #endif
1067 /* default to using ftruncate workaround as this is safer than assuming
1068 it works and getting lots of bug reports */
1069 #ifndef FTRUNCATE_CAN_EXTEND
1070 #define FTRUNCATE_CAN_EXTEND 0
1071 #endif
1073 /* maybe this unix doesn't separate RD and WR locks? */
1074 #ifndef F_RDLCK
1075 #define F_RDLCK F_WRLCK
1076 #endif
1078 #ifndef ENOTSOCK
1079 #define ENOTSOCK EINVAL
1080 #endif
1082 #ifndef SIGCLD
1083 #define SIGCLD SIGCHLD
1084 #endif
1086 #ifndef MAP_FILE
1087 #define MAP_FILE 0
1088 #endif
1090 #ifndef HAVE_FCNTL_LOCK
1091 #define HAVE_FCNTL_LOCK 1
1092 #endif
1094 #ifndef WAIT3_CAST2
1095 #define WAIT3_CAST2 (struct rusage *)
1096 #endif
1098 #ifndef WAIT3_CAST1
1099 #define WAIT3_CAST1 (int *)
1100 #endif
1102 #ifndef QSORT_CAST
1103 #define QSORT_CAST (int (*)())
1104 #endif
1106 /* this is a rough check to see if this machine has a lstat() call.
1107 it is not guaranteed to work */
1108 #if !(defined(S_ISLNK) || defined(S_IFLNK))
1109 #define lstat stat
1110 #endif
1112 /* Not all systems declare ERRNO in errno.h... and some systems #define it! */
1113 #ifndef errno
1114 extern int errno;
1115 #endif
1118 #ifdef NO_EID
1119 #define geteuid() getuid()
1120 #define getegid() getgid()
1121 #define seteuid(x) setuid(x)
1122 #define setegid(x) setgid(x)
1123 #endif
1126 #if (HAVE_FCNTL_LOCK == 0)
1127 /* since there is no locking available, system includes */
1128 /* for DomainOS 10.4 do not contain any of the following */
1129 /* #define's. So, to satisfy the compiler, add these */
1130 /* #define's, although they arn't really necessary. */
1131 #define F_GETLK 0
1132 #define F_SETLK 0
1133 #define F_WRLCK 0
1134 #define F_UNLCK 0
1135 #endif /* HAVE_FCNTL_LOCK == 0 */
1137 #ifdef NOSTRCASECMP
1138 #define strcasecmp(s1,s2) StrCaseCmp(s1,s2)
1139 #define strncasecmp(s1,s2,n) StrnCaseCmp(s1,s2,n)
1140 #endif
1142 #ifndef strcpy
1143 #define strcpy(dest,src) StrCpy(dest,src)
1144 #endif
1147 /* possibly wrap the malloc calls */
1148 #if WRAP_MALLOC
1150 /* undo the old malloc def if necessary */
1151 #ifdef malloc
1152 #define xx_old_malloc malloc
1153 #undef malloc
1154 #endif
1156 #define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
1158 /* undo the old realloc def if necessary */
1159 #ifdef realloc
1160 #define xx_old_realloc realloc
1161 #undef realloc
1162 #endif
1164 #define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
1166 /* undo the old free def if necessary */
1167 #ifdef free
1168 #define xx_old_free free
1169 #undef free
1170 #endif
1172 #define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
1174 /* and the malloc prototypes */
1175 void *malloc_wrapped(int,char *,int);
1176 void *realloc_wrapped(void *,int,char *,int);
1177 void free_wrapped(void *,char *,int);
1179 #endif
1182 #if WRAP_MEMCPY
1183 /* undo the old memcpy def if necessary */
1184 #ifdef memcpy
1185 #define xx_old_memcpy memcpy
1186 #undef memcpy
1187 #endif
1189 #define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
1190 void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
1191 #endif
1193 #endif