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

- File List
- File Members

# /home/jklowden/releases/freetds-0.91/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  * Copyright (C) 2010  Frediano Ziglio
    00004  *
    00005  * This library is free software; you can redistribute it and/or
    00006  * modify it under the terms of the GNU Library General Public
    00007  * License as published by the Free Software Foundation; either
    00008  * version 2 of the License, or (at your option) any later version.
    00009  *
    00010  * This library is distributed in the hope that it will be useful,
    00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013  * Library General Public License for more details.
    00014  *
    00015  * You should have received a copy of the GNU Library General Public
    00016  * License along with this library; if not, write to the
    00017  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018  * Boston, MA 02111-1307, USA.
    00019  */
    00020
    00021 #ifndef _tds_sysdep_private_h_
    00022 #define _tds_sysdep_private_h_
    00023
    00024 /* $Id: tds_sysdep_private.h,v 1.36 2010/12/28 14:37:10 freddy77 Exp $ */
    00025
    00026 #undef TDS_RCSID
    00027 #if defined(__GNUC__) && __GNUC__ >= 3
    00028 #define TDS_RCSID(name, id) \
    00029         static const char rcsid_##name[] __attribute__ ((unused)) = id
    00030 #else
    00031 #define TDS_RCSID(name, id) \
    00032         static const char rcsid_##name[] = id; \
    00033         static const void *const no_unused_##name##_warn[] = { rcsid_##name, no_unused_##name##_warn }
    00034 #endif
    00035
    00036 #define TDS_ADDITIONAL_SPACE 0
    00037
    00038 #ifdef MSG_NOSIGNAL
    00039 # define TDS_NOSIGNAL MSG_NOSIGNAL
    00040 #else
    00041 # define TDS_NOSIGNAL 0L
    00042 #endif
    00043
    00044 #ifdef __cplusplus
    00045 extern "C"
    00046 {
    00047 #if 0
    00048 }
    00049 #endif
    00050 #endif
    00051
    00052 #ifdef __INCvxWorksh
    00053 #include <ioLib.h>              /* for FIONBIO */
    00054 #endif                          /* __INCvxWorksh */
    00055
    00056 #if defined(DOS32X)
    00057 #define READSOCKET(a,b,c)       recv((a), (b), (c), TDS_NOSIGNAL)
    00058 #define WRITESOCKET(a,b,c)      send((a), (b), (c), TDS_NOSIGNAL)
    00059 #define CLOSESOCKET(a)          closesocket((a))
    00060 #define IOCTLSOCKET(a,b,c)      ioctlsocket((a), (b), (char*)(c))
    00061 #define SOCKLEN_T int
    00062 #define select select_s
    00063 typedef int pid_t;
    00064 #define strcasecmp stricmp
    00065 #define strncasecmp strnicmp
    00066 #define vsnprintf _vsnprintf
    00067 /* TODO this has nothing to do with ip ... */
    00068 #define getpid() _gethostid()
    00069 #endif  /* defined(DOS32X) */
    00070
    00071 #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64)
    00072 #include <winsock2.h>
    00073 #include <windows.h>
    00074 #define READSOCKET(a,b,c)       recv((a), (char *) (b), (c), TDS_NOSIGNAL)
    00075 #define WRITESOCKET(a,b,c)      send((a), (const char *) (b), (c), TDS_NOSIGNAL)
    00076 #define CLOSESOCKET(a)          closesocket((a))
    00077 #define IOCTLSOCKET(a,b,c)      ioctlsocket((a), (b), (c))
    00078 #define SOCKLEN_T int
    00079 int  tds_socket_init(void);
    00080 #define INITSOCKET()    tds_socket_init()
    00081 void tds_socket_done(void);
    00082 #define DONESOCKET()    tds_socket_done()
    00083 #define NETDB_REENTRANT 1       /* BSD-style netdb interface is reentrant */
    00084
    00085 #define TDSSOCK_EINTR WSAEINTR
    00086 #define TDSSOCK_EINPROGRESS WSAEWOULDBLOCK
    00087 #define TDSSOCK_WOULDBLOCK(e) ((e)==WSAEWOULDBLOCK)
    00088 #define sock_errno WSAGetLastError()
    00089 #define sock_strerror(n) tds_prwsaerror(n)
    00090 #ifndef __MINGW32__
    00091 typedef DWORD pid_t;
    00092 #endif
    00093 #define strcasecmp stricmp
    00094 #define strncasecmp strnicmp
    00095 #define atoll _atoi64
    00096 #define vsnprintf _vsnprintf
    00097 #define snprintf _snprintf
    00098
    00099 #ifndef WIN32
    00100 #define WIN32 1
    00101 #endif
    00102
    00103 #if defined(_WIN64) && !defined(WIN64)
    00104 #define WIN64 1
    00105 #endif
    00106
    00107 #define TDS_SDIR_SEPARATOR "\\"
    00108
    00109 /* use macros to use new style names */
    00110 #if defined(__MSVCRT__) || defined(_MSC_VER)
    00111 #define getpid()           _getpid()
    00112 #define strdup(s)          _strdup(s)
    00113 #undef fileno
    00114 #define fileno(f)          _fileno(f)
    00115 #define stricmp(s1,s2)     _stricmp(s1,s2)
    00116 #define strnicmp(s1,s2,n)  _strnicmp(s1,s2,n)
    00117 #endif
    00118
    00119 #endif /* defined(WIN32) || defined(_WIN32) || defined(__WIN32__) */
    00120
    00121 #ifndef sock_errno
    00122 #define sock_errno errno
    00123 #endif
    00124
    00125 #ifndef sock_strerror
    00126 #define sock_strerror(n) strerror(n)
    00127 #endif
    00128
    00129 #ifndef TDSSOCK_EINTR
    00130 #define TDSSOCK_EINTR EINTR
    00131 #endif
    00132
    00133 #ifndef TDSSOCK_EINPROGRESS
    00134 #define TDSSOCK_EINPROGRESS EINPROGRESS
    00135 #endif
    00136
    00137 #ifndef TDSSOCK_WOULDBLOCK
    00138 # if defined(EWOULDBLOCK) && EAGAIN != EWOULDBLOCK
    00139 #  define TDSSOCK_WOULDBLOCK(e) ((e)==EAGAIN||(e)==EWOULDBLOCK)
    00140 # else
    00141 #  define TDSSOCK_WOULDBLOCK(e) ((e)==EAGAIN)
    00142 # endif
    00143 #endif
    00144
    00145 #ifndef INITSOCKET
    00146 #define INITSOCKET()    0
    00147 #endif /* !INITSOCKET */
    00148
    00149 #ifndef DONESOCKET
    00150 #define DONESOCKET()    do { } while(0)
    00151 #endif /* !DONESOCKET */
    00152
    00153 #ifndef READSOCKET
    00154 # ifdef MSG_NOSIGNAL
    00155 #  define READSOCKET(s,b,l)     recv((s), (b), (l), MSG_NOSIGNAL)
    00156 # else
    00157 #  define READSOCKET(s,b,l)     read((s), (b), (l))
    00158 # endif
    00159 #endif /* !READSOCKET */
    00160
    00161 #ifndef WRITESOCKET
    00162 # ifdef MSG_NOSIGNAL
    00163 #  define WRITESOCKET(s,b,l)    send((s), (b), (l), MSG_NOSIGNAL)
    00164 # else
    00165 #  define WRITESOCKET(s,b,l)    write((s), (b), (l))
    00166 # endif
    00167 #endif /* !WRITESOCKET */
    00168
    00169 #ifndef CLOSESOCKET
    00170 #define CLOSESOCKET(s)          close((s))
    00171 #endif /* !CLOSESOCKET */
    00172
    00173 #ifndef IOCTLSOCKET
    00174 #define IOCTLSOCKET(s,b,l)      ioctl((s), (b), (l))
    00175 #endif /* !IOCTLSOCKET */
    00176
    00177 #ifndef SOCKLEN_T
    00178 # define SOCKLEN_T socklen_t
    00179 #endif
    00180
    00181 #if !defined(__WIN32__) && !defined(_WIN32) && !defined(WIN32)
    00182 typedef int TDS_SYS_SOCKET;
    00183 #define INVALID_SOCKET -1
    00184 #define TDS_IS_SOCKET_INVALID(s) ((s) < 0)
    00185 #else
    00186 typedef SOCKET TDS_SYS_SOCKET;
    00187 #define TDS_IS_SOCKET_INVALID(s) ((s) == INVALID_SOCKET)
    00188 #endif
    00189
    00190 #define tds_accept      accept
    00191 #define tds_getpeername getpeername
    00192 #define tds_getsockopt  getsockopt
    00193 #define tds_getsockname getsockname
    00194 #define tds_recvfrom    recvfrom
    00195
    00196 #if defined(__hpux__) && SIZEOF_VOID_P == 8 && SIZEOF_INT == 4
    00197 # if HAVE__XPG_ACCEPT
    00198 #  undef tds_accept
    00199 #  define tds_accept _xpg_accept
    00200 # elif HAVE___ACCEPT
    00201 #  undef tds_accept
    00202 #  define tds_accept __accept
    00203 # endif
    00204 # if HAVE__XPG_GETPEERNAME
    00205 #  undef tds_getpeername
    00206 #  define tds_getpeername _xpg_getpeername
    00207 # elif HAVE___GETPEERNAME
    00208 #  undef tds_getpeername
    00209 #  define tds_getpeername __getpeername
    00210 # endif
    00211 # if HAVE__XPG_GETSOCKOPT
    00212 #  undef tds_getsockopt
    00213 #  define tds_getsockopt _xpg_getsockopt
    00214 # elif HAVE___GETSOCKOPT
    00215 #  undef tds_getsockopt
    00216 #  define tds_getsockopt __getsockopt
    00217 # endif
    00218 # if HAVE__XPG_GETSOCKNAME
    00219 #  undef tds_getsockname
    00220 #  define tds_getsockname _xpg_getsockname
    00221 # elif HAVE___GETSOCKNAME
    00222 #  undef tds_getsockname
    00223 #  define tds_getsockname __getsockname
    00224 # endif
    00225 # if HAVE__XPG_RECVFROM
    00226 #  undef tds_recvfrom
    00227 #  define tds_recvfrom _xpg_recvfrom
    00228 # elif HAVE___RECVFROM
    00229 #  undef tds_recvfrom
    00230 #  define tds_recvfrom __recvfrom
    00231 # endif
    00232 #endif
    00233
    00234 #ifndef TDS_SDIR_SEPARATOR
    00235 #define TDS_SDIR_SEPARATOR "/"
    00236 #endif /* !TDS_SDIR_SEPARATOR */
    00237
    00238 #ifdef HAVE_INTTYPES_H
    00239 #include <inttypes.h>
    00240 #endif
    00241
    00242 #ifndef PRId64
    00243 #define PRId64 TDS_I64_FORMAT
    00244 #endif
    00245
    00246 #ifdef __cplusplus
    00247 #if 0
    00248 {
    00249 #endif
    00250 }
    00251 #endif
    00252
    00253 #endif /* _tds_sysdep_private_h_ */

All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines