ReactOS 0.4.16-dev-257-g6aa11ac
UAcceptS.c
Go to the documentation of this file.
1#include "syshdrs.h"
2
3#if !defined(NO_UNIX_DOMAIN_SOCKETS)
4
5int
6UAcceptS(int sfd, struct sockaddr_un *const addr, int *ualen, int tlen)
7{
8 int result;
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 */
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
#define EINTR
Definition: acclib.h:80
#define NULL
Definition: types.h:112
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
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
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 kTimeoutErr
Definition: sio.h:58
#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
int UAcceptS(int, struct sockaddr_un *const, int *, int)
#define FD_ZERO(set)
Definition: winsock.h:96
#define FD_SET(fd, set)
Definition: winsock.h:89