Changes to allow Samba to be compiled with -Wstrict-prototypes
[kai/samba.git] / source3 / include / includes.h
index cc2bbbfad7c0c674438a17c30e4c3f10227c67fc..8cc2711e0a348b11f5224b2841968c0caa15ddc7 100644 (file)
@@ -4,7 +4,7 @@
    Unix SMB/Netbios implementation.
    Version 1.9.
    Machine customisation and include handling
-   Copyright (C) Andrew Tridgell 1994-1995
+   Copyright (C) Andrew Tridgell 1994-1998
    
    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
 #endif
 
 #include <sys/socket.h>
+#ifdef AXPROC
+#include <termio.h>
+#endif
 #include <sys/ioctl.h>
 #include <stddef.h>
 #ifdef POSIX_H
 #ifdef POSIX_H
 #include <bsd/net/if.h>
 #else
+#ifdef OSF1
+#include <net/route.h>
+#include <sys/mbuf.h>
+#endif
 #include <net/if.h>
 #endif
 #endif
 
-#if USE_MMAP
-#include <sys/mman.h>
-#endif
-
 #if defined(GETPWANAM)
 #include <sys/types.h>
 #include <sys/label.h>
 #include <pwdadj.h>
 #endif
 
-#if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(CONVEX)
+#if defined(SHADOW_PWD) && !defined(NETBSD) && !defined(FreeBSD) && !defined(CONVEX) && !defined(__OpenBSD__)
 #include <shadow.h>
 #endif
 
-/* this might be different on different systems */
-#ifdef QUOTAS 
-#ifdef LINUX
-#ifdef __KERNEL__
-#undef __KERNEL__
-#include <sys/quota.h>
-#define __KERNEL__
-#else
-#include <sys/quota.h>
-#endif
-#include <mntent.h>
-#else
-#include <sys/quota.h>
-#ifndef CRAY
-#include <devnm.h>
-#else
-#include <mntent.h>
-#endif
-#endif
-#endif
-
 #ifdef SYSLOG
 #include <syslog.h>
 #endif
@@ -236,20 +218,36 @@ Here come some platform specific sections
 #include <string.h>
 #include <sys/vfs.h>
 #include <netinet/in.h>
-#ifndef NO_ASMSIGNALH
-#include <asm/signal.h>
+#ifdef GLIBC2
+#define _LINUX_C_LIB_VERSION_MAJOR     6
+#include <termios.h>
+#include <rpcsvc/ypclnt.h>
+#include <crypt.h>
+#include <netinet/tcp.h>
+#include <netinet/ip.h>
 #endif
 #define SIGNAL_CAST (__sighandler_t)
 #define USE_GETCWD
 #define USE_SETSID
 #define HAVE_BZERO
 #define HAVE_MEMMOVE
+#define USE_SIGPROCMASK
+#define USE_WAITPID
+#define USE_SYSV_IPC
+#if 0
+/* SETFS disabled until we can check on some bug reports */
+#if _LINUX_C_LIB_VERSION_MAJOR >= 5
+#define USE_SETFS
+#endif
+#endif
 #ifdef SHADOW_PWD
+#if _LINUX_C_LIB_VERSION_MAJOR < 5
 #ifndef crypt
 #define crypt pw_encrypt
 #endif
 #endif
 #endif
+#endif
 
 #ifdef SUNOS4
 #define SIGNAL_CAST (void (*)(int))
@@ -271,9 +269,22 @@ typedef unsigned short mode_t;
 #include <utime.h>
 #define NO_STRERROR
 #endif
+#ifndef REPLACE_GETPASS
 #define REPLACE_GETPASS
+#endif
+#ifndef BSD_TERMIO
 #define BSD_TERMIO
 #endif
