More ticket #472: Fixed problem when building on Mingw. Now PJ_FD_SETSIZE_SETABLE is only enabled when winsock.h is present

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@1788 74dad513-b988-da41-8d7b-12977e46ad98
This commit is contained in:
Benny Prijono 2008-02-08 15:21:41 +00:00
parent c2e348130d
commit 40fe908e12
3 changed files with 20 additions and 23 deletions

View File

@ -487,11 +487,7 @@
* the underlying implementation changes. * the underlying implementation changes.
*/ */
#ifndef PJ_IOQUEUE_MAX_HANDLES #ifndef PJ_IOQUEUE_MAX_HANDLES
# if defined(PJ_WIN32_WINCE) && PJ_WIN32_WINCE!=0 # define PJ_IOQUEUE_MAX_HANDLES (64)
# define PJ_IOQUEUE_MAX_HANDLES (64)
# else
# define PJ_IOQUEUE_MAX_HANDLES (256)
# endif
#endif #endif
@ -532,22 +528,22 @@
/** /**
* Determine if FD_SETSIZE is changeable/set-able. If so, then we will * Determine if FD_SETSIZE is changeable/set-able. If so, then we will
* set it to PJ_IOQUEUE_MAX_HANDLES. * set it to PJ_IOQUEUE_MAX_HANDLES. Currently we detect this by checking
* for Winsock.
*/ */
/* This is awful, as we should actually check for __GLIBC__ rather than #ifndef PJ_FD_SETSIZE_SETABLE
* __GNUC__. But alas! Libc headers are not included yet at this stage. # if defined(PJ_HAS_WINSOCK_H) && PJ_HAS_WINSOCK_H!=0
*/ # define PJ_FD_SETSIZE_SETABLE 1
#ifdef __GNUC__ # else
# define PJ_FD_SETSIZE_SETABLE 0 # define PJ_FD_SETSIZE_SETABLE 0
#else # endif
# define PJ_FD_SETSIZE_SETABLE 1
#endif #endif
/** /**
* Overrides FD_SETSIZE so it is consistent throughout the library. * Overrides FD_SETSIZE so it is consistent throughout the library.
* We only do this if we detected that FD_SETSIZE is changeable. * We only do this if we detected that FD_SETSIZE is changeable. If
* * FD_SETSIZE is not set-able, then PJ_IOQUEUE_MAX_HANDLES must be
* Default: #PJ_IOQUEUE_MAX_HANDLES * set to value lower than FD_SETSIZE.
*/ */
#if PJ_FD_SETSIZE_SETABLE #if PJ_FD_SETSIZE_SETABLE
/* Only override FD_SETSIZE if the value has not been set */ /* Only override FD_SETSIZE if the value has not been set */

View File

@ -38,6 +38,14 @@
#include <pj/sock_select.h> #include <pj/sock_select.h>
#include <pj/errno.h> #include <pj/errno.h>
/* Now that we have access to OS'es <sys/select>, lets check again that
* PJ_IOQUEUE_MAX_HANDLES is not greater than FD_SETSIZE
*/
#if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE
# error "PJ_IOQUEUE_MAX_HANDLES cannot be greater than FD_SETSIZE"
#endif
/* /*
* Include declaration from common abstraction. * Include declaration from common abstraction.
*/ */

View File

@ -35,13 +35,6 @@
# pragma warning(disable: 4389) // Signed/unsigned mismatch in FD_* # pragma warning(disable: 4389) // Signed/unsigned mismatch in FD_*
#endif #endif
/* Now that we have access to OS'es <sys/select>, lets check again that
* PJ_IOQUEUE_MAX_HANDLES is not greater than FD_SETSIZE
*/
#if PJ_IOQUEUE_MAX_HANDLES > FD_SETSIZE
# error "PJ_IOQUEUE_MAX_HANDLES cannot be greater than FD_SETSIZE"
#endif
#define PART_FDSET(ps) ((fd_set*)&ps->data[1]) #define PART_FDSET(ps) ((fd_set*)&ps->data[1])
#define PART_FDSET_OR_NULL(ps) (ps ? PART_FDSET(ps) : NULL) #define PART_FDSET_OR_NULL(ps) (ps ? PART_FDSET(ps) : NULL)
#define PART_COUNT(ps) (ps->data[0]) #define PART_COUNT(ps) (ps->data[0])