ReactOS  0.4.14-dev-614-gbfd8a84
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 
5 extern volatile Sjmp_buf gNetTimeoutJmp;
6 extern volatile Sjmp_buf gPipeJmp;
7 
8 int
9 UAcceptA(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);
28  errno = ETIMEDOUT;
29  return (kTimeoutErr);
30  }
31 
32  sigalrm = (vsio_sigproc_t) SSignal(SIGALRM, SIOHandler);
33  sigpipe = (vsio_sigproc_t) SSignal(SIGPIPE, SIG_IGN);
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 
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
volatile sio_sigproc_t vsio_sigproc_t
Definition: sio.h:124
#define EINTR
Definition: acclib.h:80
int errno
#define Sjmp_buf
Definition: sio.h:41
#define kTimeoutErr
Definition: sio.h:58
#define SIGPIPE
Definition: signal.h:35
#define SSetjmp(a)
Definition: sio.h:39
GLenum const GLvoid * addr
Definition: glext.h:9621
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23
void(*)(int) SSignal(int signum, void(*handler)(int))
Definition: sio.h:237
int UAcceptA(int, struct sockaddr_un *const, int *, int)
#define ETIMEDOUT
Definition: errno.h:121
#define SIG_IGN
Definition: signal.h:48
GLuint64EXT * result
Definition: glext.h:11304
void(* sio_sigproc_t)(int)
Definition: sio.h:123
void SIOHandler(int)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31