+#ifndef USE_SIGPROCMASK
+#define USE_SIGPROCMASK
+#endif
+#ifndef USE_WAITPID
+#define USE_WAITPID
+#endif
+#define USE_SYSV_IPC
+/* SunOS doesn't have POSIX atexit */
+#define atexit on_exit
+#endif
 
 
 #ifdef SUNOS5
@@ -290,8 +301,11 @@ typedef unsigned short mode_t;
 #include <string.h>
 #include <arpa/inet.h>
 #include <rpcsvc/ypclnt.h>
-#include <crypt.h> 
 #include <termios.h>
+#include <sys/stropts.h>
+#if !defined(USE_LIBDES) && !defined(KRB4_AUTH)
+#include <crypt.h>
+#endif /* !USE_LIBDES && !KRB4_AUTH */
 extern int gettimeofday (struct timeval *, void *);
 extern int gethostname (char *name, int namelen);
 extern int innetgr (const char *, const char *, const char *, const char *);
@@ -305,7 +319,12 @@ extern int innetgr (const char *, const char *, const char *, const char *);
 #define USE_STATVFS
 #define USE_GETCWD
 #define USE_SETSID
+#define USE_SYSV_IPC
+#define NO_SEMUN
+#ifndef REPLACE_GETPASS
 #define REPLACE_GETPASS
+#endif /* REPLACE_GETPASS */
+#define USE_SIGPROCMASK
 #endif
 
 
@@ -323,9 +342,10 @@ char *getwd(char *);
 #define SIGNAL_CAST (void(*)(int))
 #endif
 #define USE_DIRECT
+#define USE_WAITPID
 #endif
 
-#ifdef SGI
+#ifdef SGI4
 #include <netinet/tcp.h>
 #include <sys/statfs.h>
 #include <string.h>
@@ -337,10 +357,15 @@ char *getwd(char *);
 #define STATFS4
 #define USE_WAITPID
 #define USE_DIRECT
+#define USE_SETSID
+#define USE_SYSV_IPC
 #endif
 
-#ifdef SGI5
+#if defined(SGI5) || defined(SGI6)
+#include <arpa/inet.h>
 #include <netinet/tcp.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
 #include <sys/statvfs.h>
 #include <string.h>
 #include <signal.h>
@@ -353,6 +378,8 @@ char *getwd(char *);
 #define SIGNAL_CAST (void (*)())
 #define USE_STATVFS
 #define USE_WAITPID
+#define USE_SETSID
+#define USE_SYSV_IPC
 #endif
 
 
@@ -409,6 +436,8 @@ extern struct passwd *getpwnam();
 #define USE_STATVFS
 #define USE_GETCWD
 #define USE_SETSID
+#define USE_SYSV_IPC
+#define NO_SEMUN
 #endif
 
 
@@ -423,6 +452,7 @@ char *mktemp(char *); /* No standard include */
 #define SIGNAL_CAST ( void (*) (int) )
 #define STATFS3
 #define USE_F_FSIZE
+#define USE_SETSID
 #include <netinet/tcp.h>
 #ifdef OSF1_ENH_SEC
 #include <pwd.h>
@@ -433,6 +463,8 @@ char *mktemp(char *); /* No standard include */
 #define PASSWORD_LENGTH 16
 #define NEED_AUTH_PARAMETERS
 #endif  /* OSF1_ENH_SEC */
+#define USE_SYSV_IPC
+#define NO_SEMUN
 #endif
 
 
@@ -448,7 +480,9 @@ char *mktemp(char *); /* No standard include */
 #define NO_FSYNC
 #define USE_GETCWD
 #define USE_SETSID
+#ifndef REPLACE_GETPASS
 #define REPLACE_GETPASS
+#endif /* REPLACE_GETPASS */
 #define NO_GETRLIMIT
 #endif /* CLIX */
 
@@ -462,30 +496,73 @@ char *mktemp(char *); /* No standard include */
 #endif
 
 
