ReactOS 0.4.16-dev-338-g34e76ad
SAcceptS.c File Reference
#include "syshdrs.h"
Include dependency graph for SAcceptS.c:

Go to the source code of this file.

Functions

int SAcceptS (int sfd, struct sockaddr_in *const addr, int tlen)
 

Function Documentation

◆ SAcceptS()

int SAcceptS ( int  sfd,
struct sockaddr_in *const  addr,
int  tlen 
)

Definition at line 4 of file SAcceptS.c.

5{
6 int result;
8 struct timeval tv;
9 size_t size;
10
11 if (tlen <= 0) {
12 errno = 0;
13 for (;;) {
14 size = sizeof(struct sockaddr_in);
15 result = accept(sfd, (struct sockaddr *) addr, (int *) &size);
16 if ((result >= 0) || (errno != EINTR))
17 return (result);
18 }
19 }
20
21 forever {
22 errno = 0;
23 FD_ZERO(&ss);
24 FD_SET(sfd, &ss);
25 tv.tv_sec = tlen;
26 tv.tv_usec = 0;
28 if (result == 1) {
29 /* ready */
30 break;
31 } else if (result == 0) {
32 /* timeout */
35 return (kTimeoutErr);
36 } else if (errno != EINTR) {
37 return (-1);
38 }
39 }
40
41 do {
42 size = sizeof(struct sockaddr_in);
43 result = accept(sfd, (struct sockaddr *) addr, (int *) &size);
44 } while ((result < 0) && (errno == EINTR));
45
46 return (result);
47} /* SAcceptS */
#define EINTR
Definition: acclib.h:80
#define NULL
Definition: types.h:112
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
#define ETIMEDOUT
Definition: errno.h:121
GLsizeiptr size
Definition: glext.h:5919
GLenum const GLvoid * addr
Definition: glext.h:9621
GLuint64EXT * result
Definition: glext.h:11304
#define ss
Definition: i386-dis.c:441
#define SELECT_TYPE_ARG234
Definition: wincfg.h:4
#define SELECT_TYPE_ARG5
Definition: wincfg.h:7
#define SETWSATIMEOUTERR
Definition: sio.h:120
#define kTimeoutErr
Definition: sio.h:58
#define forever
Definition: ncftp.h:73
#define errno
Definition: errno.h:18
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23
Definition: winsock.h:66
#define FD_ZERO(set)
Definition: winsock.h:96
#define FD_SET(fd, set)
Definition: winsock.h:89