Mobile API Reference  MicroStrategy 2019
PDCselect.h
Go to the documentation of this file.
1 //==============================================================================================
2 // FILENAME : PDCselect.h
3 // AUTHOR : Ananth Kini
4 // CREATION : 06/25/2010
5 // Copyright (C) MicroStrategy, Inc. 2010
6 //==============================================================================================
7 #ifndef PDCselect_h
8 #define PDCselect_h
9 
10 // this must be the *first* file included
11 #include "ProtectedSource/Prolog.h"
12 #ifdef WIN32
13  //#if !defined(_WINSOCKAPI_) && !defined(PDCwinsock_h)
14  //#include "PDCHeader/PDCwinsock.h"
15  //#endif
16 #else
17 #include <sys/select.h>
18 #endif
19 
20 #ifdef ANDROID
21  typedef unsigned long int __fd_mask;
22 #endif
23 
24 #ifdef linux
25 
26  //custom extended mstr fd_set size
27  #define MSTR_FD_SETSIZE 65536
28 
29  /* fd_set for select and pselect. */
30  typedef struct
31  {
32  /* XPG4.2 requires this member name. Otherwise avoid the name
33  from the global namespace. */
34  #ifdef __USE_XOPEN
35  __fd_mask fds_bits[MSTR_FD_SETSIZE / __NFDBITS];
36  # define __FDS_BITS(set) ((set)->fds_bits)
37  #else
38  __fd_mask __fds_bits[MSTR_FD_SETSIZE / __NFDBITS];
39  # define __FDS_BITS(set) ((set)->__fds_bits)
40  #endif
41  } mstr_fd_set;
42 
43 
44  //definition for custom select call (wrapper for system select call)
45  inline int mstr_select(int numfds, mstr_fd_set* readfds, mstr_fd_set* writefds, mstr_fd_set* exceptfds, struct timeval *timeout){
46  return ::select(numfds, (fd_set*)readfds, (fd_set*)writefds, (fd_set*)exceptfds, timeout);
47  }
48 
49  //replace all references to fd_set from here on with MSTR_fd_set
50  #define fd_set mstr_fd_set
51 
52 #else
53  //for simplicity on other platforms, mstr_select is a macro
54  #define mstr_select( A , B , C , D , E ) ::select( A , B , C , D , E )
55 #endif //linux
56 
57 #endif //PDCselect_h
#define mstr_select(A, B, C, D, E)
Definition: PDCselect.h:54
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout)
Definition: PDCunistd.h:192