-#ifdef NETBSD
-#include <strings.h>
+#ifdef NETBSD  
+#ifdef NetBSD1_3  
+#include <string.h>  
+#ifdef ALLOW_CHANGE_PASSWORD  
+#include <termios.h>  
+#endif /* ALLOW_CHANGE_PASSWORD */  
+#else /* NetBSD1_3 */
+#include <strings.h>  
+#endif /* NetBSD1_3 */  
 #include <netinet/tcp.h>
 /* you may not need this */
-#define NO_GETSPNAM
+#define NO_GETSPNAM 
 #define SIGNAL_CAST (void (*)())
 #define USE_DIRECT
 #define REPLACE_INNETGR
-#endif 
-
+#endif
 
 
 #ifdef FreeBSD
+#include <arpa/inet.h>
 #include <strings.h>
 #include <netinet/tcp.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
+#include <termios.h>
+#include <fcntl.h>
+#if __FreeBSD__ >= 3
+#include <dirent.h>
+#else
+#define USE_DIRECT
+#endif
+#define SIGNAL_CAST (void (*)(int))
+#define USE_SETVBUF
+#define USE_SETSID
+#define USE_GETCWD
+#define USE_WAITPID
+#define HAVE_MEMMOVE
+#define HAVE_BZERO
+#define HAVE_GETTIMEOFDAY
+#define HAVE_PATHCONF
+#define HAVE_GETGRNAM 1
+#define QSORT_CAST (int (*)(const void *, const void *))
+#if !defined(O_SYNC)
+#if defined(O_FSYNC)
+#define O_SYNC O_FSYNC
+#else /* defined(O_FSYNC) */
+#define O_SYNC 0
+#endif /* defined(O_FSYNC) */
+#endif /* !defined(O_SYNC) */
+#endif /* FreeBSD */
+
+#ifdef __OpenBSD__
+#include <strings.h>
+#include <netinet/tcp.h>
+#define NO_GETSPNAM
 #define SIGNAL_CAST (void (*)())
 #define USE_DIRECT
 #define REPLACE_INNETGR
+#define HAVE_BZERO
+#define HAVE_PATHCONF
+#define HAVE_GETGRNAM 1
+#define HAVE_GETTIMEOFDAY
+#define HAVE_MEMMOVE
+#define USE_GETCWD
+#define USE_SETSID
 #endif 
 
-
-
 #ifdef AIX
 #include <strings.h>
 #include <sys/dir.h>
@@ -495,11 +572,19 @@ char *mktemp(char *); /* No standard include */
 #include <sys/vfs.h>
 #include <sys/id.h>
 #include <sys/priv.h>
+/* According to AIX 4.1 man pages, inet_ntoa needs the following headers */
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
 #include <netinet/tcp.h>
+#include <locale.h>
 #define SYSV
 #define USE_WAITPID
+#define USE_SIGBLOCK
 #define SIGNAL_CAST (void (*)())
 #define DEFAULT_PRINTING PRINT_AIX
+/* we undef this because sys/param.h is broken in aix. uggh. */
+#undef MAXHOSTNAMELEN
 #endif
 
 
@@ -511,22 +596,30 @@ char *mktemp(char *); /* No standard include */
 #include <sys/types.h>
 #include <sys/termios.h>
 #include <netinet/tcp.h>
+#include <arpa/inet.h>                /* needed for inet_ntoa proto */
 #ifdef HPUX_10_TRUSTED
 #include <hpsecurity.h>
 #include <prot.h>
 #define NEED_AUTH_PARAMETERS
 #endif
 #define SIGNAL_CAST (void (*)(__harg))
+#ifndef HPUX10 /* This is only needed for HPUX 9.x */
 #define SELECT_CAST (int *)
+#endif /* HPUX10 */
 #define SYSV
 #define USE_WAITPID
 #define WAIT3_CAST2 (int *)
 #define USE_GETCWD
 #define USE_SETSID
 #define USE_SETRES
