ReactOS 0.4.15-dev-7918-g2a2556c
UAcceptA.c
Go to the documentation of this file.
1#include "syshdrs.h"
2
3#if !defined(NO_UNIX_DOMAIN_SOCKETS) && !defined(NO_SIGNALS)
4
5extern volatile Sjmp_buf gNetTimeoutJmp;
6extern volatile Sjmp_buf gPipeJmp;
7
8int
9UAcceptA(int sfd, struct sockaddr_un *const addr, int *ualen, int tlen)
10{
11 int result;
12 vsio_sigproc_t sigalrm, sigpipe;
13
14 if (tlen < 0) {
15 errno = 0;
16 for (;;) {
17 *ualen = (int) sizeof(struct sockaddr_un);
18 result = accept(sfd, (struct sockaddr *) addr, (int *) ualen);
19 if ((result >= 0) || (errno != EINTR))
20 return (result);
21 }
22 }
23
24 if (SSetjmp(gNetTimeoutJmp) != 0) {
25 alarm(0);
26 (void) SSignal(SIGALRM, (sio_sigproc_t) sigalrm);
27 (void) SSignal(SIGPIPE, (sio_sigproc_t) sigpipe);
29 return (kTimeoutErr);
30 }
31
32 sigalrm = (vsio_sigproc_t) SSignal(SIGALRM, SIOHandler);
34 alarm((unsigned int) tlen);
35
36 errno = 0;
37 do {
38 *ualen = (int) sizeof(struct sockaddr_un);
39 result = accept(sfd, (struct sockaddr *) addr, (int *) ualen);
40 } while ((result < 0) && (errno == EINTR));
41
42 alarm(0);
43 (void) SSignal(SIGALRM, (sio_sigproc_t) sigalrm);
44 (void) SSignal(SIGPIPE, (sio_sigproc_t) sigpipe);
45 return (result);
46} /* UAcceptA */
47
48#endif
49
#define EINTR
Definition: acclib.h:80
#define SIGPIPE
Definition: signal.h:35
#define SIG_IGN
Definition: signal.h:48
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
#define ETIMEDOUT
Definition: errno.h:121
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 Sjmp_buf
Definition: sio.h:41
#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
int UAcceptA(int, struct sockaddr_un *const, int *, int)