- Main Page
- Modules
- Classes
- Files
- Related Pages

# include/tds_sysdep_private.h

    00001 /* FreeTDS - Library of routines accessing Sybase and Microsoft databases
    00002  * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004  Brian Bruns
    00003  *
    00004  * This library is free software; you can redistribute it and/or
    00005  * modify it under the terms of the GNU Library General Public
    00006  * License as published by the Free Software Foundation; either
    00007  * version 2 of the License, or (at your option) any later version.
    00008  *
    00009  * This library is distributed in the hope that it will be useful,
    00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00012  * Library General Public License for more details.
    00013  *
    00014  * You should have received a copy of the GNU Library General Public
    00015  * License along with this library; if not, write to the
    00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00017  * Boston, MA 02111-1307, USA.
    00018  */
    00019
    00020 #ifndef _tds_sysdep_private_h_
    00021 #define _tds_sysdep_private_h_
    00022
    00023 /* $Id: tds_sysdep_private.h,v 1.23.2.1 2008/03/11 08:27:35 freddy77 Exp $ */
    00024
    00025 #undef TDS_RCSID
    00026 #if defined(__GNUC__) && __GNUC__ >= 3
    00027 #define TDS_RCSID(name, id) \
    00028         static const char rcsid_##name[] __attribute__ ((unused)) = id
    00029 #else
    00030 #define TDS_RCSID(name, id) \
    00031         static const char rcsid_##name[] = id; \
    00032         static const void *const no_unused_##name##_warn[] = { rcsid_##name, no_unused_##name##_warn }
    00033 #endif
    00034
    00035 #define TDS_ADDITIONAL_SPACE 0
    00036
    00037 #ifdef __cplusplus
    00038 extern "C"
    00039 {
    00040 #if 0
    00041 }
    00042 #endif
    00043 #endif
    00044
    00045 #ifdef __INCvxWorksh
    00046 #include <ioLib.h>              /* for FIONBIO */
    00047 #endif                          /* __INCvxWorksh */
    00048
    00049 #if defined(DOS32X)
    00050 #define READSOCKET(a,b,c)       recv((a), (b), (c), 0L)
    00051 #define WRITESOCKET(a,b,c)      send((a), (b), (c), 0L)
    00052 #define CLOSESOCKET(a)          closesocket((a))
    00053 #define IOCTLSOCKET(a,b,c)      ioctlsocket((a), (b), (char*)(c))
    00054 #define select select_s
    00055 typedef int pid_t;
    00056 #define strcasecmp stricmp
    00057 #define strncasecmp strnicmp
    00058 #define vsnprintf _vsnprintf
    00059 /* TODO this has nothing to do with ip ... */
    00060 #define getpid() _gethostid()
    00061 #endif  /* defined(DOS32X) */
    00062
    00063 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
    00064 #include <windows.h>
    00065 #define READSOCKET(a,b,c)       recv((a), (b), (c), 0L)
    00066 #define WRITESOCKET(a,b,c)      send((a), (b), (c), 0L)
    00067 #define CLOSESOCKET(a)          closesocket((a))
    00068 #define IOCTLSOCKET(a,b,c)      ioctlsocket((a), (b), (c))
    00069 int  _tds_socket_init(void);
    00070 #define INITSOCKET()    _tds_socket_init()
    00071 void _tds_socket_done(void);
    00072 #define DONESOCKET()    _tds_socket_done()
    00073 #define NETDB_REENTRANT 1       /* BSD-style netdb interface is reentrant */
    00074
    00075 #define TDSSOCK_EINTR WSAEINTR
    00076 #define TDSSOCK_EINPROGRESS WSAEWOULDBLOCK
    00077 #define sock_errno WSAGetLastError()
    00078 #ifndef __MINGW32__
    00079 typedef DWORD pid_t;
    00080 #endif
    00081 #define strcasecmp stricmp
    00082 #define strncasecmp strnicmp
    00083 #define atoll _atoi64
    00084 #define vsnprintf _vsnprintf
    00085
    00086 #ifndef WIN32
    00087 #define WIN32 1
    00088 #endif
    00089
    00090 #if defined(_WIN64) && !defined(WIN64)
    00091 #define WIN64 1
    00092 #endif
    00093
    00094 #define TDS_SDIR_SEPARATOR "\\"
    00095
    00096 /* use macros to use new style names */
    00097 #ifdef __MSVCRT__
    00098 #define getpid()           _getpid()
    00099 #define strdup(s)          _strdup(s)
    00100 #define stricmp(s1,s2)     _stricmp(s1,s2)
    00101 #define strnicmp(s1,s2,n)  _strnicmp(s1,s2,n)
    00102 #endif
    00103
    00104 #endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */
    00105
    00106 #ifndef sock_errno
    00107 #define sock_errno errno
    00108 #endif
    00109
    00110 #ifndef TDSSOCK_EINTR
    00111 #define TDSSOCK_EINTR EINTR
    00112 #endif
    00113
    00114 #ifndef TDSSOCK_EINPROGRESS
    00115 #define TDSSOCK_EINPROGRESS EINPROGRESS
    00116 #endif
    00117
    00118 #ifndef INITSOCKET
    00119 #define INITSOCKET()    0
    00120 #endif /* !INITSOCKET */
    00121
    00122 #ifndef DONESOCKET
    00123 #define DONESOCKET()    do { } while(0)
    00124 #endif /* !DONESOCKET */
    00125
    00126 #ifndef READSOCKET
    00127 #define READSOCKET(a,b,c)       read((a), (b), (c))
    00128 #endif /* !READSOCKET */
    00129
    00130 #ifndef WRITESOCKET
    00131 #define WRITESOCKET(a,b,c)      write((a), (b), (c))
    00132 #endif /* !WRITESOCKET */
    00133
    00134 #ifndef CLOSESOCKET
    00135 #define CLOSESOCKET(a)          close((a))
    00136 #endif /* !CLOSESOCKET */
    00137
    00138 #ifndef IOCTLSOCKET
    00139 #define IOCTLSOCKET(a,b,c)      ioctl((a), (b), (c))
    00140 #endif /* !IOCTLSOCKET */
    00141
    00142 #ifndef TDS_SDIR_SEPARATOR
    00143 #define TDS_SDIR_SEPARATOR "/"
    00144 #endif /* !TDS_SDIR_SEPARATOR */
    00145
    00146 #ifdef __cplusplus
    00147 #if 0
    00148 {
    00149 #endif
    00150 }
    00151 #endif
    00152
    00153 #endif /* _tds_sysdep_private_h_ */