+#define USE_SYSV_IPC
+#define NO_SEMUN
 #define DEFAULT_PRINTING PRINT_HPUX
-#define SIGCLD_IGNORE
-#endif
+/* Ken Weiss <krweiss@ucdavis.edu> tells us that SIGCLD_IGNORE is
+   not good for HPUX */
+/* #define SIGCLD_IGNORE */
+#define USE_SIGPROCMASK /* Needed to stop zombie processes on HPUX 9.x and 10.x.*/
+#endif /* HPUX */
 
 
 #ifdef SEQUENT
@@ -546,8 +639,39 @@ char *mktemp(char *); /* No standard include */
 #define NO_EID
 #define STATFS4
 #define USE_DIRECT
+#ifdef PTX4
+#undef USE_DIRECT
+#endif
 #endif
 
+
+
+#ifdef SEQUENT_PTX4
+#include <string.h>
+#include <sys/dir.h>
+#include <dirent.h>
+#include <sys/statfs.h>
+#include <sys/statvfs.h>
+#include <sys/vfs.h>
+#include <fcntl.h>
+#include <sys/sockio.h>
+#include <netinet/tcp.h>
+#include <stropts.h>
+#include <termios.h>
+#define SYSV
+#define USE_WAITPID
+#define SIGNAL_CAST (void (*)(int))
+#define USE_STATVFS
+#define USE_GETCWD
+#ifndef seteuid
+#define seteuid(uid) setreuid(-1,uid)
+#endif
+#ifndef setegid
+#define setegid(gid) setregid(-1,gid)
+#endif
+#endif
+
+
 #ifdef NEXT2
 #include <sys/types.h>
 #include <strings.h>
@@ -575,6 +699,7 @@ char *mktemp(char *); /* No standard include */
 #define mode_t int
 #define GID_TYPE int
 #define gid_t int
+#define pid_t int
 #define SIGNAL_CAST (void (*)(int))
 #define WAIT3_CAST1 (union wait *)
 #define HAVE_GMTOFF
@@ -603,44 +728,43 @@ char *mktemp(char *); /* No standard include */
 #include <sys/netinet/ip.h>
 #include <dirent.h>
 #include <string.h>
+#include <termios.h>
 #include <fcntl.h>
 #include <sys/statfs.h>
 #include <sys/stropts.h>
 #include <limits.h>
+#include <locale.h>
 #ifdef EVEREST
 #include <unistd.h> 
-#endif
+#endif /* EVEREST */
 #ifdef NETGROUP
 #include <rpcsvc/ypclnt.h>
-#endif
+#endif /* NETGROUP */
 #ifdef SecureWare
 #include <sys/security.h>
 #include <sys/audit.h>
 #include <prot.h>
 #define crypt bigcrypt
-#endif
-#ifndef EVEREST
- #define ftruncate(f,l) syscall(0x0a28,f,l)
-#endif 
+#endif /* SecureWare */
 #define SIGNAL_CAST (void (*)(int))
 #define USE_WAITPID
 #define USE_GETCWD
 #define USE_SETSID
 #ifdef SCO3_2_2
-#define NO_EID
-#else
+#define setuid(u) setreuid(u,-1)
+#define seteuid(u) setreuid(-1,u)
+#else /* SCO3_2_2 */
 #ifndef EVEREST
+#define ftruncate(f,l) syscall(0x0a28,f,l)
 #define USE_IFREQ
-#endif
-#endif
+#define NO_INITGROUPS
+#endif /* EVEREST */
+#endif /* SCO3_2_2 */
 #define STATFS4
 #define NO_FSYNC
-#ifndef EVEREST
-#define NO_INITGROUPS
-#endif
 #define HAVE_PATHCONF
 #define NO_GETRLIMIT
-#endif
+#endif /* SCO */
 
 
 
@@ -734,7 +858,6 @@ char *strdup (char *);
 #endif /* DNIX */
 
 #ifdef CONVEX
-#define SIGNAL_CAST (void (*)(int))
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
 #include <dirent.h>
@@ -870,10 +993,66 @@ typedef int mode_t;
 #endif
 
 
+#ifdef BOS
+#define SIGNAL_CAST (void (*)(int))
+#include <string.h>
+#include <sys/dir.h>
+#include <sys/select.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <sys/statfs.h>
+#include <sys/bsdioctl.h>
+#endif
+
+#ifdef AMIGA
+#include <arpa/inet.h>
+#include <dirent.h>
+#include <string.h>
+#include <netinet/tcp.h>
+#include <sys/acct.h>
+#include <sys/fcntl.h>
+#include <sys/filio.h>
+#include <sys/sockio.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <sys/termios.h>
+#include <limits.h>
+#include <sys/timeb.h>
+
+#define SIGNAL_CAST (void (*)(int))
+#define USE_GETCWD
+#define HAVE_BZERO
+#define HAVE_MEMMOVE
+#define USE_SIGPROCMASK
+#define USE_WAITPID
+#define USE_DIRECT
+#define USE_F_FSIZE
+#define HAVE_FCNTL_LOCK 0
+#define HAVE_GETTIMEOFDAY
+#define HAVE_PATHCONF
+
+#define HAVE_NO_PROC
+#define NO_FORK_DEBUG
+#define HAVE_FORK 0
+#define HAVE_VFORK 1
+#endif
+
+/* For UnixWare 2.x's ia_uinfo routines. (tangent@cyberport.com) */
+#ifdef IA_UINFO
+#include <iaf.h>
+#include <ia.h>
+#endif
+
+
 /*******************************************************************
 end of the platform specific sections
 ********************************************************************/
 
+#if defined(USE_MMAP) || defined(FAST_SHARE_MODES)
+#include <sys/mman.h>
+#endif
+
 #ifdef SecureWare
 #define NEED_AUTH_PARAMETERS
 #endif
@@ -891,10 +1070,6 @@ extern char    *getsmbpass(char *);
 #define FD_SETSIZE 255
 #endif
 
-#ifndef MAXINT
-#define MAXINT ((((unsigned)1)<<(sizeof(int)*8-1))-1)
-#endif
-
 #ifndef __STDC__
 #define const
 #endif
