ReactOS 0.4.16-dev-122-g325d74c
SAcceptA.c File Reference
#include "syshdrs.h"
Include dependency graph for SAcceptA.c:

Go to the source code of this file.

Functions

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

Function Documentation

◆ SAcceptA()

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

Definition at line 9 of file SAcceptA.c.

10{
11 int result;
12#ifndef NO_SIGNALS
13 vsio_sigproc_t sigalrm, sigpipe;
14#endif
15 size_t size;
16
17 if (tlen < 0) {
18 errno = 0;
19 for (;;) {
20 size = sizeof(struct sockaddr_in);
21 result = accept(sfd, (struct sockaddr *) addr, (int *) &size);
22 if ((result >= 0) || (errno != EINTR))
23 return (result);
24 }
25 }
26#ifndef NO_SIGNALS
27 if (SSetjmp(gNetTimeoutJmp) != 0) {
28 alarm(0);
29 (void) SSignal(SIGALRM, (sio_sigproc_t) sigalrm);
30 (void) SSignal(SIGPIPE, (sio_sigproc_t) sigpipe);
32 return (kTimeoutErr);
33 }
34
35 sigalrm = (vsio_sigproc_t) SSignal(SIGALRM, SIOHandler);
37 alarm((unsigned int) tlen);
38
39 errno = 0;
40 do {
41 size = sizeof(struct sockaddr_in);
42 result = accept(sfd, (struct sockaddr *) addr, (int *) &size);
43 } while ((result < 0) && (errno == EINTR));
44
45 alarm(0);
46 (void) SSignal(SIGALRM, (sio_sigproc_t) sigalrm);
47 (void) SSignal(SIGPIPE, (sio_sigproc_t) sigpipe);
48 return (result);
49#else
50 return (-1);
51#endif
52} /* SAcceptA */
#define EINTR
Definition: acclib.h:80
#define SIGPIPE
Definition: signal.h:35
#define SIG_IGN
Definition: signal.h:48
#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
void SIOHandler(int)
#define SSetjmp(a)
Definition: sio.h:39
volatile sio_sigproc_t vsio_sigproc_t
Definition: sio.h:124
void(*)(int) SSignal(int signum, void(*handler)(int))
Definition: sio.h:237
#define kTimeoutErr
Definition: sio.h:58
void(* sio_sigproc_t)(int)
Definition: sio.h:123
#define errno
Definition: errno.h:18
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23