ReactOS  0.4.13-dev-651-g5dbc677
UAcceptS.c
Go to the documentation of this file.
1 #include "syshdrs.h"
2 
3 #if !defined(NO_UNIX_DOMAIN_SOCKETS)
4 
5 int
6 UAcceptS(int sfd, struct sockaddr_un *const addr, int *ualen, int tlen)
7 {
8  int result;
9  fd_set ss;
10  struct timeval tv;
11 
12  if (tlen < 0) {
13  errno = 0;
14  for (;;) {
15  *ualen = (int) sizeof(struct sockaddr_un);
16  result = accept(sfd, (struct sockaddr *) addr, (int *) ualen);
17  if ((result >= 0) || (errno != EINTR))
18  return (result);
19  }
20  }
21 
22  for (;;) {
23  errno = 0;
24  FD_ZERO(&ss);
25  FD_SET(sfd, &ss);
26  tv.tv_sec = tlen;
27  tv.tv_usec = 0;
28  result = select(sfd + 1, SELECT_TYPE_ARG234 &ss, NULL, NULL, &tv);
29  if (result == 1) {
30  /* ready */
31  break;
32  } else if (result == 0) {
33  /* timeout */
34  errno = ETIMEDOUT;
35  return (kTimeoutErr);
36  } else if (errno != EINTR) {
37  return (-1);
38  }
39  }
40 
41  do {
42  *ualen = (int) sizeof(struct sockaddr_un);
43  result = accept(sfd, (struct sockaddr *) addr, (int *) ualen);
44  } while ((result < 0) && (errno == EINTR));
45 
46  return (result);
47 } /* UAcceptS */
48 
49 #endif
50 
Definition: winsock.h:66
#define SELECT_TYPE_ARG234
Definition: wincfg.h:4
int UAcceptS(int, struct sockaddr_un *const, int *, int)
#define EINTR
Definition: acclib.h:80
int errno
#define FD_ZERO(set)
Definition: winsock.h:96
#define FD_SET(fd, set)
Definition: winsock.h:89
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 kTimeoutErr
Definition: sio.h:58
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
#define ETIMEDOUT
Definition: errno.h:121
#define ss
Definition: i386-dis.c:432
GLuint64EXT * result
Definition: glext.h:11304
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31