Mostly just to simplify the interface, so that we don't need to use the return value to communicate this.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- server/async.c | 23 +++++++++++++++++------ server/device.c | 4 ++-- server/file.h | 1 + 3 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/server/async.c b/server/async.c index e8d95a62d4b..4e9f3253759 100644 --- a/server/async.c +++ b/server/async.c @@ -53,6 +53,7 @@ struct async unsigned int direct_result :1;/* a flag if we're passing result directly from request instead of APC */ unsigned int alerted :1; /* fd is signaled, but we are waiting for client-side I/O */ unsigned int terminated :1; /* async has been terminated */ + unsigned int unknown_status :1; /* initial status is not known yet */ struct completion *completion; /* completion associated with fd */ apc_param_t comp_key; /* completion key associated with fd */ unsigned int comp_flags; /* completion flags */ @@ -258,6 +259,7 @@ struct async *create_async( struct fd *fd, struct thread *thread, const async_da async->direct_result = 0; async->alerted = 0; async->terminated = 0; + async->unknown_status = 0; async->completion = fd_get_completion( fd, &async->comp_key ); async->comp_flags = 0; async->completion_callback = NULL; @@ -284,6 +286,7 @@ void set_async_pending( struct async *async, int signal ) if (!async->terminated) { async->pending = 1; + async->unknown_status = 0; if (signal && !async->signaled) { async->signaled = 1; @@ -295,14 +298,15 @@ void set_async_pending( struct async *async, int signal ) /* return async object status and wait handle to client */ obj_handle_t async_handoff( struct async *async, int success, data_size_t *result, int force_blocking ) { + if (async->unknown_status) + { + /* even the initial status is not known yet */ + set_error( STATUS_PENDING ); + return async->wait_handle; + } + if (!success) { - if (get_error() == STATUS_PENDING) - { - /* we don't know the result yet, so client needs to wait */ - async->direct_result = 0; - return async->wait_handle; - } close_handle( async->thread->process, async->wait_handle ); async->wait_handle = 0; return 0; @@ -381,6 +385,13 @@ void async_request_complete_alloc( struct async *async, unsigned int status, dat async_request_complete( async, status, result, out_size, out_data_copy ); }
+/* mark an async as having unknown initial status */ +void async_set_unknown_status( struct async *async ) +{ + async->unknown_status = 1; + async->direct_result = 0; +} + /* set the timeout of an async operation */ void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status ) { diff --git a/server/device.c b/server/device.c index 29b36845e68..8892651d048 100644 --- a/server/device.c +++ b/server/device.c @@ -605,8 +605,8 @@ static int queue_irp( struct device_file *file, const irp_params_t *params, stru irp->async = (struct async *)grab_object( async ); add_irp_to_queue( file->device->manager, irp, current ); release_object( irp ); - set_error( STATUS_PENDING ); - return 0; + async_set_unknown_status( async ); + return 1; }
static enum server_fd_type device_file_get_fd_type( struct fd *fd ) diff --git a/server/file.h b/server/file.h index 8e42cd3704e..9b8a620359e 100644 --- a/server/file.h +++ b/server/file.h @@ -224,6 +224,7 @@ extern void queue_async( struct async_queue *queue, struct async *async ); 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 ); extern void async_set_completion_callback( struct async *async, async_completion_callback func, void *private ); +extern void async_set_unknown_status( struct async *async ); extern void set_async_pending( struct async *async, int signal ); extern int async_waiting( struct async_queue *queue ); extern void async_terminate( struct async *async, unsigned int status );
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- server/sock.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/server/sock.c b/server/sock.c index 1e31b806986..e06f914686e 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2527,6 +2527,8 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) #endif }
+ set_async_pending( async, 0 ); + if (bind( unix_fd, &bind_addr.addr, unix_len ) < 0) { if (errno == EADDRINUSE)
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- server/sock.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/server/sock.c b/server/sock.c index e06f914686e..bf109eb781a 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2398,6 +2398,8 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) obj_handle_t event_handle; int mask;
+ set_async_pending( async, 0 ); + if (is_machine_64bit( current->process->machine )) { const struct afd_event_select_params_64 *params = get_req_data();
Instead of manually specifying success or failure.
Based on test_return_status() in ntoskrnl. The changes in this patch don't affect device IRPs, but the tests show the heuristic that Windows uses, and in practice it turns out to be correct for all known asyncs.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- server/async.c | 4 ++-- server/fd.c | 15 ++++++++++----- server/file.h | 2 +- server/sock.c | 34 ++++++++++------------------------ 4 files changed, 23 insertions(+), 32 deletions(-)
diff --git a/server/async.c b/server/async.c index 4e9f3253759..50cb47dec92 100644 --- a/server/async.c +++ b/server/async.c @@ -296,7 +296,7 @@ void set_async_pending( struct async *async, int signal ) }
/* return async object status and wait handle to client */ -obj_handle_t async_handoff( struct async *async, int success, data_size_t *result, int force_blocking ) +obj_handle_t async_handoff( struct async *async, data_size_t *result, int force_blocking ) { if (async->unknown_status) { @@ -305,7 +305,7 @@ obj_handle_t async_handoff( struct async *async, int success, data_size_t *resul return async->wait_handle; }
- if (!success) + if (!async->pending && NT_ERROR( get_error() )) { close_handle( async->thread->process, async->wait_handle ); async->wait_handle = 0; diff --git a/server/fd.c b/server/fd.c index a09fc9edfcf..e4ef29806f2 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2692,7 +2692,8 @@ DECL_HANDLER(flush)
if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->event = async_handoff( async, fd->fd_ops->flush( fd, async ), NULL, 1 ); + fd->fd_ops->flush( fd, async ); + reply->event = async_handoff( async, NULL, 1 ); release_object( async ); } release_object( fd ); @@ -2720,7 +2721,8 @@ DECL_HANDLER(get_volume_info)
if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->get_volume_info( fd, async, req->info_class ), NULL, 1 ); + fd->fd_ops->get_volume_info( fd, async, req->info_class ); + reply->wait = async_handoff( async, NULL, 1 ); release_object( async ); } release_object( fd ); @@ -2795,7 +2797,8 @@ DECL_HANDLER(read)
if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->read( fd, async, req->pos ), NULL, 0 ); + fd->fd_ops->read( fd, async, req->pos ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = fd->options; release_object( async ); } @@ -2812,7 +2815,8 @@ DECL_HANDLER(write)
if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->write( fd, async, req->pos ), &reply->size, 0 ); + fd->fd_ops->write( fd, async, req->pos ); + reply->wait = async_handoff( async, &reply->size, 0 ); reply->options = fd->options; release_object( async ); } @@ -2830,7 +2834,8 @@ DECL_HANDLER(ioctl)
if ((async = create_request_async( fd, fd->comp_flags, &req->async ))) { - reply->wait = async_handoff( async, fd->fd_ops->ioctl( fd, req->code, async ), NULL, 0 ); + fd->fd_ops->ioctl( fd, req->code, async ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = fd->options; release_object( async ); } diff --git a/server/file.h b/server/file.h index 9b8a620359e..592ee6b4e6b 100644 --- a/server/file.h +++ b/server/file.h @@ -219,7 +219,7 @@ typedef void (*async_completion_callback)( void *private ); extern void free_async_queue( struct async_queue *queue ); extern struct async *create_async( struct fd *fd, struct thread *thread, const async_data_t *data, struct iosb *iosb ); extern struct async *create_request_async( struct fd *fd, unsigned int comp_flags, const async_data_t *data ); -extern obj_handle_t async_handoff( struct async *async, int success, data_size_t *result, int force_blocking ); +extern obj_handle_t async_handoff( struct async *async, data_size_t *result, int force_blocking ); extern void queue_async( struct async_queue *queue, struct async *async ); 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 ); diff --git a/server/sock.c b/server/sock.c index bf109eb781a..fc181e85744 100644 --- a/server/sock.c +++ b/server/sock.c @@ -2839,8 +2839,8 @@ static int poll_single_socket( struct sock *sock, int mask ) return get_poll_flags( sock, pollfd.revents ) & mask; }
-static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t timeout, - unsigned int count, const struct poll_socket_input *input ) +static void poll_socket( struct sock *poll_sock, struct async *async, timeout_t timeout, + unsigned int count, const struct poll_socket_input *input ) { struct poll_socket_output *output; BOOL signaled = FALSE; @@ -2848,13 +2848,13 @@ static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t t unsigned int i, j;
if (!(output = mem_alloc( count * sizeof(*output) ))) - return 0; + return; memset( output, 0, count * sizeof(*output) );
if (!(req = mem_alloc( offsetof( struct poll_req, sockets[count] ) ))) { free( output ); - return 0; + return; }
req->timeout = NULL; @@ -2863,7 +2863,7 @@ static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t t { free( req ); free( output ); - return 0; + return; }
for (i = 0; i < count; ++i) @@ -2875,7 +2875,7 @@ static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t t if (req->timeout) remove_timeout_user( req->timeout ); free( req ); free( output ); - return 0; + return; } req->sockets[i].flags = input[i].flags; } @@ -2917,7 +2917,6 @@ static int poll_socket( struct sock *poll_sock, struct async *async, timeout_t t for (i = 0; i < req->count; ++i) sock_reselect( req->sockets[i].sock ); set_error( STATUS_PENDING ); - return 1; }
#ifdef HAVE_LINUX_RTNETLINK_H @@ -3249,18 +3248,11 @@ DECL_HANDLER(recv_socket)
if ((async = create_request_async( fd, get_fd_comp_flags( fd ), &req->async ))) { - int success = 0; - if (status == STATUS_SUCCESS) { struct iosb *iosb = async_get_iosb( async ); iosb->result = req->total; release_object( iosb ); - success = 1; - } - else if (status == STATUS_PENDING) - { - success = 1; } set_error( status );
@@ -3273,7 +3265,7 @@ DECL_HANDLER(recv_socket) /* always reselect; we changed reported_events above */ sock_reselect( sock );
- reply->wait = async_handoff( async, success, NULL, 0 ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = get_fd_options( fd ); release_object( async ); } @@ -3293,7 +3285,8 @@ DECL_HANDLER(poll_socket)
if ((async = create_request_async( sock->fd, get_fd_comp_flags( sock->fd ), &req->async ))) { - reply->wait = async_handoff( async, poll_socket( sock, async, req->timeout, count, input ), NULL, 0 ); + poll_socket( sock, async, req->timeout, count, input ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = get_fd_options( sock->fd ); release_object( async ); } @@ -3357,18 +3350,11 @@ DECL_HANDLER(send_socket)
if ((async = create_request_async( fd, get_fd_comp_flags( fd ), &req->async ))) { - int success = 0; - if (status == STATUS_SUCCESS) { struct iosb *iosb = async_get_iosb( async ); iosb->result = req->total; release_object( iosb ); - success = 1; - } - else if (status == STATUS_PENDING) - { - success = 1; } set_error( status );
@@ -3381,7 +3367,7 @@ DECL_HANDLER(send_socket) /* always reselect; we changed reported_events above */ sock_reselect( sock );
- reply->wait = async_handoff( async, success, NULL, 0 ); + reply->wait = async_handoff( async, NULL, 0 ); reply->options = get_fd_options( fd ); release_object( async ); }
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- server/console.c | 5 ++--- server/device.c | 6 +++--- server/fd.c | 3 +-- server/file.h | 4 ++-- server/named_pipe.c | 5 ++--- 5 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/server/console.c b/server/console.c index 3360f680448..9c7fbaa003d 100644 --- a/server/console.c +++ b/server/console.c @@ -99,7 +99,7 @@ static const struct object_ops console_ops =
static enum server_fd_type console_get_fd_type( struct fd *fd ); static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); -static int console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); +static void console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static int console_read( struct fd *fd, struct async *async, file_pos_t pos ); static int console_flush( struct fd *fd, struct async *async ); static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); @@ -480,7 +480,7 @@ static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned set_error( STATUS_INVALID_DEVICE_REQUEST ); }
-static int console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) +static void console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) { switch (info_class) { @@ -500,7 +500,6 @@ static int console_get_volume_info( struct fd *fd, struct async *async, unsigned default: set_error( STATUS_NOT_IMPLEMENTED ); } - return 0; }
static struct object *create_console(void) diff --git a/server/device.c b/server/device.c index 8892651d048..e4a5c2f9670 100644 --- a/server/device.c +++ b/server/device.c @@ -206,7 +206,7 @@ static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos static int device_file_flush( struct fd *fd, struct async *async ); static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static void device_file_reselect_async( struct fd *fd, struct async_queue *queue ); -static int device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); +static void device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class );
static const struct object_ops device_file_ops = { @@ -614,7 +614,7 @@ static enum server_fd_type device_file_get_fd_type( struct fd *fd ) return FD_TYPE_DEVICE; }
-static int device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) +static void device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) { struct device_file *file = get_fd_user( fd ); irp_params_t params; @@ -622,7 +622,7 @@ static int device_file_get_volume_info( struct fd *fd, struct async *async, unsi memset( ¶ms, 0, sizeof(params) ); params.volume.type = IRP_CALL_VOLUME; params.volume.info_class = info_class; - return queue_irp( file, ¶ms, async ); + queue_irp( file, ¶ms, async ); }
static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos ) diff --git a/server/fd.c b/server/fd.c index e4ef29806f2..93359ea03a5 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2369,10 +2369,9 @@ void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int }
/* default get_volume_info() routine */ -int no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) +void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return 0; }
/* default ioctl() routine */ diff --git a/server/file.h b/server/file.h index 592ee6b4e6b..6b949537084 100644 --- a/server/file.h +++ b/server/file.h @@ -65,7 +65,7 @@ struct fd_ops /* query file info */ void (*get_file_info)( struct fd *, obj_handle_t, unsigned int ); /* query volume info */ - int (*get_volume_info)( struct fd *, struct async *, unsigned int ); + void (*get_volume_info)( struct fd *, struct async *, unsigned int ); /* perform an ioctl on the file */ int (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async ); /* queue an async operation */ @@ -114,7 +114,7 @@ extern int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_flush( struct fd *fd, struct async *async ); extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); -extern int no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); +extern void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); extern int no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); extern int default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); extern void no_fd_queue_async( struct fd *fd, struct async *async, int type, int count ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 20407badc4c..72a61253a54 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -146,7 +146,7 @@ static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len ); static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); static int pipe_end_flush( struct fd *fd, struct async *async ); -static int pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); +static void pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class );
@@ -740,7 +740,7 @@ static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len ) return pipe_end->pipe->obj.ops->get_full_name( &pipe_end->pipe->obj, len ); }
-static int pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) +static void pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ) { switch (info_class) { @@ -760,7 +760,6 @@ static int pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigne default: set_error( STATUS_NOT_IMPLEMENTED ); } - return 0; }
static void message_queue_read( struct pipe_end *pipe_end, struct async *async )
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- server/console.c | 16 ++++++++-------- server/device.c | 6 +++--- server/fd.c | 3 +-- server/file.h | 4 ++-- server/named_pipe.c | 13 ++++++------- 5 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/server/console.c b/server/console.c index 9c7fbaa003d..597bff994a2 100644 --- a/server/console.c +++ b/server/console.c @@ -100,7 +100,7 @@ static const struct object_ops console_ops = static enum server_fd_type console_get_fd_type( struct fd *fd ); static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); static void console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); -static int console_read( struct fd *fd, struct async *async, file_pos_t pos ); +static void console_read( struct fd *fd, struct async *async, file_pos_t pos ); static int console_flush( struct fd *fd, struct async *async ); static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
@@ -325,7 +325,7 @@ static const struct object_ops console_input_ops = console_input_destroy /* destroy */ };
-static int console_input_read( struct fd *fd, struct async *async, file_pos_t pos ); +static void console_input_read( struct fd *fd, struct async *async, file_pos_t pos ); static int console_input_flush( struct fd *fd, struct async *async ); static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
@@ -948,16 +948,16 @@ static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async } }
-static int console_read( struct fd *fd, struct async *async, file_pos_t pos ) +static void console_read( struct fd *fd, struct async *async, file_pos_t pos ) { struct console *console = get_fd_user( fd );
if (!console->server) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return queue_host_ioctl( console->server, IOCTL_CONDRV_READ_FILE, 0, async, &console->ioctl_q ); + queue_host_ioctl( console->server, IOCTL_CONDRV_READ_FILE, 0, async, &console->ioctl_q ); }
static int console_flush( struct fd *fd, struct async *async ) @@ -1349,16 +1349,16 @@ static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async * return console_ioctl( console->fd, code, async ); }
-static int console_input_read( struct fd *fd, struct async *async, file_pos_t pos ) +static void console_input_read( struct fd *fd, struct async *async, file_pos_t pos ) { struct console *console = current->process->console;
if (!console) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return console_read( console->fd, async, pos ); + console_read( console->fd, async, pos ); }
static int console_input_flush( struct fd *fd, struct async *async ) diff --git a/server/device.c b/server/device.c index e4a5c2f9670..4dd9213811a 100644 --- a/server/device.c +++ b/server/device.c @@ -201,7 +201,7 @@ static struct list *device_file_get_kernel_obj_list( struct object *obj ); static int device_file_close_handle( struct object *obj, struct process *process, obj_handle_t handle ); static void device_file_destroy( struct object *obj ); static enum server_fd_type device_file_get_fd_type( struct fd *fd ); -static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos ); +static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos ); static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); static int device_file_flush( struct fd *fd, struct async *async ); static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); @@ -625,7 +625,7 @@ static void device_file_get_volume_info( struct fd *fd, struct async *async, uns queue_irp( file, ¶ms, async ); }
-static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos ) +static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos ) { struct device_file *file = get_fd_user( fd ); irp_params_t params; @@ -634,7 +634,7 @@ static int device_file_read( struct fd *fd, struct async *async, file_pos_t pos params.read.type = IRP_CALL_READ; params.read.key = 0; params.read.pos = pos; - return queue_irp( file, ¶ms, async ); + queue_irp( file, ¶ms, async ); }
static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ) diff --git a/server/fd.c b/server/fd.c index 93359ea03a5..c2cab0da1fe 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2292,10 +2292,9 @@ static void unmount_device( struct fd *device_fd ) }
/* default read() routine */ -int no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ) +void no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return 0; }
/* default write() routine */ diff --git a/server/file.h b/server/file.h index 6b949537084..e4b8422660a 100644 --- a/server/file.h +++ b/server/file.h @@ -57,7 +57,7 @@ struct fd_ops /* get file information */ enum server_fd_type (*get_fd_type)(struct fd *fd); /* perform a read on the file */ - int (*read)(struct fd *, struct async *, file_pos_t ); + void (*read)(struct fd *, struct async *, file_pos_t ); /* perform a write on the file */ int (*write)(struct fd *, struct async *, file_pos_t ); /* flush the object buffers */ @@ -109,7 +109,7 @@ extern void default_poll_event( struct fd *fd, int event ); 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 ); +extern void no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_flush( struct fd *fd, struct async *async ); extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 72a61253a54..b81e167ddfc 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -143,7 +143,7 @@ static struct security_descriptor *pipe_end_get_sd( struct object *obj ); static int pipe_end_set_sd( struct object *obj, const struct security_descriptor *sd, unsigned int set_info ); static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len ); -static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); +static void pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); static int pipe_end_flush( struct fd *fd, struct async *async ); static void pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); @@ -893,7 +893,7 @@ static void reselect_write_queue( struct pipe_end *pipe_end ) reselect_read_queue( reader, 0 ); }
-static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ) +static void pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ) { struct pipe_end *pipe_end = get_fd_user( fd );
@@ -903,25 +903,24 @@ static int pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ) if ((pipe_end->flags & NAMED_PIPE_NONBLOCKING_MODE) && list_empty( &pipe_end->message_queue )) { set_error( STATUS_PIPE_EMPTY ); - return 0; + return; } break; case FILE_PIPE_DISCONNECTED_STATE: set_error( STATUS_PIPE_DISCONNECTED ); - return 0; + return; case FILE_PIPE_LISTENING_STATE: set_error( STATUS_PIPE_LISTENING ); - return 0; + return; case FILE_PIPE_CLOSING_STATE: if (!list_empty( &pipe_end->message_queue )) break; set_error( STATUS_PIPE_BROKEN ); - return 0; + return; }
queue_async( &pipe_end->read_q, async ); reselect_read_queue( pipe_end, 0 ); set_error( STATUS_PENDING ); - return 1; }
static int pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos )
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- server/console.c | 18 +++++++++--------- server/device.c | 6 +++--- server/fd.c | 3 +-- server/file.h | 4 ++-- server/named_pipe.c | 15 +++++++-------- 5 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/server/console.c b/server/console.c index 597bff994a2..0080e6ed163 100644 --- a/server/console.c +++ b/server/console.c @@ -240,7 +240,7 @@ static const struct object_ops screen_buffer_ops = screen_buffer_destroy /* destroy */ };
-static int screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ); +static void screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ); static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops screen_buffer_fd_ops = @@ -381,7 +381,7 @@ static const struct object_ops console_output_ops = console_output_destroy /* destroy */ };
-static int console_output_write( struct fd *fd, struct async *async, file_pos_t pos ); +static void console_output_write( struct fd *fd, struct async *async, file_pos_t pos ); static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops console_output_fd_ops = @@ -972,18 +972,18 @@ static int console_flush( struct fd *fd, struct async *async ) return queue_host_ioctl( console->server, IOCTL_CONDRV_FLUSH, 0, NULL, NULL ); }
-static int screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ) +static void screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct screen_buffer *screen_buffer = get_fd_user( fd );
if (!screen_buffer->input || !screen_buffer->input->server) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; }
- return queue_host_ioctl( screen_buffer->input->server, IOCTL_CONDRV_WRITE_FILE, - screen_buffer->id, async, &screen_buffer->ioctl_q ); + queue_host_ioctl( screen_buffer->input->server, IOCTL_CONDRV_WRITE_FILE, + screen_buffer->id, async, &screen_buffer->ioctl_q ); }
static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) @@ -1421,16 +1421,16 @@ static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async return screen_buffer_ioctl( console->active->fd, code, async ); }
-static int console_output_write( struct fd *fd, struct async *async, file_pos_t pos ) +static void console_output_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct console *console = current->process->console;
if (!console || !console->active) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return screen_buffer_write( console->active->fd, async, pos ); + screen_buffer_write( console->active->fd, async, pos ); }
struct object *create_console_device( struct object *root, const struct unicode_str *name, diff --git a/server/device.c b/server/device.c index 4dd9213811a..cc3e0466468 100644 --- a/server/device.c +++ b/server/device.c @@ -202,7 +202,7 @@ static int device_file_close_handle( struct object *obj, struct process *process static void device_file_destroy( struct object *obj ); static enum server_fd_type device_file_get_fd_type( struct fd *fd ); static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos ); -static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); +static void device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); static int device_file_flush( struct fd *fd, struct async *async ); static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static void device_file_reselect_async( struct fd *fd, struct async_queue *queue ); @@ -637,7 +637,7 @@ static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos queue_irp( file, ¶ms, async ); }
-static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos ) +static void device_file_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct device_file *file = get_fd_user( fd ); irp_params_t params; @@ -646,7 +646,7 @@ static int device_file_write( struct fd *fd, struct async *async, file_pos_t pos params.write.type = IRP_CALL_WRITE; params.write.key = 0; params.write.pos = pos; - return queue_irp( file, ¶ms, async ); + queue_irp( file, ¶ms, async ); }
static int device_file_flush( struct fd *fd, struct async *async ) diff --git a/server/fd.c b/server/fd.c index c2cab0da1fe..6b79585147d 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2298,10 +2298,9 @@ void no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ) }
/* default write() routine */ -int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ) +void no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return 0; }
/* default flush() routine */ diff --git a/server/file.h b/server/file.h index e4b8422660a..e200281d03b 100644 --- a/server/file.h +++ b/server/file.h @@ -59,7 +59,7 @@ struct fd_ops /* perform a read on the file */ void (*read)(struct fd *, struct async *, file_pos_t ); /* perform a write on the file */ - int (*write)(struct fd *, struct async *, file_pos_t ); + void (*write)(struct fd *, struct async *, file_pos_t ); /* flush the object buffers */ int (*flush)(struct fd *, struct async *); /* query file info */ @@ -110,7 +110,7 @@ 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 void no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ); -extern int no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); +extern void no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); extern int no_fd_flush( struct fd *fd, struct async *async ); extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); diff --git a/server/named_pipe.c b/server/named_pipe.c index b81e167ddfc..503dda93931 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -144,7 +144,7 @@ static int pipe_end_set_sd( struct object *obj, const struct security_descriptor unsigned int set_info ); static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len ); static void pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); -static int pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); +static void pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); static int pipe_end_flush( struct fd *fd, struct async *async ); static void pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); @@ -923,7 +923,7 @@ static void pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ) set_error( STATUS_PENDING ); }
-static int pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos ) +static void pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos ) { struct pipe_end *pipe_end = get_fd_user( fd ); struct pipe_message *message; @@ -935,27 +935,26 @@ static int pipe_end_write( struct fd *fd, struct async *async, file_pos_t pos ) break; case FILE_PIPE_DISCONNECTED_STATE: set_error( STATUS_PIPE_DISCONNECTED ); - return 0; + return; case FILE_PIPE_LISTENING_STATE: set_error( STATUS_PIPE_LISTENING ); - return 0; + return; case FILE_PIPE_CLOSING_STATE: set_error( STATUS_PIPE_CLOSING ); - return 0; + return; }
- if (!pipe_end->pipe->message_mode && !get_req_data_size()) return 1; + if (!pipe_end->pipe->message_mode && !get_req_data_size()) return;
iosb = async_get_iosb( async ); message = queue_message( pipe_end->connection, iosb ); release_object( iosb ); - if (!message) return 0; + if (!message) return;
message->async = (struct async *)grab_object( async ); queue_async( &pipe_end->write_q, async ); reselect_read_queue( pipe_end->connection, 1 ); set_error( STATUS_PENDING ); - return 1; }
static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue )
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- server/console.c | 16 ++++++++-------- server/device.c | 6 +++--- server/fd.c | 3 +-- server/file.h | 4 ++-- server/named_pipe.c | 7 +++---- 5 files changed, 17 insertions(+), 19 deletions(-)
diff --git a/server/console.c b/server/console.c index 0080e6ed163..df88b14f609 100644 --- a/server/console.c +++ b/server/console.c @@ -101,7 +101,7 @@ static enum server_fd_type console_get_fd_type( struct fd *fd ); static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); static void console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static void console_read( struct fd *fd, struct async *async, file_pos_t pos ); -static int console_flush( struct fd *fd, struct async *async ); +static void console_flush( struct fd *fd, struct async *async ); static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops console_fd_ops = @@ -326,7 +326,7 @@ static const struct object_ops console_input_ops = };
static void console_input_read( struct fd *fd, struct async *async, file_pos_t pos ); -static int console_input_flush( struct fd *fd, struct async *async ); +static void console_input_flush( struct fd *fd, struct async *async ); static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops console_input_fd_ops = @@ -960,16 +960,16 @@ static void console_read( struct fd *fd, struct async *async, file_pos_t pos ) queue_host_ioctl( console->server, IOCTL_CONDRV_READ_FILE, 0, async, &console->ioctl_q ); }
-static int console_flush( struct fd *fd, struct async *async ) +static void console_flush( struct fd *fd, struct async *async ) { struct console *console = get_fd_user( fd );
if (!console->server) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return queue_host_ioctl( console->server, IOCTL_CONDRV_FLUSH, 0, NULL, NULL ); + queue_host_ioctl( console->server, IOCTL_CONDRV_FLUSH, 0, NULL, NULL ); }
static void screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ) @@ -1361,16 +1361,16 @@ static void console_input_read( struct fd *fd, struct async *async, file_pos_t p console_read( console->fd, async, pos ); }
-static int console_input_flush( struct fd *fd, struct async *async ) +static void console_input_flush( struct fd *fd, struct async *async ) { struct console *console = current->process->console;
if (!console) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return console_flush( console->fd, async ); + console_flush( console->fd, async ); }
static void console_output_dump( struct object *obj, int verbose ) diff --git a/server/device.c b/server/device.c index cc3e0466468..7e9954a9305 100644 --- a/server/device.c +++ b/server/device.c @@ -203,7 +203,7 @@ static void device_file_destroy( struct object *obj ); static enum server_fd_type device_file_get_fd_type( struct fd *fd ); static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos ); static void device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); -static int device_file_flush( struct fd *fd, struct async *async ); +static void device_file_flush( struct fd *fd, struct async *async ); static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static void device_file_reselect_async( struct fd *fd, struct async_queue *queue ); static void device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); @@ -649,14 +649,14 @@ static void device_file_write( struct fd *fd, struct async *async, file_pos_t po queue_irp( file, ¶ms, async ); }
-static int device_file_flush( struct fd *fd, struct async *async ) +static void device_file_flush( struct fd *fd, struct async *async ) { struct device_file *file = get_fd_user( fd ); irp_params_t params;
memset( ¶ms, 0, sizeof(params) ); params.flush.type = IRP_CALL_FLUSH; - return queue_irp( file, ¶ms, async ); + queue_irp( file, ¶ms, async ); }
static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) diff --git a/server/fd.c b/server/fd.c index 6b79585147d..ca91ff724a1 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2304,10 +2304,9 @@ void no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ) }
/* default flush() routine */ -int no_fd_flush( struct fd *fd, struct async *async ) +void no_fd_flush( struct fd *fd, struct async *async ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return 0; }
/* default get_file_info() routine */ diff --git a/server/file.h b/server/file.h index e200281d03b..c4c33fc1e79 100644 --- a/server/file.h +++ b/server/file.h @@ -61,7 +61,7 @@ struct fd_ops /* perform a write on the file */ void (*write)(struct fd *, struct async *, file_pos_t ); /* flush the object buffers */ - int (*flush)(struct fd *, struct async *); + void (*flush)(struct fd *, struct async *); /* query file info */ void (*get_file_info)( struct fd *, obj_handle_t, unsigned int ); /* query volume info */ @@ -111,7 +111,7 @@ 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 void no_fd_read( struct fd *fd, struct async *async, file_pos_t pos ); extern void no_fd_write( struct fd *fd, struct async *async, file_pos_t pos ); -extern int no_fd_flush( struct fd *fd, struct async *async ); +extern void no_fd_flush( struct fd *fd, struct async *async ); extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 503dda93931..3d1b2d8b917 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -145,7 +145,7 @@ static int pipe_end_set_sd( struct object *obj, const struct security_descriptor static WCHAR *pipe_end_get_full_name( struct object *obj, data_size_t *len ); static void pipe_end_read( struct fd *fd, struct async *async, file_pos_t pos ); static void pipe_end_write( struct fd *fd, struct async *async_data, file_pos_t pos ); -static int pipe_end_flush( struct fd *fd, struct async *async ); +static void pipe_end_flush( struct fd *fd, struct async *async ); static void pipe_end_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static void pipe_end_reselect_async( struct fd *fd, struct async_queue *queue ); static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); @@ -578,14 +578,14 @@ static void named_pipe_device_file_destroy( struct object *obj ) release_object( file->device ); }
-static int pipe_end_flush( struct fd *fd, struct async *async ) +static void pipe_end_flush( struct fd *fd, struct async *async ) { struct pipe_end *pipe_end = get_fd_user( fd );
if (!pipe_end->pipe) { set_error( STATUS_PIPE_DISCONNECTED ); - return 0; + return; }
if (pipe_end->connection && !list_empty( &pipe_end->connection->message_queue )) @@ -593,7 +593,6 @@ static int pipe_end_flush( struct fd *fd, struct async *async ) fd_queue_async( pipe_end->fd, async, ASYNC_TYPE_WAIT ); set_error( STATUS_PENDING ); } - return 1; }
static void pipe_end_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class )
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- server/console.c | 83 ++++++++++---------- server/device.c | 11 ++- server/fd.c | 9 +-- server/file.h | 6 +- server/named_pipe.c | 86 ++++++++++----------- server/serial.c | 21 +++-- server/sock.c | 184 ++++++++++++++++++++++---------------------- 7 files changed, 197 insertions(+), 203 deletions(-)
diff --git a/server/console.c b/server/console.c index df88b14f609..2a23081037b 100644 --- a/server/console.c +++ b/server/console.c @@ -102,7 +102,7 @@ static void console_get_file_info( struct fd *fd, obj_handle_t handle, unsigned static void console_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); static void console_read( struct fd *fd, struct async *async, file_pos_t pos ); static void console_flush( struct fd *fd, struct async *async ); -static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops console_fd_ops = { @@ -172,7 +172,7 @@ static const struct object_ops console_server_ops = console_server_destroy /* destroy */ };
-static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops console_server_fd_ops = { @@ -241,7 +241,7 @@ static const struct object_ops screen_buffer_ops = };
static void screen_buffer_write( struct fd *fd, struct async *async, file_pos_t pos ); -static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops screen_buffer_fd_ops = { @@ -327,7 +327,7 @@ static const struct object_ops console_input_ops =
static void console_input_read( struct fd *fd, struct async *async, file_pos_t pos ); static void console_input_flush( struct fd *fd, struct async *async ); -static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops console_input_fd_ops = { @@ -382,7 +382,7 @@ static const struct object_ops console_output_ops = };
static void console_output_write( struct fd *fd, struct async *async, file_pos_t pos ); -static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops console_output_fd_ops = { @@ -438,7 +438,7 @@ static const struct object_ops console_connection_ops = console_connection_destroy /* destroy */ };
-static int console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct fd_ops console_connection_fd_ops = { @@ -913,7 +913,7 @@ static int is_blocking_read_ioctl( unsigned int code ) } }
-static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct console *console = get_fd_user( fd );
@@ -926,25 +926,25 @@ static int console_ioctl( struct fd *fd, ioctl_code_t code, struct async *async if (get_req_data_size() != sizeof(*event)) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; } group = event->group_id ? event->group_id : current->process->group_id; if (!group) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; } propagate_console_signal( console, event->event, group ); - return !get_error(); + return; }
default: if (!console->server || code >> 16 != FILE_DEVICE_CONSOLE) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); + queue_host_ioctl( console->server, code, 0, async, &console->ioctl_q ); } }
@@ -986,7 +986,7 @@ static void screen_buffer_write( struct fd *fd, struct async *async, file_pos_t screen_buffer->id, async, &screen_buffer->ioctl_q ); }
-static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct screen_buffer *screen_buffer = get_fd_user( fd );
@@ -996,25 +996,25 @@ static int screen_buffer_ioctl( struct fd *fd, ioctl_code_t code, struct async * if (!screen_buffer->input) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; }
set_active_screen_buffer( screen_buffer->input, screen_buffer ); - return 1; + return;
default: if (!screen_buffer->input || !screen_buffer->input->server || code >> 16 != FILE_DEVICE_CONSOLE || is_blocking_read_ioctl( code )) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return queue_host_ioctl( screen_buffer->input->server, code, screen_buffer->id, - async, &screen_buffer->ioctl_q ); + queue_host_ioctl( screen_buffer->input->server, code, screen_buffer->id, + async, &screen_buffer->ioctl_q ); } }
-static int console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct console_connection *console_connection = get_fd_user( fd );
@@ -1027,31 +1027,31 @@ static int console_connection_ioctl( struct fd *fd, ioctl_code_t code, struct as if (get_req_data_size() != sizeof(unsigned int)) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; } if (current->process->console) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; }
pid = *(unsigned int *)get_req_data(); if (pid == ATTACH_PARENT_PROCESS) pid = current->process->parent_id; - if (!(process = get_process_from_id( pid ))) return 0; + if (!(process = get_process_from_id( pid ))) return;
if (process->console) current->process->console = (struct console *)grab_object( process->console ); else set_error( STATUS_ACCESS_DENIED ); release_object( process ); - return !get_error(); + return; }
default: - return default_fd_ioctl( console_connection->fd, code, async ); + default_fd_ioctl( console_connection->fd, code, async ); } }
-static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct console_server *server = get_fd_user( fd );
@@ -1063,15 +1063,15 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async if (get_req_data_size() != sizeof(*event)) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; } if (!server->console) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } propagate_console_signal( server->console, event->event, event->group_id ); - return !get_error(); + return; }
case IOCTL_CONDRV_SETUP_INPUT: @@ -1084,7 +1084,7 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async if (get_req_data_size() != sizeof(unsigned int) || get_reply_max_size()) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; } if (server->term_fd != -1) { @@ -1093,10 +1093,10 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async server->term_fd = -1; } handle = *(unsigned int *)get_req_data(); - if (!handle) return 1; + if (!handle) return; if (!(file = get_file_obj( current->process, handle, FILE_READ_DATA ))) { - return 0; + return; } unix_fd = get_file_unix_fd( file ); release_object( file ); @@ -1104,7 +1104,7 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async if (tcgetattr( unix_fd, &server->termios )) { file_set_error(); - return 0; + return; } term = server->termios; term.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN); @@ -1114,16 +1114,13 @@ static int console_server_ioctl( struct fd *fd, ioctl_code_t code, struct async term.c_cc[VMIN] = 1; term.c_cc[VTIME] = 0; if (tcsetattr( unix_fd, TCSANOW, &term ) || (server->term_fd = dup( unix_fd )) == -1) - { file_set_error(); - return 0; - } - return 1; + return; }
default: set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } }
@@ -1337,16 +1334,16 @@ static void console_input_destroy( struct object *obj ) if (console_input->fd) release_object( console_input->fd ); }
-static int console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void console_input_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct console *console = current->process->console;
if (!console) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return console_ioctl( console->fd, code, async ); + console_ioctl( console->fd, code, async ); }
static void console_input_read( struct fd *fd, struct async *async, file_pos_t pos ) @@ -1409,16 +1406,16 @@ static void console_output_destroy( struct object *obj ) if (console_output->fd) release_object( console_output->fd ); }
-static int console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void console_output_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct console *console = current->process->console;
if (!console || !console->active) { set_error( STATUS_INVALID_HANDLE ); - return 0; + return; } - return screen_buffer_ioctl( console->active->fd, code, async ); + screen_buffer_ioctl( console->active->fd, code, async ); }
static void console_output_write( struct fd *fd, struct async *async, file_pos_t pos ) diff --git a/server/device.c b/server/device.c index 7e9954a9305..d9199e8ddd8 100644 --- a/server/device.c +++ b/server/device.c @@ -204,7 +204,7 @@ static enum server_fd_type device_file_get_fd_type( struct fd *fd ); static void device_file_read( struct fd *fd, struct async *async, file_pos_t pos ); static void device_file_write( struct fd *fd, struct async *async, file_pos_t pos ); static void device_file_flush( struct fd *fd, struct async *async ); -static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static void device_file_reselect_async( struct fd *fd, struct async_queue *queue ); static void device_file_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class );
@@ -596,17 +596,16 @@ static void free_irp_params( struct irp_call *irp ) }
/* queue an irp to the device */ -static int queue_irp( struct device_file *file, const irp_params_t *params, struct async *async ) +static void queue_irp( struct device_file *file, const irp_params_t *params, struct async *async ) { struct irp_call *irp = create_irp( file, params, async ); - if (!irp) return 0; + if (!irp) return;
fd_queue_async( file->fd, async, ASYNC_TYPE_WAIT ); irp->async = (struct async *)grab_object( async ); add_irp_to_queue( file->device->manager, irp, current ); release_object( irp ); async_set_unknown_status( async ); - return 1; }
static enum server_fd_type device_file_get_fd_type( struct fd *fd ) @@ -659,7 +658,7 @@ static void device_file_flush( struct fd *fd, struct async *async ) queue_irp( file, ¶ms, async ); }
-static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct device_file *file = get_fd_user( fd ); irp_params_t params; @@ -667,7 +666,7 @@ static int device_file_ioctl( struct fd *fd, ioctl_code_t code, struct async *as memset( ¶ms, 0, sizeof(params) ); params.ioctl.type = IRP_CALL_IOCTL; params.ioctl.code = code; - return queue_irp( file, ¶ms, async ); + queue_irp( file, ¶ms, async ); }
static void cancel_irp_call( struct irp_call *irp ) diff --git a/server/fd.c b/server/fd.c index ca91ff724a1..7a88f412c7a 100644 --- a/server/fd.c +++ b/server/fd.c @@ -2372,23 +2372,22 @@ void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int inf }
/* default ioctl() routine */ -int no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +void no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return 0; }
/* default ioctl() routine */ -int default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +void default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { switch(code) { case FSCTL_DISMOUNT_VOLUME: unmount_device( fd ); - return 1; + break; + default: set_error( STATUS_NOT_SUPPORTED ); - return 0; } }
diff --git a/server/file.h b/server/file.h index c4c33fc1e79..b481a68e530 100644 --- a/server/file.h +++ b/server/file.h @@ -67,7 +67,7 @@ struct fd_ops /* query volume info */ void (*get_volume_info)( struct fd *, struct async *, unsigned int ); /* perform an ioctl on the file */ - int (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async ); + void (*ioctl)(struct fd *fd, ioctl_code_t code, struct async *async ); /* queue an async operation */ void (*queue_async)(struct fd *, struct async *async, int type, int count); /* selected events for async i/o need an update */ @@ -115,8 +115,8 @@ extern void no_fd_flush( struct fd *fd, struct async *async ); extern void no_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void default_fd_get_file_info( struct fd *fd, obj_handle_t handle, unsigned int info_class ); extern void no_fd_get_volume_info( struct fd *fd, struct async *async, unsigned int info_class ); -extern int no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); -extern int default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +extern void no_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +extern void default_fd_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); extern void no_fd_queue_async( struct fd *fd, struct async *async, int type, int count ); extern void default_fd_queue_async( struct fd *fd, struct async *async, int type, int count ); extern void default_fd_reselect_async( struct fd *fd, struct async_queue *queue ); diff --git a/server/named_pipe.c b/server/named_pipe.c index 3d1b2d8b917..234dfc701d9 100644 --- a/server/named_pipe.c +++ b/server/named_pipe.c @@ -157,7 +157,7 @@ static struct object *pipe_server_lookup_name( struct object *obj, struct unicod static struct object *pipe_server_open_file( struct object *obj, unsigned int access, unsigned int sharing, unsigned int options ); static void pipe_server_destroy( struct object *obj); -static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct object_ops pipe_server_ops = { @@ -200,7 +200,7 @@ static const struct fd_ops pipe_server_fd_ops =
/* client end functions */ static void pipe_client_dump( struct object *obj, int verbose ); -static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async );
static const struct object_ops pipe_client_ops = { @@ -275,7 +275,7 @@ static const struct object_ops named_pipe_device_ops = static void named_pipe_device_file_dump( struct object *obj, int verbose ); static struct fd *named_pipe_device_file_get_fd( struct object *obj ); static WCHAR *named_pipe_device_file_get_full_name( struct object *obj, data_size_t *len ); -static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static enum server_fd_type named_pipe_device_file_get_fd_type( struct fd *fd ); static void named_pipe_device_file_destroy( struct object *obj );
@@ -973,7 +973,7 @@ static enum server_fd_type pipe_end_get_fd_type( struct fd *fd ) return FD_TYPE_PIPE; }
-static int pipe_end_peek( struct pipe_end *pipe_end ) +static void pipe_end_peek( struct pipe_end *pipe_end ) { unsigned reply_size = get_reply_max_size(); FILE_PIPE_PEEK_BUFFER *buffer; @@ -984,7 +984,7 @@ static int pipe_end_peek( struct pipe_end *pipe_end ) if (reply_size < offsetof( FILE_PIPE_PEEK_BUFFER, Data )) { set_error( STATUS_INFO_LENGTH_MISMATCH ); - return 0; + return; } reply_size -= offsetof( FILE_PIPE_PEEK_BUFFER, Data );
@@ -995,10 +995,10 @@ static int pipe_end_peek( struct pipe_end *pipe_end ) case FILE_PIPE_CLOSING_STATE: if (!list_empty( &pipe_end->message_queue )) break; set_error( STATUS_PIPE_BROKEN ); - return 0; + return; default: set_error( pipe_end->pipe ? STATUS_INVALID_PIPE_STATE : STATUS_PIPE_DISCONNECTED ); - return 0; + return; }
LIST_FOR_EACH_ENTRY( message, &pipe_end->message_queue, struct pipe_message, entry ) @@ -1012,7 +1012,7 @@ static int pipe_end_peek( struct pipe_end *pipe_end ) reply_size = min( reply_size, message_length ); }
- if (!(buffer = set_reply_data_size( offsetof( FILE_PIPE_PEEK_BUFFER, Data[reply_size] )))) return 0; + if (!(buffer = set_reply_data_size( offsetof( FILE_PIPE_PEEK_BUFFER, Data[reply_size] )))) return; buffer->NamedPipeState = pipe_end->state; buffer->ReadDataAvailable = avail; buffer->NumberOfMessages = 0; /* FIXME */ @@ -1031,10 +1031,9 @@ static int pipe_end_peek( struct pipe_end *pipe_end ) } } if (message_length > reply_size) set_error( STATUS_BUFFER_OVERFLOW ); - return 1; }
-static int pipe_end_transceive( struct pipe_end *pipe_end, struct async *async ) +static void pipe_end_transceive( struct pipe_end *pipe_end, struct async *async ) { struct pipe_message *message; struct iosb *iosb; @@ -1042,20 +1041,20 @@ static int pipe_end_transceive( struct pipe_end *pipe_end, struct async *async ) if (!pipe_end->connection) { set_error( pipe_end->pipe ? STATUS_INVALID_PIPE_STATE : STATUS_PIPE_DISCONNECTED ); - return 0; + return; }
if (!(pipe_end->flags & NAMED_PIPE_MESSAGE_STREAM_READ)) { set_error( STATUS_INVALID_READ_MODE ); - return 0; + return; }
/* not allowed if we already have read data buffered */ if (!list_empty( &pipe_end->message_queue )) { set_error( STATUS_PIPE_BUSY ); - return 0; + return; }
iosb = async_get_iosb( async ); @@ -1064,16 +1063,15 @@ static int pipe_end_transceive( struct pipe_end *pipe_end, struct async *async ) /* transaction never blocks on write, so just queue a message without async */ message = queue_message( pipe_end->connection, iosb ); release_object( iosb ); - if (!message) return 0; + if (!message) return; reselect_read_queue( pipe_end->connection, 0 );
queue_async( &pipe_end->read_q, async ); reselect_read_queue( pipe_end, 0 ); set_error( STATUS_PENDING ); - return 1; }
-static int pipe_end_get_connection_attribute( struct pipe_end *pipe_end ) +static void pipe_end_get_connection_attribute( struct pipe_end *pipe_end ) { const char *attr = get_req_data(); data_size_t value_size, attr_size = get_req_data_size(); @@ -1092,38 +1090,40 @@ static int pipe_end_get_connection_attribute( struct pipe_end *pipe_end ) else { set_error( STATUS_ILLEGAL_FUNCTION ); - return 0; + return; }
if (get_reply_max_size() < value_size) { set_error( STATUS_INFO_LENGTH_MISMATCH ); - return 0; + return; }
set_reply_data( value, value_size ); - return 1; }
-static int pipe_end_ioctl( struct pipe_end *pipe_end, ioctl_code_t code, struct async *async ) +static void pipe_end_ioctl( struct pipe_end *pipe_end, ioctl_code_t code, struct async *async ) { switch(code) { case FSCTL_PIPE_GET_CONNECTION_ATTRIBUTE: - return pipe_end_get_connection_attribute( pipe_end ); + pipe_end_get_connection_attribute( pipe_end ); + break;
case FSCTL_PIPE_PEEK: - return pipe_end_peek( pipe_end ); + pipe_end_peek( pipe_end ); + break;
case FSCTL_PIPE_TRANSCEIVE: - return pipe_end_transceive( pipe_end, async ); + pipe_end_transceive( pipe_end, async ); + break;
default: - return default_fd_ioctl( pipe_end->fd, code, async ); + default_fd_ioctl( pipe_end->fd, code, async ); } }
-static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct pipe_server *server = get_fd_user( fd );
@@ -1140,21 +1140,21 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as break; case FILE_PIPE_CONNECTED_STATE: set_error( STATUS_PIPE_CONNECTED ); - return 0; + return; case FILE_PIPE_CLOSING_STATE: set_error( STATUS_PIPE_CLOSING ); - return 0; + return; }
if (server->pipe_end.flags & NAMED_PIPE_NONBLOCKING_MODE) { set_error( STATUS_PIPE_LISTENING ); - return 0; + return; } queue_async( &server->listen_q, async ); async_wake_up( &server->pipe_end.pipe->waiters, STATUS_SUCCESS ); set_error( STATUS_PENDING ); - return 1; + return;
case FSCTL_PIPE_DISCONNECT: switch(server->pipe_end.state) @@ -1169,32 +1169,32 @@ static int pipe_server_ioctl( struct fd *fd, ioctl_code_t code, struct async *as break; case FILE_PIPE_LISTENING_STATE: set_error( STATUS_PIPE_LISTENING ); - return 0; + return; case FILE_PIPE_DISCONNECTED_STATE: set_error( STATUS_PIPE_DISCONNECTED ); - return 0; + return; }
pipe_end_disconnect( &server->pipe_end, STATUS_PIPE_DISCONNECTED ); - return 1; + return;
case FSCTL_PIPE_IMPERSONATE: if (current->process->token) /* FIXME: use the client token */ { struct token *token; if (!(token = token_duplicate( current->process->token, 0, SecurityImpersonation, NULL, NULL, 0, NULL, 0 ))) - return 0; + return; if (current->token) release_object( current->token ); current->token = token; } - return 1; + return;
default: - return pipe_end_ioctl( &server->pipe_end, code, async ); + pipe_end_ioctl( &server->pipe_end, code, async ); } }
-static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct pipe_end *client = get_fd_user( fd );
@@ -1202,10 +1202,10 @@ static int pipe_client_ioctl( struct fd *fd, ioctl_code_t code, struct async *as { case FSCTL_PIPE_LISTEN: set_error( STATUS_ILLEGAL_FUNCTION ); - return 0; + return;
default: - return pipe_end_ioctl( client, code, async ); + pipe_end_ioctl( client, code, async ); } }
@@ -1323,7 +1323,7 @@ static struct object *named_pipe_open_file( struct object *obj, unsigned int acc return &client->obj; }
-static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct named_pipe_device *device = get_fd_user( fd );
@@ -1341,11 +1341,11 @@ static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct asy size < FIELD_OFFSET(FILE_PIPE_WAIT_FOR_BUFFER, Name[buffer->NameLength/sizeof(WCHAR)])) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; } name.str = buffer->Name; name.len = (buffer->NameLength / sizeof(WCHAR)) * sizeof(WCHAR); - if (!(pipe = open_named_object( &device->obj, &named_pipe_ops, &name, 0 ))) return 0; + if (!(pipe = open_named_object( &device->obj, &named_pipe_ops, &name, 0 ))) return;
if (list_empty( &pipe->listeners )) { @@ -1356,11 +1356,11 @@ static int named_pipe_device_ioctl( struct fd *fd, ioctl_code_t code, struct asy }
release_object( pipe ); - return 1; + return; }
default: - return default_fd_ioctl( fd, code, async ); + default_fd_ioctl( fd, code, async ); } }
diff --git a/server/serial.c b/server/serial.c index d3ea4cbe420..a5f7ef917b9 100644 --- a/server/serial.c +++ b/server/serial.c @@ -63,7 +63,7 @@ static struct fd *serial_get_fd( struct object *obj ); static void serial_destroy(struct object *obj);
static enum server_fd_type serial_get_fd_type( struct fd *fd ); -static int serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static void serial_queue_async( struct fd *fd, struct async *async, int type, int count ); static void serial_reselect_async( struct fd *fd, struct async_queue *queue );
@@ -179,7 +179,7 @@ static enum server_fd_type serial_get_fd_type( struct fd *fd ) return FD_TYPE_SERIAL; }
-static int serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct serial *serial = get_fd_user( fd );
@@ -189,43 +189,42 @@ static int serial_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(serial->timeouts)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } set_reply_data( &serial->timeouts, sizeof(serial->timeouts )); - return 1; + return;
case IOCTL_SERIAL_SET_TIMEOUTS: if (get_req_data_size() < sizeof(serial->timeouts)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } memcpy( &serial->timeouts, get_req_data(), sizeof(serial->timeouts) ); - return 1; + return;
case IOCTL_SERIAL_GET_WAIT_MASK: if (get_reply_max_size() < sizeof(serial->eventmask)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } set_reply_data( &serial->eventmask, sizeof(serial->eventmask) ); - return 1; + return;
case IOCTL_SERIAL_SET_WAIT_MASK: if (get_req_data_size() < sizeof(serial->eventmask)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } serial->eventmask = *(unsigned int *)get_req_data(); serial->generation++; fd_async_wake_up( serial->fd, ASYNC_TYPE_WAIT, STATUS_SUCCESS ); - return 1; + return;
default: set_error( STATUS_NOT_SUPPORTED ); - return 0; } }
diff --git a/server/sock.c b/server/sock.c index fc181e85744..3c5f2612b51 100644 --- a/server/sock.c +++ b/server/sock.c @@ -230,7 +230,7 @@ static void sock_release_ifchange( struct sock *sock ); static int sock_get_poll_events( struct fd *fd ); static void sock_poll_event( struct fd *fd, int event ); static enum server_fd_type sock_get_fd_type( struct fd *fd ); -static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); +static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ); static void sock_queue_async( struct fd *fd, struct async *async, int type, int count ); static void sock_reselect_async( struct fd *fd, struct async_queue *queue );
@@ -2022,14 +2022,14 @@ static struct accept_req *alloc_accept_req( struct sock *sock, struct sock *acce return req; }
-static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) +static void sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { struct sock *sock = get_fd_user( fd ); int unix_fd;
assert( sock->obj.ops == &sock_ops );
- if (code != IOCTL_AFD_WINE_CREATE && (unix_fd = get_unix_fd( fd )) < 0) return 0; + if (code != IOCTL_AFD_WINE_CREATE && (unix_fd = get_unix_fd( fd )) < 0) return;
switch(code) { @@ -2040,10 +2040,10 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() != sizeof(*params)) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; } init_socket( sock, params->family, params->type, params->protocol, params->flags ); - return 0; + return; }
case IOCTL_AFD_WINE_ACCEPT: @@ -2054,31 +2054,31 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() != sizeof(handle)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
if (!(acceptsock = accept_socket( sock ))) { struct accept_req *req;
- if (sock->nonblocking) return 0; - if (get_error() != STATUS_DEVICE_NOT_READY) return 0; + if (sock->nonblocking) return; + if (get_error() != STATUS_DEVICE_NOT_READY) return;
- if (!(req = alloc_accept_req( sock, NULL, async, NULL ))) return 0; + if (!(req = alloc_accept_req( sock, NULL, async, NULL ))) return; list_add_tail( &sock->accept_list, &req->entry );
async_set_completion_callback( async, free_accept_req, req ); queue_async( &sock->accept_q, async ); sock_reselect( sock ); set_error( STATUS_PENDING ); - return 1; + return; } handle = alloc_handle( current->process, &acceptsock->obj, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, OBJ_INHERIT ); acceptsock->wparam = handle; release_object( acceptsock ); set_reply_data( &handle, sizeof(handle) ); - return 0; + return; }
case IOCTL_AFD_WINE_ACCEPT_INTO: @@ -2094,30 +2094,30 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) get_reply_max_size() - params->recv_len < params->local_len) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
remote_len = get_reply_max_size() - params->recv_len - params->local_len; if (remote_len < sizeof(int)) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
if (!(acceptsock = (struct sock *)get_handle_obj( current->process, params->accept_handle, access, &sock_ops ))) - return 0; + return;
if (acceptsock->accept_recv_req) { release_object( acceptsock ); set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
if (!(req = alloc_accept_req( sock, acceptsock, async, params ))) { release_object( acceptsock ); - return 0; + return; } list_add_tail( &sock->accept_list, &req->entry ); acceptsock->accept_recv_req = req; @@ -2128,7 +2128,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) queue_async( &sock->accept_q, async ); sock_reselect( sock ); set_error( STATUS_PENDING ); - return 1; + return; }
case IOCTL_AFD_LISTEN: @@ -2138,19 +2138,19 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(*params)) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
if (!sock->bound) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
if (listen( unix_fd, params->backlog ) < 0) { set_error( sock_get_ntstatus( errno ) ); - return 0; + return; }
sock->state = SOCK_LISTENING; @@ -2160,7 +2160,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
/* we may already be selecting for AFD_POLL_ACCEPT */ sock_reselect( sock ); - return 0; + return; }
case IOCTL_AFD_WINE_CONNECT: @@ -2176,7 +2176,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) get_req_data_size() - sizeof(*params) < params->addr_len) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } send_len = get_req_data_size() - sizeof(*params) - params->addr_len; addr = (const struct WS_sockaddr *)(params + 1); @@ -2184,36 +2184,36 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (!params->synchronous && !sock->bound) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
if (sock->accept_recv_req) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
if (sock->connect_req) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
switch (sock->state) { case SOCK_LISTENING: set_error( STATUS_INVALID_PARAMETER ); - return 0; + return;
case SOCK_CONNECTING: /* FIXME: STATUS_ADDRESS_ALREADY_ASSOCIATED probably isn't right, * but there's no status code that maps to WSAEALREADY... */ set_error( params->synchronous ? STATUS_ADDRESS_ALREADY_ASSOCIATED : STATUS_INVALID_PARAMETER ); - return 0; + return;
case SOCK_CONNECTED: set_error( STATUS_CONNECTION_ACTIVE ); - return 0; + return;
case SOCK_UNCONNECTED: case SOCK_CONNECTIONLESS: @@ -2224,7 +2224,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (!unix_len) { set_error( STATUS_INVALID_ADDRESS ); - return 0; + return; } if (unix_addr.addr.sa_family == AF_INET && !memcmp( &unix_addr.in.sin_addr, magic_loopback_addr, 4 )) unix_addr.in.sin_addr.s_addr = htonl( INADDR_LOOPBACK ); @@ -2233,7 +2233,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (ret < 0 && errno != EINPROGRESS) { set_error( sock_get_ntstatus( errno ) ); - return 0; + return; }
/* a connected or connecting socket can no longer be accepted into */ @@ -2248,11 +2248,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { sock->state = SOCK_CONNECTED;
- if (!send_len) return 1; + if (!send_len) return; }
if (!(req = mem_alloc( sizeof(*req) ))) - return 0; + return;
sock->state = SOCK_CONNECTING;
@@ -2260,7 +2260,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { sock_reselect( sock ); set_error( STATUS_DEVICE_NOT_READY ); - return 0; + return; }
req->async = (struct async *)grab_object( async ); @@ -2275,7 +2275,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) queue_async( &sock->connect_q, async ); sock_reselect( sock ); set_error( STATUS_PENDING ); - return 1; + return; }
case IOCTL_AFD_WINE_SHUTDOWN: @@ -2285,20 +2285,20 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(int)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } how = *(int *)get_req_data();
if (how > SD_BOTH) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
if (sock->state != SOCK_CONNECTED && sock->state != SOCK_CONNECTIONLESS) { set_error( STATUS_INVALID_CONNECTION ); - return 0; + return; }
if (how != SD_SEND) @@ -2324,7 +2324,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) }
sock_reselect( sock ); - return 1; + return; }
case IOCTL_AFD_WINE_ADDRESS_LIST_CHANGE: @@ -2334,26 +2334,26 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(int)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } force_async = *(int *)get_req_data();
if (sock->nonblocking && !force_async) { set_error( STATUS_DEVICE_NOT_READY ); - return 0; + return; } - if (!sock_get_ifchange( sock )) return 0; + if (!sock_get_ifchange( sock )) return; queue_async( &sock->ifchange_q, async ); set_error( STATUS_PENDING ); - return 1; + return; }
case IOCTL_AFD_WINE_FIONBIO: if (get_req_data_size() < sizeof(int)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } if (*(int *)get_req_data()) { @@ -2364,11 +2364,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (sock->mask) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; } sock->nonblocking = 0; } - return 1; + return;
case IOCTL_AFD_GET_EVENTS: { @@ -2378,7 +2378,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(params)) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
params.flags = sock->pending_events & sock->mask; @@ -2389,7 +2389,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) sock_reselect( sock );
set_reply_data( ¶ms, sizeof(params) ); - return 0; + return; }
case IOCTL_AFD_EVENT_SELECT: @@ -2407,7 +2407,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(*params)) { set_error( STATUS_INVALID_PARAMETER ); - return 1; + return; }
event_handle = params->event; @@ -2420,7 +2420,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(*params)) { set_error( STATUS_INVALID_PARAMETER ); - return 1; + return; }
event_handle = params->event; @@ -2431,7 +2431,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) !(event = get_event_obj( current->process, event_handle, EVENT_MODIFY_STATE ))) { set_error( STATUS_INVALID_PARAMETER ); - return 1; + return; }
if (sock->event) release_object( sock->event ); @@ -2444,7 +2444,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
sock_reselect( sock );
- return 1; + return; }
case IOCTL_AFD_WINE_MESSAGE_SELECT: @@ -2454,7 +2454,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(params)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
if (sock->event) release_object( sock->event ); @@ -2473,7 +2473,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
sock_reselect( sock );
- return 1; + return; }
case IOCTL_AFD_BIND: @@ -2488,27 +2488,27 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < get_reply_max_size()) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } in_size = get_req_data_size() - get_reply_max_size(); if (in_size < offsetof(struct afd_bind_params, addr.sa_data) || get_reply_max_size() < in_size - sizeof(int)) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
if (sock->bound) { set_error( STATUS_ADDRESS_ALREADY_ASSOCIATED ); - return 0; + return; }
unix_len = sockaddr_to_unix( ¶ms->addr, in_size - sizeof(int), &unix_addr ); if (!unix_len) { set_error( STATUS_INVALID_ADDRESS ); - return 0; + return; } bind_addr = unix_addr;
@@ -2543,7 +2543,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) }
set_error( sock_get_ntstatus( errno ) ); - return 1; + return; }
sock->bound = 1; @@ -2560,24 +2560,24 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async )
if (get_reply_max_size() >= sock->addr_len) set_reply_data( &sock->addr, sock->addr_len ); - return 1; + return; }
case IOCTL_AFD_GETSOCKNAME: if (!sock->bound) { set_error( STATUS_INVALID_PARAMETER ); - return 0; + return; }
if (get_reply_max_size() < sock->addr_len) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
set_reply_data( &sock->addr, sock->addr_len ); - return 1; + return;
case IOCTL_AFD_WINE_DEFER: { @@ -2587,14 +2587,14 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(*handle)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
acceptsock = (struct sock *)get_handle_obj( current->process, *handle, 0, &sock_ops ); - if (!acceptsock) return 0; + if (!acceptsock) return;
sock->deferred = acceptsock; - return 1; + return; }
case IOCTL_AFD_WINE_GET_INFO: @@ -2604,14 +2604,14 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(params)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
params.family = sock->family; params.type = sock->type; params.protocol = sock->proto; set_reply_data( ¶ms, sizeof(params) ); - return 0; + return; }
case IOCTL_AFD_WINE_GET_SO_ACCEPTCONN: @@ -2621,11 +2621,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(listening)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
set_reply_data( &listening, sizeof(listening) ); - return 1; + return; }
case IOCTL_AFD_WINE_GET_SO_ERROR: @@ -2637,13 +2637,13 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(error)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
if (getsockopt( unix_fd, SOL_SOCKET, SO_ERROR, (char *)&error, &len ) < 0) { set_error( sock_get_ntstatus( errno ) ); - return 0; + return; }
if (!error) @@ -2659,7 +2659,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) }
set_reply_data( &error, sizeof(error) ); - return 1; + return; }
case IOCTL_AFD_WINE_GET_SO_RCVBUF: @@ -2669,11 +2669,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(rcvbuf)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
set_reply_data( &rcvbuf, sizeof(rcvbuf) ); - return 1; + return; }
case IOCTL_AFD_WINE_SET_SO_RCVBUF: @@ -2683,7 +2683,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(rcvbuf)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } rcvbuf = *(DWORD *)get_req_data();
@@ -2691,7 +2691,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) sock->rcvbuf = rcvbuf; else set_error( sock_get_ntstatus( errno ) ); - return 0; + return; }
case IOCTL_AFD_WINE_GET_SO_RCVTIMEO: @@ -2701,11 +2701,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(rcvtimeo)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
set_reply_data( &rcvtimeo, sizeof(rcvtimeo) ); - return 1; + return; }
case IOCTL_AFD_WINE_SET_SO_RCVTIMEO: @@ -2715,12 +2715,12 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(rcvtimeo)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } rcvtimeo = *(DWORD *)get_req_data();
sock->rcvtimeo = rcvtimeo; - return 0; + return; }
case IOCTL_AFD_WINE_GET_SO_SNDBUF: @@ -2730,11 +2730,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(sndbuf)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
set_reply_data( &sndbuf, sizeof(sndbuf) ); - return 1; + return; }
case IOCTL_AFD_WINE_SET_SO_SNDBUF: @@ -2744,7 +2744,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(sndbuf)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } sndbuf = *(DWORD *)get_req_data();
@@ -2753,7 +2753,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) { /* setsockopt fails if a zero value is passed */ sock->sndbuf = sndbuf; - return 0; + return; } #endif
@@ -2761,7 +2761,7 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) sock->sndbuf = sndbuf; else set_error( sock_get_ntstatus( errno ) ); - return 0; + return; }
case IOCTL_AFD_WINE_GET_SO_SNDTIMEO: @@ -2771,11 +2771,11 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(sndtimeo)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
set_reply_data( &sndtimeo, sizeof(sndtimeo) ); - return 1; + return; }
case IOCTL_AFD_WINE_SET_SO_SNDTIMEO: @@ -2785,12 +2785,12 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_req_data_size() < sizeof(sndtimeo)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; } sndtimeo = *(DWORD *)get_req_data();
sock->sndtimeo = sndtimeo; - return 0; + return; }
case IOCTL_AFD_WINE_GET_SO_CONNECT_TIME: @@ -2800,19 +2800,19 @@ static int sock_ioctl( struct fd *fd, ioctl_code_t code, struct async *async ) if (get_reply_max_size() < sizeof(time)) { set_error( STATUS_BUFFER_TOO_SMALL ); - return 0; + return; }
if (sock->state == SOCK_CONNECTED) time = (current_time - sock->connect_time) / 10000000;
set_reply_data( &time, sizeof(time) ); - return 1; + return; }
default: set_error( STATUS_NOT_SUPPORTED ); - return 0; + return; } }