server: Make fd_queue_async infallible.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2017-07-04 15:26:35 +02:00 committed by Alexandre Julliard
parent 99dfb29048
commit 7b33613fc4
7 changed files with 20 additions and 28 deletions

View file

@ -1247,7 +1247,7 @@ DECL_HANDLER(read_directory_changes)
/* requests don't timeout */
if (!(async = create_async( dir->fd, current, &req->async, NULL ))) goto end;
if (!fd_queue_async( dir->fd, async, ASYNC_TYPE_WAIT )) goto end;
fd_queue_async( dir->fd, async, ASYNC_TYPE_WAIT );
/* assign it once */
if (!dir->filter)
@ -1269,8 +1269,8 @@ DECL_HANDLER(read_directory_changes)
set_error(STATUS_PENDING);
release_object( async );
end:
if (async) release_object( async );
release_object( dir );
}

View file

@ -464,7 +464,7 @@ static void set_file_user_ptr( struct device_file *file, client_ptr_t ptr )
/* queue an irp to the device */
static int queue_irp( struct device_file *file, struct irp_call *irp, struct async *async )
{
if (!fd_queue_async( file->fd, async, ASYNC_TYPE_WAIT )) return 0;
fd_queue_async( file->fd, async, ASYNC_TYPE_WAIT );
irp->async = (struct async *)grab_object( async );
add_irp_to_queue( file, irp, current );

View file

@ -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 ) );
}
int fd_queue_async( struct fd *fd, struct async *async, int type )
void fd_queue_async( struct fd *fd, struct async *async, int type )
{
struct async_queue *queue;
@ -2059,7 +2059,6 @@ int fd_queue_async( struct fd *fd, struct async *async, int type )
else /* regular files are always ready for read and write */
async_wake_up( queue, STATUS_ALERTED );
}
return 1;
}
void fd_async_wake_up( struct fd *fd, int type, unsigned int status )
@ -2092,7 +2091,8 @@ void no_fd_queue_async( struct fd *fd, struct async *async, int type, int count
void default_fd_queue_async( struct fd *fd, struct async *async, int type, int count )
{
if (fd_queue_async( fd, async, type )) set_error( STATUS_PENDING );
fd_queue_async( fd, async, type );
set_error( STATUS_PENDING );
}
/* default reselect_async() fd routine */

View file

@ -102,7 +102,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 int fd_queue_async( struct fd *fd, struct async *async, int type );
extern void fd_queue_async( struct fd *fd, struct async *async, 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 int no_fd_read( struct fd *fd, struct async *async, file_pos_t pos );

View file

@ -331,12 +331,10 @@ static void mailslot_queue_async( struct fd *fd, struct async *async, int type,
assert(mailslot->obj.ops == &mailslot_ops);
if (fd_queue_async( fd, async, type ))
{
async_set_timeout( async, mailslot->read_timeout ? mailslot->read_timeout : -1,
STATUS_IO_TIMEOUT );
set_error( STATUS_PENDING );
}
fd_queue_async( fd, async, type );
async_set_timeout( async, mailslot->read_timeout ? mailslot->read_timeout : -1,
STATUS_IO_TIMEOUT );
set_error( STATUS_PENDING );
}
static void mailslot_device_dump( struct object *obj, int verbose )

View file

@ -653,8 +653,7 @@ static int pipe_end_flush( struct pipe_end *pipe_end, struct async *async )
if (use_server_io( pipe_end ) && (!pipe_end->connection || list_empty( &pipe_end->connection->message_queue )))
return 1;
if (!fd_queue_async( pipe_end->fd, async, ASYNC_TYPE_WAIT )) return 0;
fd_queue_async( pipe_end->fd, async, ASYNC_TYPE_WAIT );
set_error( STATUS_PENDING );
return 1;
}
@ -933,14 +932,11 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as
{
case ps_idle_server:
case ps_wait_connect:
if (fd_queue_async( server->ioctl_fd, async, ASYNC_TYPE_WAIT ))
{
set_server_state( server, ps_wait_open );
async_wake_up( &server->pipe->waiters, STATUS_SUCCESS );
set_error( STATUS_PENDING );
return 1;
}
break;
fd_queue_async( server->ioctl_fd, async, ASYNC_TYPE_WAIT );
set_server_state( server, ps_wait_open );
async_wake_up( &server->pipe->waiters, STATUS_SUCCESS );
set_error( STATUS_PENDING );
return 1;
case ps_connected_server:
set_error( STATUS_PIPE_CONNECTED );
break;

View file

@ -244,11 +244,9 @@ static void serial_queue_async( struct fd *fd, struct async *async, int type, in
break;
}
if (fd_queue_async( fd, async, type ))
{
if (timeout) async_set_timeout( async, timeout * -10000, STATUS_TIMEOUT );
set_error( STATUS_PENDING );
}
fd_queue_async( fd, async, type );
if (timeout) async_set_timeout( async, timeout * -10000, STATUS_TIMEOUT );
set_error( STATUS_PENDING );
}
static void serial_read_timeout( void *arg )