an initial fix for handling sparse files in smbd
[import/samba-cvsimport.git] / source / include / includes.h
index 70fc41034c218ecf7d3ee73ec65e04d631d943b1..6084d583ed6aa5b5235f520f16a76ce39bc81188 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef _INCLUDES_H
 #define _INCLUDES_H
 /* 
-   Unix SMB/Netbios implementation.
-   Version 1.9.
+   Unix SMB/CIFS implementation.
    Machine customisation and include handling
    Copyright (C) Andrew Tridgell 1994-1998
+   Copyright (C) 2002 by Martin Pool <mbp@samba.org>
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #define PRINTF_ATTRIBUTE(a1, a2)
 #endif
 
+#ifdef __GNUC__
+/** gcc attribute used on function parameters so that it does not emit
+ * warnings about them being unused. **/
+#  define UNUSED(param) param __attribute__ ((unused))
+#else
+#  define UNUSED(param) param
+/** Feel free to add definitions for other compilers here. */
+#endif
+
 #ifdef RELIANTUNIX
 /*
  * <unistd.h> has to be included before any other to get
 /*
  * Define additional missing types
  */
-#ifndef HAVE_SIG_ATOMIC_T_TYPE
-typedef int sig_atomic_t;
+#if defined(HAVE_SIG_ATOMIC_T_TYPE) && defined(AIX)
+typedef sig_atomic_t SIG_ATOMIC_T;
+#elif defined(HAVE_SIG_ATOMIC_T_TYPE) && !defined(AIX)
+typedef sig_atomic_t VOLATILE SIG_ATOMIC_T;
+#else
+typedef int VOLATILE SIG_ATOMIC_T;
 #endif
 
 #ifndef HAVE_SOCKLEN_T_TYPE
@@ -514,7 +527,11 @@ typedef int socklen_t;
  */
 
 #ifndef SMB_DEV_T
-#define SMB_DEV_T dev_t
+#  if defined(HAVE_EXPLICIT_LARGEFILE_SUPPORT) && defined(HAVE_DEV64_T)
+#    define SMB_DEV_T dev64_t
+#  else
+#    define SMB_DEV_T dev_t
+#  endif
 #endif
 
 /*
@@ -672,6 +689,9 @@ extern int errno;
 #define NGROUPS_MAX 32 /* Guess... */
 #endif
 
+/* Our own pstrings and fstrings */
+#include "pstring.h"
+
 /* Lists, trees, caching, database... */
 #include "xfile.h"
 #include "intl.h"
@@ -680,17 +700,18 @@ extern int errno;
 #include "dlinklist.h"
 #include "../tdb/tdb.h"
 #include "../tdb/spinlock.h"
+#include "../tdb/tdbutil.h"
 #include "talloc.h"
 #include "ads.h"
 #include "interfaces.h"
 #include "hash.h"
 #include "trans2.h"
 #include "nterr.h"
-#include "secrets.h"
+#include "ntioctl.h"
 #include "messages.h"
-#include "util_list.h"
 #include "charset.h"
 #include "dynconfig.h"
+#include "adt_tree.h"
 
 #include "util_getent.h"
 
@@ -705,6 +726,8 @@ extern int errno;
 #include "smbw.h"
 #include "nameserv.h"
 
+#include "secrets.h"
+
 #include "byteorder.h"
 
 #include "ntdomain.h"
@@ -722,15 +745,15 @@ extern int errno;
 
 #include "auth.h"
 
+#include "passdb.h"
+
 #include "session.h"
 
 #include "asn_1.h"
 
 #include "popt.h"
 
-#ifndef MAXCODEPAGELINES
-#define MAXCODEPAGELINES 256
-#endif
+#include "mangle.h"
 
 /*
  * Type for wide character dirent structure.
@@ -922,6 +945,14 @@ size_t strlcat(char *d, const char *s, size_t bufsize);
 int ftruncate(int f,long l);
 #endif
 
+#ifndef HAVE_STRNDUP
+char *strndup(const char *s, size_t n);
+#endif
+
+#ifndef HAVE_STRNLEN
+size_t strnlen(const char *s, size_t n);
+#endif
+
 #ifndef HAVE_STRTOUL
 unsigned long strtoul(const char *nptr, char **endptr, int base);
 #endif
@@ -973,15 +1004,15 @@ int vasprintf(char **ptr, const char *format, va_list ap);
 #define DEFAULT_SOCKET_OPTIONS ""
 #endif
 
-/* Load header file for libdl stuff */
+/* Load header file for dynamic linking stuff */
 
-#ifdef HAVE_LIBDL
+#ifdef HAVE_DLFCN_H
 #include <dlfcn.h>
 #endif
 
 /* dmalloc -- free heap debugger (dmalloc.org).  This should be near
  * the *bottom* of include files so as not to conflict. */
-#ifdef DMALLOC
+#ifdef ENABLE_DMALLOC
 #  include <dmalloc.h>
 #endif
 
@@ -1031,6 +1062,39 @@ int vasprintf(char **ptr, const char *format, va_list ap);
 #define S_IXOTH 00001           /* execute permission: other */
 #endif
 
+/* For sys_adminlog(). */
+#ifndef LOG_EMERG
+#define LOG_EMERG       0       /* system is unusable */
+#endif
+
+#ifndef LOG_ALERT
+#define LOG_ALERT       1       /* action must be taken immediately */
+#endif
+
+#ifndef LOG_CRIT
+#define LOG_CRIT        2       /* critical conditions */
+#endif
+
+#ifndef LOG_ERR
+#define LOG_ERR         3       /* error conditions */
+#endif
+
+#ifndef LOG_WARNING
+#define LOG_WARNING     4       /* warning conditions */
+#endif
+
+#ifndef LOG_NOTICE
+#define LOG_NOTICE      5       /* normal but significant condition */
+#endif
+
+#ifndef LOG_INFO
+#define LOG_INFO        6       /* informational */
+#endif
+
+#ifndef LOG_DEBUG
+#define LOG_DEBUG       7       /* debug-level messages */
+#endif
+
 /* NetBSD doesn't have these */
 #ifndef SHM_R
 #define SHM_R 0400
@@ -1102,5 +1166,13 @@ int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
 #define slprintf snprintf
 #define vslprintf vsnprintf
 
+
+/* we need to use __va_copy() on some platforms */
+#ifdef HAVE_VA_COPY
+#define VA_COPY(dest, src) __va_copy(dest, src)
+#else
+#define VA_COPY(dest, src) (dest) = (src)
+#endif
+
 #endif /* _INCLUDES_H */