Commit 126e6b81 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

Rename the regular WS_FD_XXX macros to FD_XXX.

Rename the Wine specific WS_FD_XXX macros to FD_WINE_XXX.
parent a0f98f13
......@@ -252,7 +252,7 @@ static int _is_blocking(SOCKET s)
req->s_event = 0;
req->c_event = 0;
SERVER_CALL();
ret = (req->state & WS_FD_NONBLOCKING) == 0;
ret = (req->state & FD_WINE_NONBLOCKING) == 0;
}
SERVER_END_REQ;
return ret;
......@@ -743,7 +743,7 @@ static void WSOCK32_async_accept(SOCKET s, SOCKET as)
else
ERR("accept queue too small\n");
/* now signal our AsyncSelect handler */
_enable_event(s, WS_FD_SERVEVENT, 0, 0);
_enable_event(s, FD_WINE_SERVEVENT, 0, 0);
}
/**********************************************************************/
......@@ -801,7 +801,7 @@ SOCKET WINAPI WSOCK32_accept(SOCKET s, struct sockaddr *addr,
#endif
} else SetLastError(wsaErrno());
close(fd);
if (omask & WS_FD_SERVEVENT)
if (omask & FD_WINE_SERVEVENT)
WSOCK32_async_accept(s, as);
return as;
}
......@@ -960,8 +960,8 @@ INT WINAPI WSOCK32_connect(SOCKET s, struct sockaddr *name, INT namelen)
{
/* tell wineserver that a connection is in progress */
_enable_event(s, FD_CONNECT|FD_READ|FD_WRITE,
WS_FD_CONNECT|WS_FD_READ|WS_FD_WRITE,
WS_FD_CONNECTED|WS_FD_LISTENING);
FD_CONNECT|FD_READ|FD_WRITE,
FD_WINE_CONNECTED|FD_WINE_LISTENING);
if (_is_blocking(s))
{
int result;
......@@ -997,8 +997,8 @@ connect_success:
free(name);
#endif
_enable_event(s, FD_CONNECT|FD_READ|FD_WRITE,
WS_FD_CONNECTED|WS_FD_READ|WS_FD_WRITE,
WS_FD_CONNECT|WS_FD_LISTENING);
FD_WINE_CONNECTED|FD_READ|FD_WRITE,
FD_CONNECT|FD_WINE_LISTENING);
return 0;
}
......@@ -1550,9 +1550,9 @@ INT WINAPI WSOCK32_ioctlsocket(SOCKET s, LONG cmd, ULONG *argp)
}
close(fd);
if (*argp)
_enable_event(s, 0, WS_FD_NONBLOCKING, 0);
_enable_event(s, 0, FD_WINE_NONBLOCKING, 0);
else
_enable_event(s, 0, 0, WS_FD_NONBLOCKING);
_enable_event(s, 0, 0, FD_WINE_NONBLOCKING);
return 0;
case WS_SIOCATMARK:
......@@ -1610,8 +1610,8 @@ INT WINAPI WSOCK32_listen(SOCKET s, INT backlog)
{
close(fd);
_enable_event(s, FD_ACCEPT,
WS_FD_LISTENING,
WS_FD_CONNECT|WS_FD_CONNECTED);
FD_WINE_LISTENING,
FD_CONNECT|FD_WINE_CONNECTED);
return 0;
}
SetLastError(wsaErrno());
......@@ -2096,14 +2096,14 @@ INT WINAPI WSOCK32_shutdown(SOCKET s, INT how)
switch( how )
{
case 0: /* drop receives */
_enable_event(s, 0, 0, WS_FD_READ);
_enable_event(s, 0, 0, FD_READ);
#ifdef SHUT_RD
how = SHUT_RD;
#endif
break;
case 1: /* drop sends */
_enable_event(s, 0, 0, WS_FD_WRITE);
_enable_event(s, 0, 0, FD_WRITE);
#ifdef SHUT_WR
how = SHUT_WR;
#endif
......@@ -2122,7 +2122,7 @@ INT WINAPI WSOCK32_shutdown(SOCKET s, INT how)
{
if( how > 1 )
{
_enable_event(s, 0, 0, WS_FD_CONNECTED|WS_FD_LISTENING);
_enable_event(s, 0, 0, FD_WINE_CONNECTED|FD_WINE_LISTENING);
}
close(fd);
return 0;
......@@ -2660,12 +2660,12 @@ VOID CALLBACK WINSOCK_DoAsyncEvent( ULONG_PTR ptr )
if ( (GetLastError() == WSAENOTSOCK) || (GetLastError() == WSAEINVAL) )
{
/* orphaned event (socket closed or something) */
pmask = WS_FD_SERVEVENT;
pmask = FD_WINE_SERVEVENT;
orphan = TRUE;
}
/* check for accepted sockets that needs to inherit WSAAsyncSelect */
if (pmask & WS_FD_SERVEVENT) {
if (pmask & FD_WINE_SERVEVENT) {
int q;
for (q=0; q<WS_ACCEPT_QUEUE; q++)
if (accept_old[q] == info->sock) {
......@@ -2677,7 +2677,7 @@ VOID CALLBACK WINSOCK_DoAsyncEvent( ULONG_PTR ptr )
WSAAsyncSelect(as, info->hWnd, info->uMsg, info->lEvent);
}
}
pmask &= ~WS_FD_SERVEVENT;
pmask &= ~FD_WINE_SERVEVENT;
}
/* dispatch network events */
for (i=0; i<FD_MAX_EVENTS; i++)
......@@ -2723,7 +2723,7 @@ INT WINAPI WSAAsyncSelect(SOCKET s, HWND hWnd, UINT uMsg, LONG lEvent)
info->lEvent = lEvent;
info->service = SERVICE_AddObject( hObj, WINSOCK_DoAsyncEvent, (ULONG_PTR)info );
err = WSAEventSelect( s, hObj, lEvent | WS_FD_SERVEVENT );
err = WSAEventSelect( s, hObj, lEvent | FD_WINE_SERVEVENT );
if (err) {
/* SERVICE_Delete closes the event object */
SERVICE_Delete( info->service );
......
......@@ -264,25 +264,22 @@ typedef struct WSAData {
/*
* Define flags to be used with the WSAAsyncSelect() call.
*/
#define FD_READ WS_FD_READ
#define FD_WRITE WS_FD_WRITE
#define FD_OOB WS_FD_OOB
#define FD_ACCEPT WS_FD_ACCEPT
#define FD_CONNECT WS_FD_CONNECT
#define FD_CLOSE WS_FD_CLOSE
#define WS_FD_READ 0x0001
#define WS_FD_WRITE 0x0002
#define WS_FD_OOB 0x0004
#define WS_FD_ACCEPT 0x0008
#define WS_FD_CONNECT 0x0010
#define WS_FD_CLOSE 0x0020
#define WS_FD_LISTENING 0x10000000 /* internal per-socket flags */
#define WS_FD_NONBLOCKING 0x20000000
#define WS_FD_CONNECTED 0x40000000
#define WS_FD_RAW 0x80000000
#define WS_FD_SERVEVENT 0x01000000
#define WS_FD_INTERNAL 0xFFFF0000
#define FD_READ 0x00000001
#define FD_WRITE 0x00000002
#define FD_OOB 0x00000004
#define FD_ACCEPT 0x00000008
#define FD_CONNECT 0x00000010
#define FD_CLOSE 0x00000020
/* internal per-socket flags */
#ifdef __WINE__
#define FD_WINE_LISTENING 0x10000000
#define FD_WINE_NONBLOCKING 0x20000000
#define FD_WINE_CONNECTED 0x40000000
#define FD_WINE_RAW 0x80000000
#define FD_WINE_SERVEVENT 0x01000000
#define FD_WINE_INTERNAL 0xFFFF0000
#endif
/*
* All Windows Sockets error constants are biased by WSABASEERR from
......
......@@ -84,7 +84,7 @@ static void sock_reselect( struct sock *sock )
if (sock->obj.select == -1) {
/* previously unconnected socket, is this reselect supposed to connect it? */
if (!(sock->state & ~WS_FD_NONBLOCKING)) return;
if (!(sock->state & ~FD_WINE_NONBLOCKING)) return;
/* ok, it is, attach it to the wineserver's main poll loop */
add_select_user( &sock->obj );
}
......@@ -116,14 +116,14 @@ static void sock_poll_event( struct object *obj, int event )
assert( sock->obj.ops == &sock_ops );
if (debug_level)
fprintf(stderr, "socket %d select event: %x\n", sock->obj.fd, event);
if (sock->state & WS_FD_CONNECT)
if (sock->state & FD_CONNECT)
{
/* connecting */
if (event & POLLOUT)
{
/* we got connected */
sock->state |= WS_FD_CONNECTED|WS_FD_READ|WS_FD_WRITE;
sock->state &= ~WS_FD_CONNECT;
sock->state |= FD_WINE_CONNECTED|FD_READ|FD_WRITE;
sock->state &= ~FD_CONNECT;
sock->pmask |= FD_CONNECT;
sock->errors[FD_CONNECT_BIT] = 0;
if (debug_level)
......@@ -132,14 +132,14 @@ static void sock_poll_event( struct object *obj, int event )
else if (event & (POLLERR|POLLHUP))
{
/* we didn't get connected? */
sock->state &= ~WS_FD_CONNECT;
sock->state &= ~FD_CONNECT;
sock->pmask |= FD_CONNECT;
sock->errors[FD_CONNECT_BIT] = sock_error( sock->obj.fd );
if (debug_level)
fprintf(stderr, "socket %d connection failure\n", sock->obj.fd);
}
} else
if (sock->state & WS_FD_LISTENING)
if (sock->state & FD_WINE_LISTENING)
{
/* listening */
if (event & POLLIN)
......@@ -193,10 +193,10 @@ static void sock_poll_event( struct object *obj, int event )
fprintf(stderr, "socket %d got OOB data\n", sock->obj.fd);
}
if (((event & POLLERR) || ((event & (POLLIN|POLLHUP)) == POLLHUP))
&& (sock->state & (WS_FD_READ|WS_FD_WRITE))) {
&& (sock->state & (FD_READ|FD_WRITE))) {
/* socket closing */
sock->errors[FD_CLOSE_BIT] = sock_error( sock->obj.fd );
sock->state &= ~(WS_FD_CONNECTED|WS_FD_READ|WS_FD_WRITE);
sock->state &= ~(FD_WINE_CONNECTED|FD_READ|FD_WRITE);
sock->pmask |= FD_CLOSE;
if (debug_level)
fprintf(stderr, "socket %d aborted by error %d\n",
......@@ -247,10 +247,10 @@ static int sock_get_poll_events( struct object *obj )
assert( obj->ops == &sock_ops );
if (sock->state & WS_FD_CONNECT)
if (sock->state & FD_CONNECT)
/* connecting, wait for writable */
return POLLOUT;
if (sock->state & WS_FD_LISTENING)
if (sock->state & FD_WINE_LISTENING)
/* listening, wait for readable */
return (sock->hmask & FD_ACCEPT) ? 0 : POLLIN;
......@@ -277,7 +277,7 @@ static void sock_destroy( struct object *obj )
/* if the service thread was waiting for the event object,
* we should now signal it, to let the service thread
* object detect that it is now orphaned... */
if (sock->mask & WS_FD_SERVEVENT)
if (sock->mask & FD_WINE_SERVEVENT)
set_event( sock->event );
/* we're through with it */
release_object( sock->event );
......@@ -300,7 +300,7 @@ static struct object *create_socket( int family, int type, int protocol )
fcntl(sockfd, F_SETFL, O_NONBLOCK); /* make socket nonblocking */
if (!(sock = alloc_object( &sock_ops, -1 ))) return NULL;
sock->obj.fd = sockfd;
sock->state = (type != SOCK_STREAM) ? (WS_FD_READ|WS_FD_WRITE) : 0;
sock->state = (type != SOCK_STREAM) ? (FD_READ|FD_WRITE) : 0;
sock->mask = 0;
sock->hmask = 0;
sock->pmask = 0;
......@@ -343,14 +343,14 @@ static struct object *accept_socket( handle_t handle )
/* newly created socket gets the same properties of the listening socket */
fcntl(acceptfd, F_SETFL, O_NONBLOCK); /* make socket nonblocking */
acceptsock->obj.fd = acceptfd;
acceptsock->state = WS_FD_CONNECTED|WS_FD_READ|WS_FD_WRITE;
if (sock->state & WS_FD_NONBLOCKING)
acceptsock->state |= WS_FD_NONBLOCKING;
acceptsock->state = FD_WINE_CONNECTED|FD_READ|FD_WRITE;
if (sock->state & FD_WINE_NONBLOCKING)
acceptsock->state |= FD_WINE_NONBLOCKING;
acceptsock->mask = sock->mask;
acceptsock->hmask = 0;
acceptsock->pmask = 0;
acceptsock->event = NULL;
if (sock->event && !(sock->mask & WS_FD_SERVEVENT))
if (sock->event && !(sock->mask & FD_WINE_SERVEVENT))
acceptsock->event = (struct event *)grab_object( sock->event );
sock_reselect( acceptsock );
......@@ -475,7 +475,7 @@ DECL_HANDLER(set_socket_event)
if (debug_level && sock->event) fprintf(stderr, "event ptr: %p\n", sock->event);
sock_reselect( sock );
if (sock->mask)
sock->state |= WS_FD_NONBLOCKING;
sock->state |= FD_WINE_NONBLOCKING;
/* if a network event is pending, signal the event object
it is possible that FD_CONNECT or FD_ACCEPT network events has happened
......@@ -486,7 +486,7 @@ DECL_HANDLER(set_socket_event)
if (oevent)
{
if ((oevent != sock->event) && (omask & WS_FD_SERVEVENT))
if ((oevent != sock->event) && (omask & FD_WINE_SERVEVENT))
/* if the service thread was waiting for the old event object,
* we should now signal it, to let the service thread
* object detect that it is now orphaned... */
......@@ -559,9 +559,9 @@ DECL_HANDLER(enable_socket_event)
sock_reselect( sock );
/* service trigger */
if (req->mask & WS_FD_SERVEVENT)
if (req->mask & FD_WINE_SERVEVENT)
{
sock->pmask |= WS_FD_SERVEVENT;
sock->pmask |= FD_WINE_SERVEVENT;
if (sock->event) {
if (debug_level) fprintf(stderr, "signalling service event ptr %p\n", sock->event);
set_event(sock->event);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment