1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200
|
/*
* Dksystem.h
*
* $Id: Dksystem.h,v 1.5 2009/04/07 22:00:54 source Exp $
*
* system common include files
*
* This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
* project.
*
* Copyright (C) 1998-2006 OpenLink Software
*
* This project is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; only version 2 of the License, dated June 1991.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*
*/
#ifndef _DKSYSTEM_H
#define _DKSYSTEM_H
#ifdef _WIN64
# include "Dkconfig.w64"
#elif defined (WIN32)
# include "Dkconfig.w32"
#else
# include "Dkconfig.h"
#endif
#if 0
/* XXX cleanup for final version */
#ifndef NO_THREAD
# if defined (WITH_PTHREADS) || defined (PTHREAD)
# include <pthread.h>
# ifndef _REENTRANT
# define _REENTRANT
# endif
# ifndef PTHREAD
# define PTHREAD
# endif
# define PREEMPT
# endif
#endif
#endif
#if !defined (NO_THREAD) && defined (WITH_PTHREADS) && !defined (_REENTRANT)
#define _REENTRANT
#endif
#include <stdio.h>
#include <ctype.h>
#include <signal.h>
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef HAVE_SYS_TIMEB_H
/* SCO 3.2 "devsys 4.2" has a prototype for `ftime' in <time.h> that bombs
unless <sys/timeb.h> has been included first. Does every system have a
<sys/timeb.h>? If any does not, configure should check for it. */
# include <sys/timeb.h>
#endif
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
# ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
# else
# include <time.h>
# endif
#endif
#ifdef STDC_HEADERS
# include <stdlib.h>
# include <string.h>
# include <stdarg.h>
# include <memory.h>
#else
# ifdef HAVE_STRING_H
# include <string.h>
# else
# include <strings.h>
# endif
# ifdef HAVE_MEMORY_H
# include <memory.h>
# endif
#endif
#if !defined(__FreeBSD__)
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#else
void *malloc ();
void *calloc ();
void *realloc ();
void free ();
#endif
#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#ifdef HAVE_SYS_SELECT_H
# include <sys/select.h>
#endif
#if defined (WINDOWS) || defined (WIN32) || defined (OS2)
# include <io.h>
# include <process.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#else
# include <sys/file.h>
#endif
#ifndef O_BINARY
# define O_BINARY 0
#endif
#include <errno.h>
#if !defined(linux) && !defined(__APPLE__) && !defined (WIN32) && !defined (__CYGWIN__) && !defined(__FreeBSD__) && !defined (__cplusplus) && !defined(__GLIBC__)
extern char *sys_errlist[];
extern int sys_nerr;
#endif
#ifndef errno
extern int errno;
#endif
#if defined (NO_THREAD)
# undef strtok_r
# define strtok_r(X,Y,Z) strtok((X),(Y))
#elif !defined (strtok_r)
#ifdef __GNUC__
extern char *strtok_r (char *s, const char *delim, char **ptrptr);
#else
char *strtok_r ();
#endif
#endif
#ifdef linux
# define _P __P /* Fixes bug in sched.h */
#endif
#ifndef MAX
# define MAX(X,Y) (X > Y ? X : Y)
# define MIN(X,Y) (X < Y ? X : Y)
#endif
#ifdef __cplusplus
# define BEGIN_CPLUSPLUS extern "C" {
# define END_CPLUSPLUS }
#else
# define BEGIN_CPLUSPLUS
# define END_CPLUSPLUS
#endif
/*
* Solve the `weak external' problem
*/
#if defined(VMS) && VMS_TARG == VAX
# define GLOBALDEF globaldef
# define GLOBALREF globalref
#else
# ifndef GLOBALDEF
# define GLOBALDEF
# endif
# define GLOBALREF extern
#endif
#ifdef __GNUC__
# define DK_INLINE __inline__
#else
# define DK_INLINE
#endif
#endif
|