ReactOS  0.4.13-dev-247-g0f29b3f
SSelect.c File Reference
#include "syshdrs.h"
Include dependency graph for SSelect.c:

Go to the source code of this file.

Functions

void SelectSetInit (SelectSetPtr const ssp, const double timeout)
 
void SelectSetAdd (SelectSetPtr const ssp, const int fd)
 
void SelectSetRemove (SelectSetPtr const ssp, const int fd)
 
int SelectW (SelectSetPtr ssp, SelectSetPtr resultssp)
 
int SelectR (SelectSetPtr ssp, SelectSetPtr resultssp)
 

Function Documentation

◆ SelectR()

int SelectR ( SelectSetPtr  ssp,
SelectSetPtr  resultssp 
)

Definition at line 65 of file SSelect.c.

66 {
67  int rc;
68 
69  do {
70  memcpy(resultssp, ssp, sizeof(SelectSet));
71  rc = select(resultssp->maxfd, SELECT_TYPE_ARG234 &resultssp->fds, NULL, NULL, SELECT_TYPE_ARG5 &resultssp->timeout);
72  } while ((rc < 0) && (errno == EINTR));
73  return (rc);
74 } /* SelectR */
#define SELECT_TYPE_ARG234
Definition: wincfg.h:4
int maxfd
Definition: sio.h:9
#define EINTR
Definition: acclib.h:80
int errno
struct timeval timeout
Definition: sio.h:8
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
Definition: select.c:41
smooth NULL
Definition: ftsmooth.c:416
#define SELECT_TYPE_ARG5
Definition: wincfg.h:7
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: sio.h:6
fd_set fds
Definition: sio.h:7

◆ SelectSetAdd()

void SelectSetAdd ( SelectSetPtr const  ssp,
const int  fd 
)

Definition at line 23 of file SSelect.c.

24 {
25  if (fd >= 0) {
26  FD_SET(fd, &ssp->fds);
27  if (ssp->maxfd < (fd + 1))
28  ssp->maxfd = (fd + 1);
29  ++ssp->numfds;
30  }
31 } /* SelectSetAdd */
static int fd
Definition: io.c:51
#define FD_SET(fd, set)
Definition: winsock.h:89

◆ SelectSetInit()

void SelectSetInit ( SelectSetPtr const  ssp,
const double  timeout 
)

Definition at line 4 of file SSelect.c.

5 {
6  double i;
7  long l;
8 
9  /* Inititalize SelectSet, which will clear the fd_set, the
10  * timeval, and the maxfd and numfds to 0.
11  */
12  memset(ssp, 0, sizeof(SelectSet));
13  l = (long) timeout;
14  i = (double) l;
15  ssp->timeout.tv_sec = l;
16  ssp->timeout.tv_usec = (long) ((timeout - i) * 1000000.0);
17 } /* SelectSetInit */
Definition: dhcpd.h:245
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
Definition: string.c:80
r l[0]
Definition: byte_order.h:167
Definition: sio.h:6
#define long
Definition: qsort.c:33
#define memset(x, y, z)
Definition: compat.h:39

◆ SelectSetRemove()

void SelectSetRemove ( SelectSetPtr const  ssp,
const int  fd 
)

Definition at line 37 of file SSelect.c.

38 {
39  if ((fd >= 0) && (FD_ISSET(fd, &ssp->fds))) {
40  FD_CLR(fd, &ssp->fds);
41  /* Note that maxfd is left alone, even if maxfd was
42  * this one. That is okay.
43  */
44  --ssp->numfds;
45  }
46 } /* SelectSetRemove */
static int fd
Definition: io.c:51
#define FD_ISSET(fd, set)
Definition: winsock.h:100
#define FD_CLR(fd, set)
Definition: winsock.h:74

◆ SelectW()

int SelectW ( SelectSetPtr  ssp,
SelectSetPtr  resultssp 
)

Definition at line 51 of file SSelect.c.

52 {
53  int rc;
54 
55  do {
56  memcpy(resultssp, ssp, sizeof(SelectSet));
57  rc = select(resultssp->maxfd, NULL, SELECT_TYPE_ARG234 &resultssp->fds, NULL, SELECT_TYPE_ARG5 &resultssp->timeout);
58  } while ((rc < 0) && (errno == EINTR));
59  return (rc);
60 } /* SelectW */
#define SELECT_TYPE_ARG234
Definition: wincfg.h:4
int maxfd
Definition: sio.h:9
#define EINTR
Definition: acclib.h:80
int errno
struct timeval timeout
Definition: sio.h:8
INT WSAAPI select(IN INT s, IN OUT LPFD_SET readfds, IN OUT LPFD_SET writefds, IN OUT LPFD_SET exceptfds, IN CONST struct timeval *timeout)
Definition: select.c:41
smooth NULL
Definition: ftsmooth.c:416
#define SELECT_TYPE_ARG5
Definition: wincfg.h:7
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: sio.h:6
fd_set fds
Definition: sio.h:7