Jacek Caban : server: Store iosb in async object.
Alexandre Julliard
julliard at winehq.org
Tue Dec 6 16:27:43 CST 2016
Module: wine
Branch: master
Commit: 64dc8f5c48e7bffb17d3e0853d5f758d6ee3f9ac
URL: http://source.winehq.org/git/wine.git/?a=commit;h=64dc8f5c48e7bffb17d3e0853d5f758d6ee3f9ac
Author: Jacek Caban <jacek at codeweavers.com>
Date: Sun Dec 4 21:21:46 2016 +0100
server: Store iosb in async object.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
server/async.c | 9 ++++++++-
server/change.c | 2 +-
server/device.c | 2 +-
server/fd.c | 6 +++---
server/file.h | 4 ++--
server/mailslot.c | 2 +-
server/named_pipe.c | 6 +++---
server/serial.c | 2 +-
server/sock.c | 4 ++--
9 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/server/async.c b/server/async.c
index 568b440..562fcd0 100644
--- a/server/async.c
+++ b/server/async.c
@@ -47,6 +47,7 @@ struct async
int signaled;
struct event *event;
async_data_t data; /* data for async I/O call */
+ struct iosb *iosb; /* I/O status block */
};
static void async_dump( struct object *obj, int verbose );
@@ -141,6 +142,7 @@ static void async_destroy( struct object *obj )
if (async->timeout) remove_timeout_user( async->timeout );
if (async->event) release_object( async->event );
+ if (async->iosb) release_object( async->iosb );
release_object( async->queue );
release_object( async->thread );
}
@@ -172,6 +174,7 @@ void async_terminate( struct async *async, unsigned int status )
}
async->status = status;
+ if (async->iosb && async->iosb->status == STATUS_PENDING) async->iosb->status = status;
if (async->data.callback)
{
@@ -225,7 +228,8 @@ void free_async_queue( struct async_queue *queue )
}
/* create an async on a given queue of a fd */
-struct async *create_async( struct thread *thread, struct async_queue *queue, const async_data_t *data )
+struct async *create_async( struct thread *thread, struct async_queue *queue, const async_data_t *data,
+ struct iosb *iosb )
{
struct event *event = NULL;
struct async *async;
@@ -247,6 +251,9 @@ struct async *create_async( struct thread *thread, struct async_queue *queue, co
async->queue = (struct async_queue *)grab_object( queue );
async->signaled = 0;
+ if (iosb) async->iosb = (struct iosb *)grab_object( iosb );
+ else async->iosb = NULL;
+
list_add_tail( &queue->queue, &async->queue_entry );
list_add_tail( &thread->process->asyncs, &async->process_entry );
grab_object( async );
diff --git a/server/change.c b/server/change.c
index ee30b98..d7ebf3b 100644
--- a/server/change.c
+++ b/server/change.c
@@ -1246,7 +1246,7 @@ DECL_HANDLER(read_directory_changes)
return;
/* requests don't timeout */
- if (!(async = fd_queue_async( dir->fd, &req->async, ASYNC_TYPE_WAIT ))) goto end;
+ if (!(async = fd_queue_async( dir->fd, &req->async, NULL, ASYNC_TYPE_WAIT ))) goto end;
/* assign it once */
if (!dir->filter)
diff --git a/server/device.c b/server/device.c
index 99d5204..60a15e2 100644
--- a/server/device.c
+++ b/server/device.c
@@ -488,7 +488,7 @@ static obj_handle_t queue_irp( struct device_file *file, struct irp_call *irp,
if (blocking && !(handle = alloc_handle( current->process, irp, SYNCHRONIZE, 0 ))) return 0;
- if (!(irp->async = fd_queue_async( file->fd, async_data, ASYNC_TYPE_WAIT )))
+ if (!(irp->async = fd_queue_async( file->fd, async_data, irp->iosb, ASYNC_TYPE_WAIT )))
{
if (handle) close_handle( current->process, handle );
return 0;
diff --git a/server/fd.c b/server/fd.c
index faf27bc..3ccd0f8 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -2030,7 +2030,7 @@ void default_poll_event( struct fd *fd, int event )
else if (!fd->inode) set_fd_events( fd, fd->fd_ops->get_poll_events( fd ) );
}
-struct async *fd_queue_async( struct fd *fd, const async_data_t *data, int type )
+struct async *fd_queue_async( struct fd *fd, const async_data_t *data, struct iosb *iosb, int type )
{
struct async_queue *queue;
struct async *async;
@@ -2054,7 +2054,7 @@ struct async *fd_queue_async( struct fd *fd, const async_data_t *data, int type
assert(0);
}
- if ((async = create_async( current, queue, data )) && type != ASYNC_TYPE_WAIT)
+ if ((async = create_async( current, queue, data, iosb )) && type != ASYNC_TYPE_WAIT)
{
if (!fd->inode)
set_fd_events( fd, fd->fd_ops->get_poll_events( fd ) );
@@ -2096,7 +2096,7 @@ void default_fd_queue_async( struct fd *fd, const async_data_t *data, int type,
{
struct async *async;
- if ((async = fd_queue_async( fd, data, type )))
+ if ((async = fd_queue_async( fd, data, NULL, type )))
{
release_object( async );
set_error( STATUS_PENDING );
diff --git a/server/file.h b/server/file.h
index 0a144ee..94322c7 100644
--- a/server/file.h
+++ b/server/file.h
@@ -97,7 +97,7 @@ extern int default_fd_signaled( struct object *obj, struct wait_queue_entry *ent
extern unsigned int default_fd_map_access( struct object *obj, unsigned int access );
extern int default_fd_get_poll_events( struct fd *fd );
extern void default_poll_event( struct fd *fd, int event );
-extern struct async *fd_queue_async( struct fd *fd, const async_data_t *data, int type );
+extern struct async *fd_queue_async( struct fd *fd, const async_data_t *data, struct iosb *iosb, int type );
extern void fd_async_wake_up( struct fd *fd, int type, unsigned int status );
extern void fd_reselect_async( struct fd *fd, struct async_queue *queue );
extern obj_handle_t no_fd_read( struct fd *fd, const async_data_t *async, int blocking, file_pos_t pos );
@@ -177,7 +177,7 @@ extern struct object *create_serial( struct fd *fd );
extern struct async_queue *create_async_queue( struct fd *fd );
extern void free_async_queue( struct async_queue *queue );
extern struct async *create_async( struct thread *thread, struct async_queue *queue,
- const async_data_t *data );
+ const async_data_t *data, struct iosb *iosb );
extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status );
extern void async_set_result( struct object *obj, unsigned int status,
apc_param_t total, client_ptr_t apc, client_ptr_t apc_arg );
diff --git a/server/mailslot.c b/server/mailslot.c
index 3ddfab5..783b28b 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -332,7 +332,7 @@ static void mailslot_queue_async( struct fd *fd, const async_data_t *data, int t
assert(mailslot->obj.ops == &mailslot_ops);
- if ((async = fd_queue_async( fd, data, type )))
+ if ((async = fd_queue_async( fd, data, NULL, type )))
{
async_set_timeout( async, mailslot->read_timeout ? mailslot->read_timeout : -1,
STATUS_IO_TIMEOUT );
diff --git a/server/named_pipe.c b/server/named_pipe.c
index d93c40f..3245688 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -555,7 +555,7 @@ static obj_handle_t pipe_server_flush( struct fd *fd, const async_data_t *async_
if (!pipe_data_remaining( server )) return 0;
- if ((async = fd_queue_async( server->fd, async_data, ASYNC_TYPE_WAIT )))
+ if ((async = fd_queue_async( server->fd, async_data, NULL, ASYNC_TYPE_WAIT )))
{
/* there's no unix way to be alerted when a pipe becomes empty, so resort to polling */
if (!server->flush_poll)
@@ -602,7 +602,7 @@ static obj_handle_t pipe_server_ioctl( struct fd *fd, ioctl_code_t code, const a
{
case ps_idle_server:
case ps_wait_connect:
- if ((async = fd_queue_async( server->ioctl_fd, async_data, ASYNC_TYPE_WAIT )))
+ if ((async = fd_queue_async( server->ioctl_fd, async_data, NULL, ASYNC_TYPE_WAIT )))
{
if (blocking) wait_handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 );
set_server_state( server, ps_wait_open );
@@ -855,7 +855,7 @@ static obj_handle_t named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code,
if (!pipe->waiters && !(pipe->waiters = create_async_queue( NULL ))) goto done;
- if ((async = create_async( current, pipe->waiters, async_data )))
+ if ((async = create_async( current, pipe->waiters, async_data, NULL )))
{
timeout_t when = buffer->TimeoutSpecified ? buffer->Timeout.QuadPart : pipe->timeout;
async_set_timeout( async, when, STATUS_IO_TIMEOUT );
diff --git a/server/serial.c b/server/serial.c
index df462ea..6f9cc24 100644
--- a/server/serial.c
+++ b/server/serial.c
@@ -201,7 +201,7 @@ static void serial_queue_async( struct fd *fd, const async_data_t *data, int typ
break;
}
- if ((async = fd_queue_async( fd, data, type )))
+ if ((async = fd_queue_async( fd, data, NULL, type )))
{
if (timeout) async_set_timeout( async, timeout * -10000, STATUS_TIMEOUT );
release_object( async );
diff --git a/server/sock.c b/server/sock.c
index a3c88a0..f70a85d 100644
--- a/server/sock.c
+++ b/server/sock.c
@@ -552,7 +552,7 @@ obj_handle_t sock_ioctl( struct fd *fd, ioctl_code_t code, const async_data_t *a
return 0;
}
if (!(ifchange_q = sock_get_ifchange_q( sock ))) return 0;
- if (!(async = create_async( current, ifchange_q, async_data ))) return 0;
+ if (!(async = create_async( current, ifchange_q, async_data, NULL ))) return 0;
if (blocking) wait_handle = alloc_handle( current->process, async, SYNCHRONIZE, 0 );
release_object( async );
set_error( STATUS_PENDING );
@@ -593,7 +593,7 @@ static void sock_queue_async( struct fd *fd, const async_data_t *data, int type,
return;
}
- if (!(async = create_async( current, queue, data ))) return;
+ if (!(async = create_async( current, queue, data, NULL ))) return;
release_object( async );
sock_reselect( sock );
More information about the wine-cvs
mailing list