Herb's warning fixes. Also the POSIX locking fix.
[samba.git] / source3 / include / includes.h
index 3e9010bf548b19c5aa6ec2cb4be338f5bbd3bd07..da365ab953d674cab4c4dd4bf9170c820fc12eee 100644 (file)
 #endif
 
 #ifdef LINUX
+#ifndef DEFAULT_PRINTING
 #define DEFAULT_PRINTING PRINT_BSD
+#endif
+#ifndef PRINTCAP_NAME
 #define PRINTCAP_NAME "/etc/printcap"
 #endif
+#endif
 
 #ifdef RELIANTUNIX
 /*
 #endif
 #endif /* RELIANTUNIX */
 
-#ifdef HAVE_SYSV_IPC
-#define USE_SYSV_IPC
-#endif
-
-#ifdef HAVE_SHARED_MMAP
-#define USE_SHARED_MMAP
-#endif
-
-
-/* if we have both SYSV IPC and shared mmap then we need to choose */
-#if (defined(USE_SYSV_IPC) && defined(USE_SHARED_MMAP))
-#  undef USE_SHARED_MMAP
-#endif
-
 #include <sys/types.h>
 
 #ifdef TIME_WITH_SYS_TIME
 #include <sys/socket.h>
 #endif
 
+#ifdef HAVE_SYS_UN_H
+#include <sys/un.h>
+#endif
+
 #ifdef HAVE_SYS_SYSCALL_H
 #include <sys/syscall.h>
 #elif HAVE_SYSCALL_H
 #endif
 
 #include <pwd.h>
-#include <grp.h>
 
 #ifdef HAVE_STDARG_H
 #include <stdarg.h>
 #include <sys/mman.h>
 #endif
 
-#ifdef HAVE_SYSV_IPC
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/sem.h>
-#endif
-
 #ifdef HAVE_NET_IF_H
 #include <net/if.h>
 #endif
 #  endif
 #endif
 
+/* this should really be a 64 bit type if possible */
+#define br_off SMB_BIG_UINT
+
 #define SMB_OFF_T_BITS (sizeof(SMB_OFF_T)*8)
 
 /*
 #define SBIG_UINT(p, ofs, v) (SIVAL(p,ofs,v),SIVAL(p,(ofs)+4,0))
 #endif
 
+#define SMB_BIG_UINT_BITS (sizeof(SMB_BIG_UINT)*8)
+
 #ifndef MIN
 #define MIN(a,b) ((a)<(b)?(a):(b))
 #endif
@@ -605,19 +597,23 @@ extern int errno;
 #define GID_T gid_t
 #endif
 
+#ifndef NGROUPS_MAX
+#define NGROUPS_MAX 32 /* Guess... */
+#endif
 
-/* Lists, trees, caching, datbase... */
+/* Lists, trees, caching, database... */
 #include "ubi_sLinkList.h"
 #include "ubi_dLinkList.h"
 #include "dlinklist.h"
 #include "../tdb/tdb.h"
+#include "talloc.h"
 #include "interfaces.h"
-
-#ifdef HAVE_FNMATCH
-#include <fnmatch.h>
-#else
-#include "fnmatch.h"
-#endif
+#include "hash.h"
+#include "trans2.h"
+#include "nterr.h"
+#include "secrets.h"
+#include "messages.h"
+#include "util_list.h"
 
 #ifndef UBI_BINTREE_H
 #include "ubi_Cache.h"
@@ -635,11 +631,11 @@ extern int errno;
 #include "kanji.h"
 #include "charset.h"
 
-#include "nterr.h"
+#include "ntdomain.h"
+
+#include "msdfs.h"
 
-#ifdef WITH_PROFILE
 #include "profile.h"
-#endif
 
 #ifndef MAXCODEPAGELINES
 #define MAXCODEPAGELINES 256