@@ -942,6 +1117,40 @@ struct spwd { /* fake shadow password structure */
 #endif
 #endif
 
+/* This defines the name of the printcap file. It is MOST UNLIKELY that
+   this will change BUT! Specifying a file with the format of a printcap
+   file but containing only a subset of the printers actually in your real 
+   printcap file is a quick-n-dirty way to allow dynamic access to a subset
+   of available printers.
+*/
+#ifndef PRINTCAP_NAME
+#ifdef AIX
+#define PRINTCAP_NAME "/etc/qconfig"
+#elif defined(SYSV)
+#define PRINTCAP_NAME "lpstat"
+#else
+#define PRINTCAP_NAME "/etc/printcap"
+#endif
+#endif
+
+
+#ifdef USE_SYSV_IPC
+#include <sys/ipc.h>
+#include <sys/sem.h>
+#include <sys/shm.h>
+#ifdef NO_SEMUN
+union semun {
+       int val;
+       struct semid_ds *buf;
+       unsigned short *array;
+};
+#endif
+#if defined(HPUX) && defined(HPUX10)
+#ifdef SEMMSL
+#undef SEMMSL
+#endif /* SEMMSL */
+#endif /* HPUX && HPUX10 */
+#endif
 
 #ifdef AFS_AUTH
 #include <afs/stds.h>
@@ -953,6 +1162,14 @@ struct spwd { /* fake shadow password structure */
 #include <dce/sec_login.h>
 #endif
 
+#ifdef KRB5_AUTH
+#include <krb5.h>
+#endif
+
+#ifdef KRB4_AUTH
+#include <krb.h>
+#endif
+
 #ifdef NO_UTIMBUF
 struct utimbuf {
   time_t actime;
@@ -977,24 +1194,37 @@ extern char *sys_errlist[];
 
 #include "version.h"
 #include "smb.h"
+#include "nameserv.h"
+#include "ubiqx/ubi_dLinkList.h"
+
 #include "byteorder.h"
-#ifdef SMB_PASSWD
-#include "smbpass.h"
-#endif
 
 #include "kanji.h"
 #include "charset.h"
 
+#ifndef MAXCODEPAGELINES
+#define MAXCODEPAGELINES 256
+#endif
+
+/***** automatically generated prototypes *****/
+#include "proto.h"
+
+
+
 #ifndef S_IFREG
 #define S_IFREG 0100000
 #endif
 
 #ifndef S_ISREG
-#define S_ISREG(x) ((S_IFREG & x)!=0)
+#define S_ISREG(x) ((S_IFREG & (x))!=0)
 #endif
 
 #ifndef S_ISDIR
-#define S_ISDIR(x) ((S_IFDIR & x)!=0)
+#define S_ISDIR(x) ((S_IFDIR & (x))!=0)
+#endif
+
+#if !defined(S_ISLNK) && defined(S_IFLNK)
+#define S_ISLNK(x) ((S_IFLNK & (x))!=0)
 #endif
 
 #ifdef UFC_CRYPT
@@ -1048,6 +1278,10 @@ it works and getting lots of bug reports */
 #define SIGCLD SIGCHLD
 #endif 
 
+#ifndef MAP_FILE
+#define MAP_FILE 0
+#endif
+
 #ifndef HAVE_FCNTL_LOCK
 #define HAVE_FCNTL_LOCK 1
 #endif
@@ -1064,9 +1298,13 @@ it works and getting lots of bug reports */
 #define QSORT_CAST (int (*)())
 #endif
 
+#ifndef INADDR_LOOPBACK
+#define INADDR_LOOPBACK 0x7f000001
+#endif /* INADDR_LOOPBACK */
+
 /* this is a rough check to see if this machine has a lstat() call.
    it is not guaranteed to work */
-#if !(defined(S_ISLNK) || defined(S_IFLNK))
+#if !defined(S_ISLNK)
 #define lstat stat
 #endif
 
@@ -1104,51 +1342,8 @@ extern int errno;
 #define strcpy(dest,src) StrCpy(dest,src)
 #endif
 
-
-/* possibly wrap the malloc calls */
-#if WRAP_MALLOC
-
-/* undo the old malloc def if necessary */
-#ifdef malloc
-#define xx_old_malloc malloc
-#undef malloc
-#endif
-
-#define malloc(size) malloc_wrapped(size,__FILE__,__LINE__)
-
-/* undo the old realloc def if necessary */
-#ifdef realloc
-#define xx_old_realloc realloc
-#undef realloc
-#endif
-
-#define realloc(ptr,size) realloc_wrapped(ptr,size,__FILE__,__LINE__)
-
-/* undo the old free def if necessary */
-#ifdef free
-#define xx_old_free free
-#undef free
-#endif
-
-#define free(ptr) free_wrapped(ptr,__FILE__,__LINE__)
-
-/* and the malloc prototypes */
-void *malloc_wrapped(int,char *,int);
-void *realloc_wrapped(void *,int,char *,int);
-void free_wrapped(void *,char *,int);
-
-#endif
-
-
-#if WRAP_MEMCPY
-/* undo the old memcpy def if necessary */
-#ifdef memcpy
-#define xx_old_memcpy memcpy
-#undef memcpy
-#endif
-
-#define memcpy(d,s,l) memcpy_wrapped(d,s,l,__FILE__,__LINE__)
-void *memcpy_wrapped(void *d,void *s,int l,char *fname,int line);
+#if MEM_MAN
+#include "mem_man/mem_man.h"
 #endif
 
 #endif