4 Unix SMB/Netbios implementation.
6 Machine customisation and include handling
7 Copyright (C) Andrew Tridgell 1994-1998
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 #ifndef NO_CONFIG_H /* for some tests */
31 #define DEFAULT_PRINTING PRINT_AIX
32 #define PRINTCAP_NAME "/etc/qconfig"
36 #define DEFAULT_PRINTING PRINT_HPUX
40 #define DEFAULT_PRINTING PRINT_QNX
44 /* on SUNOS4 termios.h conflicts with sys/ioctl.h */
49 #ifndef DEFAULT_PRINTING
50 #define DEFAULT_PRINTING PRINT_BSD
53 #define PRINTCAP_NAME "/etc/printcap"
57 /* use gcc attribute to check printf fns */
59 #define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
61 #define PRINTF_ATTRIBUTE(a1, a2)
66 * <unistd.h> has to be included before any other to get
67 * large file support on Reliant UNIX. Yes, it's broken :-).
72 #endif /* RELIANTUNIX */
74 #include <sys/types.h>
76 #ifdef TIME_WITH_SYS_TIME
80 #ifdef HAVE_SYS_TIME_H
87 #ifdef HAVE_SYS_RESOURCE_H
88 #include <sys/resource.h>
98 #ifdef HAVE_SYS_PARAM_H
99 #include <sys/param.h>
106 #ifdef HAVE_SYS_SOCKET_H
107 #include <sys/socket.h>
110 #ifdef HAVE_UNIXSOCKET
114 #ifdef HAVE_SYS_SYSCALL_H
115 #include <sys/syscall.h>
124 #ifdef HAVE_STRINGS_H
139 #ifdef HAVE_SYS_FCNTL_H
140 #include <sys/fcntl.h>
144 #include <sys/stat.h>
150 #ifdef HAVE_SYS_IOCTL_H
151 #include <sys/ioctl.h>
154 #ifdef HAVE_SYS_FILIO_H
155 #include <sys/filio.h>
160 #ifdef HAVE_SYS_WAIT_H
161 #include <sys/wait.h>
169 #ifdef HAVE_SYS_PRIV_H
170 #include <sys/priv.h>
182 #ifdef HAVE_SYS_SELECT_H
183 #include <sys/select.h>
186 #ifdef HAVE_SYS_MODE_H
187 /* apparently AIX needs this for S_ISLNK */
189 #include <sys/mode.h>
205 #include <netinet/in.h>
206 #include <arpa/inet.h>
211 #ifdef HAVE_SYS_FILE_H
212 #include <sys/file.h>
215 #ifdef HAVE_NETINET_TCP_H
216 #include <netinet/tcp.h>
220 * The next three defines are needed to access the IPTOS_* options
224 #ifdef HAVE_NETINET_IN_SYSTM_H
225 #include <netinet/in_systm.h>
228 #ifdef HAVE_NETINET_IN_IP_H
229 #include <netinet/in_ip.h>
232 #ifdef HAVE_NETINET_IP_H
233 #include <netinet/ip.h>
236 #if defined(HAVE_TERMIOS_H)
237 /* POSIX terminal handling. */
239 #elif defined(HAVE_TERMIO_H)
240 /* Older SYSV terminal handling - don't use if we can avoid it. */
242 #elif defined(HAVE_SYS_TERMIO_H)
243 /* Older SYSV terminal handling - don't use if we can avoid it. */
244 #include <sys/termio.h>
249 # define NAMLEN(dirent) strlen((dirent)->d_name)
251 # define dirent direct
252 # define NAMLEN(dirent) (dirent)->d_namlen
254 # include <sys/ndir.h>
257 # include <sys/dir.h>
264 #ifdef HAVE_SYS_MMAN_H
265 #include <sys/mman.h>
273 #ifdef HAVE_SYS_MOUNT_H
274 #include <sys/mount.h>
277 #ifdef HAVE_SYS_VFS_H
281 #ifdef HAVE_SYS_ACL_H
285 #ifdef HAVE_SYS_FS_S5PARAM_H
286 #include <sys/fs/s5param.h>
289 #if defined (HAVE_SYS_FILSYS_H) && !defined (_CRAY)
290 #include <sys/filsys.h>
293 #ifdef HAVE_SYS_STATFS_H
294 # include <sys/statfs.h>
298 #include <sys/dustat.h>
301 #ifdef HAVE_SYS_STATVFS_H
302 #include <sys/statvfs.h>
309 #ifdef HAVE_GETPWANAM
310 #include <sys/label.h>
311 #include <sys/audit.h>
315 #ifdef HAVE_SYS_SECURITY_H
316 #include <sys/security.h>
318 #define PASSWORD_LENGTH 16
319 #endif /* HAVE_SYS_SECURITY_H */
325 #ifdef HAVE_STROPTS_H
333 #ifdef HAVE_SYS_CAPABILITY_H
335 #if defined(BROKEN_REDHAT_7_SYSTEM_HEADERS) && !defined(_I386_STATFS_H)
336 #define _I386_STATFS_H
337 #define BROKEN_REDHAT_7_STATFS_WORKAROUND
340 #include <sys/capability.h>
342 #ifdef BROKEN_REDHAT_7_STATFS_WORKAROUND
343 #undef _I386_STATFS_H
344 #undef BROKEN_REDHAT_7_STATFS_WORKAROUND
349 #if defined(HAVE_RPC_RPC_H)
351 * Check for AUTH_ERROR define conflict with rpc/rpc.h in prot.h.
353 #if defined(HAVE_SYS_SECURITY_H) && defined(HAVE_RPC_AUTH_ERROR_CONFLICT)
359 #if defined(HAVE_YP_GET_DEFAULT_DOMAIN) && defined(HAVE_SETNETGRENT) && defined(HAVE_ENDNETGRENT) && defined(HAVE_GETNETGRENT)
360 #define HAVE_NETGROUP 1
363 #if defined (HAVE_NETGROUP)
364 #if defined(HAVE_RPCSVC_YP_PROT_H)
365 #include <rpcsvc/yp_prot.h>
367 #if defined(HAVE_RPCSVC_YPCLNT_H)
368 #include <rpcsvc/ypclnt.h>
370 #endif /* HAVE_NETGROUP */
372 #if defined(HAVE_SYS_IPC_H)
374 #endif /* HAVE_SYS_IPC_H */
376 #if defined(HAVE_SYS_SHM_H)
378 #endif /* HAVE_SYS_SHM_H */
381 * Define VOLATILE if needed.
384 #if defined(HAVE_VOLATILE)
385 #define VOLATILE volatile
391 * Define additional missing types
393 #if defined(HAVE_SIG_ATOMIC_T_TYPE) && defined(AIX)
394 typedef sig_atomic_t SIG_ATOMIC_T
;
395 #elif defined(HAVE_SIG_ATOMIC_T_TYPE) && !defined(AIX)
396 typedef sig_atomic_t VOLATILE SIG_ATOMIC_T
;
398 typedef int VOLATILE SIG_ATOMIC_T
;
401 #ifndef HAVE_SOCKLEN_T_TYPE
402 typedef int socklen_t
;
407 #define uchar unsigned char
410 #ifdef HAVE_UNSIGNED_CHAR
411 #define schar signed char
417 Samba needs type definitions for int16, int32, uint16 and uint32.
419 Normally these are signed and unsigned 16 and 32 bit integers, but
420 they actually only need to be at least 16 and 32 bits
421 respectively. Thus if your word size is 8 bytes just defining them
422 as signed and unsigned int will work.
426 #define uint8 unsigned char
429 #if !defined(int16) && !defined(HAVE_INT16_FROM_RPC_RPC_H)
430 #if (SIZEOF_SHORT == 4)
431 #define int16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
432 #else /* SIZEOF_SHORT != 4 */
434 #endif /* SIZEOF_SHORT != 4 */
438 * Note we duplicate the size tests in the unsigned
439 * case as int16 may be a typedef from rpc/rpc.h
442 #if !defined(uint16) && !defined(HAVE_UINT16_FROM_RPC_RPC_H)
443 #if (SIZEOF_SHORT == 4)
444 #define uint16 __ERROR___CANNOT_DETERMINE_TYPE_FOR_INT16;
445 #else /* SIZEOF_SHORT != 4 */
446 #define uint16 unsigned short
447 #endif /* SIZEOF_SHORT != 4 */
450 #if !defined(int32) && !defined(HAVE_INT32_FROM_RPC_RPC_H)
451 #if (SIZEOF_INT == 4)
453 #elif (SIZEOF_LONG == 4)
455 #elif (SIZEOF_SHORT == 4)
458 /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
464 * Note we duplicate the size tests in the unsigned
465 * case as int32 may be a typedef from rpc/rpc.h
468 #if !defined(uint32) && !defined(HAVE_UINT32_FROM_RPC_RPC_H)
469 #if (SIZEOF_INT == 4)
470 #define uint32 unsigned int
471 #elif (SIZEOF_LONG == 4)
472 #define uint32 unsigned long
473 #elif (SIZEOF_SHORT == 4)
474 #define uint32 unsigned short
476 /* uggh - no 32 bit type?? probably a CRAY. just hope this works ... */
477 #define uint32 unsigned
482 * Types for devices, inodes and offsets.
486 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)
487 # define SMB_DEV_T dev64_t
489 # define SMB_DEV_T dev_t
494 * Setup the correctly sized inode type.
498 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)
499 # define SMB_INO_T ino64_t
501 # define SMB_INO_T ino_t
505 #ifndef LARGE_SMB_INO_T
506 # if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_INO64_T)) || (defined(SIZEOF_INO_T) && (SIZEOF_INO_T == 8))
507 # define LARGE_SMB_INO_T 1
511 #ifdef LARGE_SMB_INO_T
512 #define SINO_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
514 #define SINO_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
518 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)
519 # define SMB_OFF_T off64_t
521 # define SMB_OFF_T off_t
525 /* this should really be a 64 bit type if possible */
526 #define br_off SMB_BIG_UINT
528 #define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
531 * Set the define that tells us if we can do 64 bit
535 #ifndef LARGE_SMB_OFF_T
536 # if (defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_OFF64_T)) || (defined(SIZEOF_OFF_T) && (SIZEOF_OFF_T == 8))
537 # define LARGE_SMB_OFF_T 1
541 #ifdef LARGE_SMB_OFF_T
542 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
543 #define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,(v)&0xFFFFFFFF), SIVAL(p,ofs,(v)>>32))
544 #define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF) )))
545 #define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
546 (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
548 #define SOFF_T(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
549 #define SOFF_T_R(p, ofs, v) (SIVAL(p,(ofs)+4,v),SIVAL(p,ofs,0))
550 #define IVAL_TO_SMB_OFF_T(buf,off) ((SMB_OFF_T)(( ((uint32)(IVAL((buf),(off)))) & 0xFFFFFFFF )))
551 #define IVAL2_TO_SMB_BIG_UINT(buf,off) ( (((SMB_BIG_UINT)(IVAL((buf),(off)))) & ((SMB_BIG_UINT)0xFFFFFFFF)) | \
552 (( ((SMB_BIG_UINT)(IVAL((buf),(off+4)))) & ((SMB_BIG_UINT)0xFFFFFFFF) ) << 32 ) )
556 * Type for stat structure.
559 #ifndef SMB_STRUCT_STAT
560 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STAT64) && defined(HAVE_OFF64_T)
561 # define SMB_STRUCT_STAT struct stat64
563 # define SMB_STRUCT_STAT struct stat
568 * Type for dirent structure.
571 #ifndef SMB_STRUCT_DIRENT
572 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_DIRENT64)
573 # define SMB_STRUCT_DIRENT struct dirent64
575 # define SMB_STRUCT_DIRENT struct dirent
580 * Defines for 64 bit fcntl locks.
583 #ifndef SMB_STRUCT_FLOCK
584 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
585 # define SMB_STRUCT_FLOCK struct flock64
587 # define SMB_STRUCT_FLOCK struct flock
592 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
593 # define SMB_F_SETLKW F_SETLKW64
595 # define SMB_F_SETLKW F_SETLKW
600 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
601 # define SMB_F_SETLK F_SETLK64
603 # define SMB_F_SETLK F_SETLK
608 # if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_STRUCT_FLOCK64) && defined(HAVE_OFF64_T)
609 # define SMB_F_GETLK F_GETLK64
611 # define SMB_F_GETLK F_GETLK
615 #if defined(HAVE_LONGLONG)
616 #define SMB_BIG_UINT unsigned long long
617 #define SMB_BIG_INT long long
618 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,(v)&0xFFFFFFFF), SIVAL(p,(ofs)+4,(v)>>32))
620 #define SMB_BIG_UINT unsigned long
621 #define SMB_BIG_INT long
622 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
625 #define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8)
628 #define MIN(a,b) ((a)<(b)?(a):(b))
632 #define MAX(a,b) ((a)>(b)?(a):(b))
635 #ifndef HAVE_STRERROR
636 extern char *sys_errlist
[];
637 #define strerror(i) sys_errlist[i]
641 # define strchr index
642 # define strrchr rindex
645 #ifndef HAVE_ERRNO_DECL
649 #ifdef HAVE_BROKEN_GETGROUPS
656 #define NGROUPS_MAX 32 /* Guess... */
659 /* Lists, trees, caching, database... */
660 #include "ubi_sLinkList.h"
661 #include "ubi_dLinkList.h"
662 #include "dlinklist.h"
663 #include "../tdb/tdb.h"
664 #include "../tdb/spinlock.h"
666 #include "interfaces.h"
672 #include "messages.h"
674 #include "util_getent.h"
676 #ifndef UBI_BINTREE_H
677 #include "ubi_Cache.h"
678 #endif /* UBI_BINTREE_H */
680 #include "debugparse.h"
685 #include "nameserv.h"
687 #include "byteorder.h"
692 #include "ntdomain.h"
706 #ifndef MAXCODEPAGELINES
707 #define MAXCODEPAGELINES 256
711 * Type for wide character dirent structure.
712 * Only d_name is defined by POSIX.
715 typedef struct smb_wdirent
{
717 } SMB_STRUCT_WDIRENT
;
720 * Type for wide character passwd structure.
723 typedef struct smb_wpasswd
{
731 } SMB_STRUCT_WPASSWD
;
733 /* Defines for wisXXX functions. */
734 #define UNI_UPPER 0x1
735 #define UNI_LOWER 0x2
736 #define UNI_DIGIT 0x4
737 #define UNI_XDIGIT 0x8
738 #define UNI_SPACE 0x10
740 #include "nsswitch/sys_nss.h"
742 /***** automatically generated prototypes *****/
745 /* String routines */
747 #include "safe_string.h"
750 #define QSORT_CAST (__compar_fn_t)
754 #define QSORT_CAST (int (*)(const void *, const void *))
757 /* this guess needs to be improved (tridge) */
758 #if (defined(STAT_STATVFS) || defined(STAT_STATVFS64)) && !defined(SYSV)
763 * Veritas File System. Often in addition to native.
766 #if defined(HAVE_SYS_FS_VX_QUOTA_H)
770 #ifndef DEFAULT_PRINTING
772 #define DEFAULT_PRINTING PRINT_CUPS
773 #define PRINTCAP_NAME "cups"
775 #define DEFAULT_PRINTING PRINT_SYSV
776 #define PRINTCAP_NAME "lpstat"
778 #define DEFAULT_PRINTING PRINT_BSD
779 #define PRINTCAP_NAME "/etc/printcap"
783 #ifndef PRINTCAP_NAME
784 #define PRINTCAP_NAME "/etc/printcap"
788 #define SIGCLD SIGCHLD
795 #if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP) && !defined(WITH_TDB_SAM))
796 #define USE_SMBPASS_DB 1
799 #if defined(HAVE_PUTPRPWNAM) && defined(AUTH_CLEARTEXT_SEG_CHARS)
800 #define OSF1_ENH_SEC 1
803 #ifndef ALLOW_CHANGE_PASSWORD
804 #if (defined(HAVE_TERMIOS_H) && defined(HAVE_DUP2) && defined(HAVE_SETSID))
805 #define ALLOW_CHANGE_PASSWORD 1
809 /* what is the longest significant password available on your system?
810 Knowing this speeds up password searches a lot */
811 #ifndef PASSWORD_LENGTH
812 #define PASSWORD_LENGTH 8
815 #ifdef REPLACE_INET_NTOA
816 #define inet_ntoa rep_inet_ntoa
824 #define MAXPATHLEN 256
831 #ifndef INADDR_LOOPBACK
832 #define INADDR_LOOPBACK 0x7f000001
836 #define INADDR_NONE 0xffffffff
840 #define crypt ufc_crypt
844 #define O_ACCMODE (O_RDONLY | O_WRONLY | O_RDWR)
847 #if defined(HAVE_CRYPT16) && defined(HAVE_GETAUTHUID)
848 #define ULTRIX_AUTH 1
851 #ifdef HAVE_LIBREADLINE
852 # ifdef HAVE_READLINE_READLINE_H
853 # include <readline/readline.h>
854 # ifdef HAVE_READLINE_HISTORY_H
855 # include <readline/history.h>
858 # ifdef HAVE_READLINE_H
859 # include <readline.h>
860 # ifdef HAVE_HISTORY_H
861 # include <history.h>
864 # undef HAVE_LIBREADLINE
870 char *strdup(const char *s
);
874 void *memmove(void *dest
,const void *src
,int size
);
877 #ifndef HAVE_INITGROUPS
878 int initgroups(char *name
,gid_t id
);
882 int rename(const char *zfrom
, const char *zto
);
886 time_t mktime(struct tm
*t
);
890 size_t strlcpy(char *d
, const char *s
, size_t bufsize
);
894 size_t strlcat(char *d
, const char *s
, size_t bufsize
);
897 #ifndef HAVE_FTRUNCATE
898 int ftruncate(int f
,long l
);
902 char *strndup(const char *s
, size_t n
);
906 size_t strnlen(const char *s
, size_t n
);
910 unsigned long strtoul(const char *nptr
, char **endptr
, int base
);
913 #if (defined(USE_SETRESUID) && !defined(HAVE_SETRESUID_DECL))
915 int setresuid(uid_t ruid
, uid_t euid
, uid_t suid
);
917 #if (defined(USE_SETRESUID) && !defined(HAVE_SETRESGID_DECL))
918 int setresgid(gid_t rgid
, gid_t egid
, gid_t sgid
);
920 #ifndef HAVE_VASPRINTF_DECL
921 int vasprintf(char **ptr
, const char *format
, va_list ap
);
924 #if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
925 #define bzero(a,b) memset((a),'\0',(b))
928 #ifdef REPLACE_GETPASS
929 #define getpass(prompt) getsmbpass((prompt))
933 * Some older systems seem not to have MAXHOSTNAMELEN
936 #ifndef MAXHOSTNAMELEN
937 #define MAXHOSTNAMELEN 254
940 /* yuck, I'd like a better way of doing this */
941 #define DIRP_SIZE (256 + 32)
944 * glibc on linux doesn't seem to have MSG_WAITALL
945 * defined. I think the kernel has it though..
949 #define MSG_WAITALL 0
952 /* default socket options. Dave Miller thinks we should default to TCP_NODELAY
953 given the socket IO pattern that Samba uses */
955 #define DEFAULT_SOCKET_OPTIONS "TCP_NODELAY"
957 #define DEFAULT_SOCKET_OPTIONS ""
960 /* Load header file for libdl stuff */
966 /* Some POSIX definitions for those without */
969 #define S_IFDIR 0x4000
972 #define S_ISDIR(mode) ((mode & 0xF000) == S_IFDIR)
975 #define S_IRWXU 00700 /* read, write, execute: owner */
978 #define S_IRUSR 00400 /* read permission: owner */
981 #define S_IWUSR 00200 /* write permission: owner */
984 #define S_IXUSR 00100 /* execute permission: owner */
987 #define S_IRWXG 00070 /* read, write, execute: group */
990 #define S_IRGRP 00040 /* read permission: group */
993 #define S_IWGRP 00020 /* write permission: group */
996 #define S_IXGRP 00010 /* execute permission: group */
999 #define S_IRWXO 00007 /* read, write, execute: other */
1002 #define S_IROTH 00004 /* read permission: other */
1005 #define S_IWOTH 00002 /* write permission: other */
1008 #define S_IXOTH 00001 /* execute permission: other */
1011 /* For sys_adminlog(). */
1013 #define LOG_EMERG 0 /* system is unusable */
1017 #define LOG_ALERT 1 /* action must be taken immediately */
1021 #define LOG_CRIT 2 /* critical conditions */
1025 #define LOG_ERR 3 /* error conditions */
1029 #define LOG_WARNING 4 /* warning conditions */
1033 #define LOG_NOTICE 5 /* normal but significant condition */
1037 #define LOG_INFO 6 /* informational */
1041 #define LOG_DEBUG 7 /* debug-level messages */
1044 /* NetBSD doesn't have these */
1053 #if HAVE_KERNEL_SHARE_MODES
1055 #define LOCK_MAND 32 /* This is a mandatory flock */
1056 #define LOCK_READ 64 /* ... Which allows concurrent read operations */
1057 #define LOCK_WRITE 128 /* ... Which allows concurrent write operations */
1058 #define LOCK_RW 192 /* ... Which allows concurrent read & write ops */
1062 extern int DEBUGLEVEL
;
1064 #define MAX_SEC_CTX_DEPTH 8 /* Maximum number of security contexts */
1067 #ifdef GLIBC_HACK_FCNTL64
1068 /* this is a gross hack. 64 bit locking is completely screwed up on
1069 i386 Linux in glibc 2.1.95 (which ships with RedHat 7.0). This hack
1070 "fixes" the problem with the current 2.4.0test kernels
1072 #define fcntl fcntl64
1079 /* Needed for sys_dlopen/sys_dlsym/sys_dlclose */
1081 #define RTLD_GLOBAL 0
1092 /* add varargs prototypes with printf checking */
1093 int fdprintf(int , char *, ...) PRINTF_ATTRIBUTE(2,3);
1094 #ifndef HAVE_SNPRINTF_DECL
1095 int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
1097 #ifndef HAVE_ASPRINTF_DECL
1098 int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
1101 /* we used to use these fns, but now we have good replacements
1102 for snprintf and vsnprintf */
1103 #define slprintf snprintf
1104 #define vslprintf vsnprintf
1106 /* we need to use __va_copy() on some platforms */
1108 #define VA_COPY(dest, src) __va_copy(dest, src)
1110 #define VA_COPY(dest, src) (dest) = (src)
1113 #endif /* _INCLUDES_H */