@@ -675,34 +671,26 @@ typedef struct smb_wpasswd {
 #define UNI_XDIGIT   0x8
 #define UNI_SPACE    0x10
 
-/***** automatically generated prototypes *****/
-#include "proto.h"
+#ifdef HAVE_NSS_H
+#include <nss.h>
+#else
 
-#ifdef strcpy
-#undef strcpy
-#endif /* strcpy */
-#define strcpy(dest,src) __ERROR__XX__NEVER_USE_STRCPY___;
+/* Minimal needed to compile.. */
 
-#ifdef strcat
-#undef strcat
-#endif /* strcat */
-#define strcat(dest,src) __ERROR__XX__NEVER_USE_STRCAT___;
+enum nss_status {
+       NSS_STATUS_SUCCESS,
+       NSS_STATUS_NOTFOUND,
+       NSS_STATUS_UNAVAIL
+};
 
-#ifdef sprintf
-#undef sprintf
-#endif /* sprintf */
-#define sprintf __ERROR__XX__NEVER_USE_SPRINTF__;
+#endif
 
-#define pstrcpy(d,s) safe_strcpy((d),(s),sizeof(pstring)-1)
-#define pstrcat(d,s) safe_strcat((d),(s),sizeof(pstring)-1)
-#define fstrcpy(d,s) safe_strcpy((d),(s),sizeof(fstring)-1)
-#define fstrcat(d,s) safe_strcat((d),(s),sizeof(fstring)-1)
+/***** automatically generated prototypes *****/
+#include "proto.h"
+
+/* String routines */
 
-/* smb_ucs2_t versions of the above. */
-#define wpstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wpstring))
-#define wpstrcat(d,s) safe_strcat_w((d),(s),sizeof(wpstring))
-#define wfstrcpy(d,s) safe_strcpy_w((d),(s),sizeof(wfstring))
-#define wfstrcat(d,s) safe_strcat_w((d),(s),sizeof(wfstring))
+#include "safe_string.h"
 
 #ifdef __COMPAR_FN_T
 #define QSORT_CAST (__compar_fn_t)
@@ -738,24 +726,10 @@ typedef struct smb_wpasswd {
 #define SIGCLD SIGCHLD
 #endif
 
-#if (defined(HAVE_SYSV_IPC) || defined(HAVE_SHARED_MMAP))
-#define FAST_SHARE_MODES 1
-#endif
-
 #ifndef MAP_FILE
 #define MAP_FILE 0
 #endif
 
-#ifdef HAVE_SYSV_IPC
-#ifndef HAVE_UNION_SEMUN
-union semun {
-       int val;
-       struct semid_ds *buf;
-       unsigned short *array;
-};
-#endif
-#endif
-
 #if (!defined(WITH_NISPLUS) && !defined(WITH_LDAP))
 #define USE_SMBPASS_DB 1
 #endif
@@ -902,4 +876,91 @@ int setresgid(gid_t rgid, gid_t egid, gid_t sgid);
 #define DEFAULT_SOCKET_OPTIONS ""
 #endif
 
+/* Load header file for libdl stuff */
+
+#ifdef HAVE_LIBDL
+#include <dlfcn.h>
+#endif
+
+/* Some POSIX definitions for those without */
+#ifndef S_IFDIR
+#define S_IFDIR         0x4000
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(mode)   ((mode & 0xF000) == S_IFDIR)
+#endif
+#ifndef S_IRWXU
+#define S_IRWXU 00700           /* read, write, execute: owner */
+#endif
+#ifndef S_IRUSR
+#define S_IRUSR 00400           /* read permission: owner */
+#endif
+#ifndef S_IWUSR
+#define S_IWUSR 00200           /* write permission: owner */
+#endif
+#ifndef S_IXUSR
+#define S_IXUSR 00100           /* execute permission: owner */
+#endif
+#ifndef S_IRWXG
+#define S_IRWXG 00070           /* read, write, execute: group */
+#endif
+#ifndef S_IRGRP
+#define S_IRGRP 00040           /* read permission: group */
+#endif
+#ifndef S_IWGRP
+#define S_IWGRP 00020           /* write permission: group */
+#endif
+#ifndef S_IXGRP
+#define S_IXGRP 00010           /* execute permission: group */
+#endif
+#ifndef S_IRWXO
+#define S_IRWXO 00007           /* read, write, execute: other */
+#endif
+#ifndef S_IROTH
+#define S_IROTH 00004           /* read permission: other */
+#endif
+#ifndef S_IWOTH
+#define S_IWOTH 00002           /* write permission: other */
+#endif
+#ifndef S_IXOTH
+#define S_IXOTH 00001           /* execute permission: other */
+#endif
+
+/* Some systems (SCO) treat UNIX domain sockets as FIFOs */
+
+#ifndef S_IFSOCK
+#define S_IFSOCK S_IFIFO
+#endif
+#ifndef S_ISSOCK
+#define S_ISSOCK(mode)  ((mode & S_IFSOCK) == S_IFSOCK)
+#endif
+
+#if HAVE_KERNEL_SHARE_MODES
+#ifndef LOCK_MAND 
+#define LOCK_MAND      32      /* This is a mandatory flock */
+#define LOCK_READ      64      /* ... Which allows concurrent read operations */
+#define LOCK_WRITE     128     /* ... Which allows concurrent write operations */
+#define LOCK_RW                192     /* ... Which allows concurrent read & write ops */
+#endif
+#endif
+
+extern int DEBUGLEVEL;
+
+#define MAX_SEC_CTX_DEPTH 8    /* Maximum number of security contexts */
+
+
+#ifdef GLIBC_HACK_FCNTL64
+/* this is a gross hack. 64 bit locking is completely screwed up on
+   i386 Linux in glibc 2.1.95 (which ships with RedHat 7.0). This hack
+   "fixes" the problem with the current 2.4.0test kernels 
+*/
+#define fcntl fcntl64
+#undef F_SETLKW 
+#undef F_SETLK 
+#define F_SETLK 13
+#define F_SETLKW 14
+#endif
+
 #endif /* _INCLUDES_H */
+