diff --git a/files/file.c b/files/file.c index e3e4eeb2612..65d7d6b3aa9 100644 --- a/files/file.c +++ b/files/file.c @@ -198,19 +198,10 @@ HFILE FILE_DupUnixHandle( int fd, DWORD access ) int FILE_GetUnixHandle( HANDLE handle, DWORD access ) { int unix_handle = -1; - if (access == GENERIC_READ) - { - struct get_read_fd_request *req = get_req_buffer(); - req->handle = handle; - server_call_fd( REQ_GET_READ_FD, -1, &unix_handle ); - } - else if (access == GENERIC_WRITE) - { - struct get_write_fd_request *req = get_req_buffer(); - req->handle = handle; - server_call_fd( REQ_GET_WRITE_FD, -1, &unix_handle ); - } - else ERR( "bad access %08lx\n", access ); + struct get_handle_fd_request *req = get_req_buffer(); + req->handle = handle; + req->access = access; + server_call_fd( REQ_GET_HANDLE_FD, -1, &unix_handle ); return unix_handle; } diff --git a/include/server.h b/include/server.h index 5b71126f834..f0a614d6a48 100644 --- a/include/server.h +++ b/include/server.h @@ -130,7 +130,6 @@ struct new_process_request IN int hstdout; /* handle for stdout */ IN int hstderr; /* handle for stderr */ IN int cmd_show; /* main window show mode */ - IN int alloc_fd; /* create the fd pair right now? */ IN VARARG(filename,string); /* file name of main exe */ }; @@ -542,19 +541,13 @@ struct alloc_file_handle_request }; -/* Get a Unix fd to read from a file */ -struct get_read_fd_request -{ - REQUEST_HEADER; /* request header */ - IN int handle; /* handle to the file */ -}; - - -/* Get a Unix fd to write to a file */ -struct get_write_fd_request +/* Get a Unix fd to access a file */ +struct get_handle_fd_request { REQUEST_HEADER; /* request header */ IN int handle; /* handle to the file */ + IN unsigned int access; /* wanted access rights */ + OUT int fd; /* file descriptor */ }; @@ -1396,8 +1389,7 @@ enum request REQ_OPEN_SEMAPHORE, REQ_CREATE_FILE, REQ_ALLOC_FILE_HANDLE, - REQ_GET_READ_FD, - REQ_GET_WRITE_FD, + REQ_GET_HANDLE_FD, REQ_SET_FILE_POINTER, REQ_TRUNCATE_FILE, REQ_SET_FILE_TIME, @@ -1513,8 +1505,7 @@ union generic_request struct open_semaphore_request open_semaphore; struct create_file_request create_file; struct alloc_file_handle_request alloc_file_handle; - struct get_read_fd_request get_read_fd; - struct get_write_fd_request get_write_fd; + struct get_handle_fd_request get_handle_fd; struct set_file_pointer_request set_file_pointer; struct truncate_file_request truncate_file; struct set_file_time_request set_file_time; @@ -1588,7 +1579,7 @@ union generic_request struct async_result_request async_result; }; -#define SERVER_PROTOCOL_VERSION 29 +#define SERVER_PROTOCOL_VERSION 30 /* ### make_requests end ### */ /* Everything above this line is generated automatically by tools/make_requests */ diff --git a/scheduler/process.c b/scheduler/process.c index 4f573705ff4..f51d26f2d9a 100644 --- a/scheduler/process.c +++ b/scheduler/process.c @@ -778,7 +778,6 @@ BOOL PROCESS_Create( HFILE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env, req->hstderr = GetStdHandle( STD_ERROR_HANDLE ); } req->cmd_show = startup->wShowWindow; - req->alloc_fd = 0; if (hFile == -1) /* unix process */ { diff --git a/server/async.c b/server/async.c index 379d130f95b..7978a908995 100644 --- a/server/async.c +++ b/server/async.c @@ -58,8 +58,7 @@ struct async static void async_dump( struct object *obj, int verbose ); static void async_destroy( struct object *obj ); static int async_get_poll_events( struct object *obj ); -static int async_get_read_fd( struct object *obj ); -static int async_get_write_fd( struct object *obj ); +static int async_get_fd( struct object *obj ); static int async_get_info( struct object *obj, struct get_file_info_request *req ); static void async_poll_event( struct object *obj, int event ); @@ -73,8 +72,7 @@ static const struct object_ops async_ops = no_satisfied, /* satisfied */ async_get_poll_events, /* get_poll_events */ async_poll_event, /* poll_event */ - async_get_read_fd, /* get_read_fd */ - async_get_write_fd, /* get_write_fd */ + async_get_fd, /* get_fd */ no_flush, /* flush */ async_get_info, /* get_file_info */ async_destroy /* destroy */ @@ -115,14 +113,7 @@ static int async_get_poll_events( struct object *obj ) return serial_async_get_poll_events(ov); } -static int async_get_read_fd( struct object *obj ) -{ - struct async *async = (struct async *)obj; - assert( obj->ops == &async_ops ); - return dup( async->obj.fd ); -} - -static int async_get_write_fd( struct object *obj ) +static int async_get_fd( struct object *obj ) { struct async *async = (struct async *)obj; assert( obj->ops == &async_ops ); diff --git a/server/atom.c b/server/atom.c index 0e9f47782f2..55fc6b7f23f 100644 --- a/server/atom.c +++ b/server/atom.c @@ -54,8 +54,7 @@ static const struct object_ops atom_table_ops = NULL, /* satified */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ atom_table_destroy /* destroy */ diff --git a/server/change.c b/server/change.c index 844e21b25d0..338712e9fc1 100644 --- a/server/change.c +++ b/server/change.c @@ -34,8 +34,7 @@ static const struct object_ops change_ops = no_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ no_destroy /* destroy */ diff --git a/server/console.c b/server/console.c index e8526a2f516..6f72ade2ac6 100644 --- a/server/console.c +++ b/server/console.c @@ -58,12 +58,12 @@ struct screen_buffer static void console_input_dump( struct object *obj, int verbose ); static int console_input_get_poll_events( struct object *obj ); -static int console_input_get_read_fd( struct object *obj ); +static int console_input_get_fd( struct object *obj ); static void console_input_destroy( struct object *obj ); static void screen_buffer_dump( struct object *obj, int verbose ); static int screen_buffer_get_poll_events( struct object *obj ); -static int screen_buffer_get_write_fd( struct object *obj ); +static int screen_buffer_get_fd( struct object *obj ); static void screen_buffer_destroy( struct object *obj ); /* common routine */ @@ -79,8 +79,7 @@ static const struct object_ops console_input_ops = no_satisfied, /* satisfied */ console_input_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - console_input_get_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + console_input_get_fd, /* get_fd */ no_flush, /* flush */ console_get_info, /* get_file_info */ console_input_destroy /* destroy */ @@ -96,8 +95,7 @@ static const struct object_ops screen_buffer_ops = no_satisfied, /* satisfied */ screen_buffer_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - no_read_fd, /* get_read_fd */ - screen_buffer_get_write_fd, /* get_write_fd */ + screen_buffer_get_fd, /* get_fd */ no_flush, /* flush */ console_get_info, /* get_file_info */ screen_buffer_destroy /* destroy */ @@ -352,7 +350,7 @@ static int console_input_get_poll_events( struct object *obj ) return POLLIN; } -static int console_input_get_read_fd( struct object *obj ) +static int console_input_get_fd( struct object *obj ) { struct console_input *console = (struct console_input *)obj; assert( obj->ops == &console_input_ops ); @@ -393,7 +391,7 @@ static int screen_buffer_get_poll_events( struct object *obj ) return POLLOUT; } -static int screen_buffer_get_write_fd( struct object *obj ) +static int screen_buffer_get_fd( struct object *obj ) { struct screen_buffer *console = (struct screen_buffer *)obj; assert( obj->ops == &screen_buffer_ops ); @@ -483,12 +481,12 @@ DECL_HANDLER(set_console_fd) if (!(obj = get_handle_obj( current->process, req->file_handle, GENERIC_READ | GENERIC_WRITE, NULL ))) return; - if ((fd_in = obj->ops->get_read_fd( obj )) == -1) + if ((fd_in = obj->ops->get_fd( obj )) == -1) { release_object( obj ); return; } - fd_out = obj->ops->get_write_fd( obj ); + fd_out = dup( fd_in ); release_object( obj ); if (fd_out != -1) { diff --git a/server/debugger.c b/server/debugger.c index 946d659b171..c88f82ef27e 100644 --- a/server/debugger.c +++ b/server/debugger.c @@ -53,8 +53,7 @@ static const struct object_ops debug_event_ops = no_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ debug_event_destroy /* destroy */ @@ -74,8 +73,7 @@ static const struct object_ops debug_ctx_ops = no_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ debug_ctx_destroy /* destroy */ diff --git a/server/device.c b/server/device.c index f1ab4c3515d..4183b75a2b8 100644 --- a/server/device.c +++ b/server/device.c @@ -41,8 +41,7 @@ static const struct object_ops device_ops = NULL, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ device_get_info, /* get_file_info */ no_destroy /* destroy */ diff --git a/server/event.c b/server/event.c index f259b909697..18f6b4155d6 100644 --- a/server/event.c +++ b/server/event.c @@ -35,8 +35,7 @@ static const struct object_ops event_ops = event_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ no_destroy /* destroy */ diff --git a/server/file.c b/server/file.c index 61a3dd3c922..5c0f59a285e 100644 --- a/server/file.c +++ b/server/file.c @@ -45,8 +45,7 @@ static struct file *file_hash[NAME_HASH_SIZE]; static void file_dump( struct object *obj, int verbose ); static int file_get_poll_events( struct object *obj ); -static int file_get_read_fd( struct object *obj ); -static int file_get_write_fd( struct object *obj ); +static int file_get_fd( struct object *obj ); static int file_flush( struct object *obj ); static int file_get_info( struct object *obj, struct get_file_info_request *req ); static void file_destroy( struct object *obj ); @@ -61,8 +60,7 @@ static const struct object_ops file_ops = no_satisfied, /* satisfied */ file_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - file_get_read_fd, /* get_read_fd */ - file_get_write_fd, /* get_write_fd */ + file_get_fd, /* get_fd */ file_flush, /* flush */ file_get_info, /* get_file_info */ file_destroy /* destroy */ @@ -233,14 +231,7 @@ static int file_get_poll_events( struct object *obj ) return events; } -static int file_get_read_fd( struct object *obj ) -{ - struct file *file = (struct file *)obj; - assert( obj->ops == &file_ops ); - return dup( file->obj.fd ); -} - -static int file_get_write_fd( struct object *obj ) +static int file_get_fd( struct object *obj ) { struct file *file = (struct file *)obj; assert( obj->ops == &file_ops ); @@ -480,26 +471,15 @@ DECL_HANDLER(alloc_file_handle) else set_error( STATUS_INVALID_PARAMETER ); } -/* get a Unix fd to read from a file */ -DECL_HANDLER(get_read_fd) +/* get a Unix fd to access a file */ +DECL_HANDLER(get_handle_fd) { struct object *obj; - if ((obj = get_handle_obj( current->process, req->handle, GENERIC_READ, NULL ))) + req->fd = -1; + if ((obj = get_handle_obj( current->process, req->handle, req->access, NULL ))) { - set_reply_fd( current, obj->ops->get_read_fd( obj ) ); - release_object( obj ); - } -} - -/* get a Unix fd to write to a file */ -DECL_HANDLER(get_write_fd) -{ - struct object *obj; - - if ((obj = get_handle_obj( current->process, req->handle, GENERIC_WRITE, NULL ))) - { - set_reply_fd( current, obj->ops->get_write_fd( obj ) ); + set_reply_fd( current, obj->ops->get_fd( obj ) ); release_object( obj ); } } diff --git a/server/handle.c b/server/handle.c index e71c261d499..1d1317f7f89 100644 --- a/server/handle.c +++ b/server/handle.c @@ -76,8 +76,7 @@ static const struct object_ops handle_table_ops = NULL, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ handle_table_destroy /* destroy */ diff --git a/server/mapping.c b/server/mapping.c index 254924eb3f8..a68e8fb8285 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -43,8 +43,7 @@ static const struct object_ops mapping_ops = NULL, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ mapping_destroy /* destroy */ diff --git a/server/mutex.c b/server/mutex.c index 82b76c26b05..1adf373f08c 100644 --- a/server/mutex.c +++ b/server/mutex.c @@ -39,8 +39,7 @@ static const struct object_ops mutex_ops = mutex_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ mutex_destroy /* destroy */ diff --git a/server/object.c b/server/object.c index f2a7f1feeb4..ba2bce85057 100644 --- a/server/object.c +++ b/server/object.c @@ -251,13 +251,7 @@ int no_satisfied( struct object *obj, struct thread *thread ) return 0; /* not abandoned */ } -int no_read_fd( struct object *obj ) -{ - set_error( STATUS_OBJECT_TYPE_MISMATCH ); - return -1; -} - -int no_write_fd( struct object *obj ) +int no_get_fd( struct object *obj ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); return -1; diff --git a/server/object.h b/server/object.h index 746b7f6641b..7a7d1a3d013 100644 --- a/server/object.h +++ b/server/object.h @@ -46,10 +46,8 @@ struct object_ops int (*get_poll_events)(struct object *); /* a poll() event occured */ void (*poll_event)(struct object *,int event); - /* return a Unix fd that can be used to read from the object */ - int (*get_read_fd)(struct object *); - /* return a Unix fd that can be used to write to the object */ - int (*get_write_fd)(struct object *); + /* return a Unix fd that can be used to read/write from the object */ + int (*get_fd)(struct object *); /* flush the object buffers */ int (*flush)(struct object *); /* get file information */ @@ -93,8 +91,7 @@ extern void release_object( void *obj ); extern struct object *find_object( const WCHAR *name, size_t len ); extern int no_add_queue( struct object *obj, struct wait_queue_entry *entry ); extern int no_satisfied( struct object *obj, struct thread *thread ); -extern int no_read_fd( struct object *obj ); -extern int no_write_fd( struct object *obj ); +extern int no_get_fd( struct object *obj ); extern int no_flush( struct object *obj ); extern int no_get_file_info( struct object *obj, struct get_file_info_request *info ); extern void no_destroy( struct object *obj ); diff --git a/server/pipe.c b/server/pipe.c index d86fde86ee3..5c830c0897b 100644 --- a/server/pipe.c +++ b/server/pipe.c @@ -37,8 +37,7 @@ struct pipe static void pipe_dump( struct object *obj, int verbose ); static int pipe_get_poll_events( struct object *obj ); -static int pipe_get_read_fd( struct object *obj ); -static int pipe_get_write_fd( struct object *obj ); +static int pipe_get_fd( struct object *obj ); static int pipe_get_info( struct object *obj, struct get_file_info_request *req ); static void pipe_destroy( struct object *obj ); @@ -52,8 +51,7 @@ static const struct object_ops pipe_ops = no_satisfied, /* satisfied */ pipe_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - pipe_get_read_fd, /* get_read_fd */ - pipe_get_write_fd, /* get_write_fd */ + pipe_get_fd, /* get_fd */ no_flush, /* flush */ pipe_get_info, /* get_file_info */ pipe_destroy /* destroy */ @@ -114,7 +112,7 @@ static int pipe_get_poll_events( struct object *obj ) return (pipe->side == READ_SIDE) ? POLLIN : POLLOUT; } -static int pipe_get_read_fd( struct object *obj ) +static int pipe_get_fd( struct object *obj ) { struct pipe *pipe = (struct pipe *)obj; assert( obj->ops == &pipe_ops ); @@ -124,29 +122,6 @@ static int pipe_get_read_fd( struct object *obj ) set_error( STATUS_PIPE_BROKEN ); return -1; } - if (pipe->side != READ_SIDE) /* FIXME: should not be necessary */ - { - set_error( STATUS_ACCESS_DENIED ); - return -1; - } - return dup( pipe->obj.fd ); -} - -static int pipe_get_write_fd( struct object *obj ) -{ - struct pipe *pipe = (struct pipe *)obj; - assert( obj->ops == &pipe_ops ); - - if (!pipe->other) - { - set_error( STATUS_PIPE_BROKEN ); - return -1; - } - if (pipe->side != WRITE_SIDE) /* FIXME: should not be necessary */ - { - set_error( STATUS_ACCESS_DENIED ); - return -1; - } return dup( pipe->obj.fd ); } diff --git a/server/process.c b/server/process.c index bdf4be68e5e..c88bd40ccac 100644 --- a/server/process.c +++ b/server/process.c @@ -48,8 +48,7 @@ static const struct object_ops process_ops = no_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ process_destroy /* destroy */ @@ -87,8 +86,7 @@ static const struct object_ops startup_info_ops = no_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ startup_info_destroy /* destroy */ @@ -716,7 +714,6 @@ DECL_HANDLER(new_process) { size_t len = get_req_data_size( req ); struct startup_info *info; - int sock[2]; if (current->info) { @@ -752,24 +749,6 @@ DECL_HANDLER(new_process) } memcpy( info->filename, get_req_data(req), len ); info->filename[len] = 0; - - if (req->alloc_fd) - { - if (socketpair( AF_UNIX, SOCK_STREAM, 0, sock ) == -1) - { - file_set_error(); - release_object( info ); - return; - } - if (!create_process( sock[0] )) - { - release_object( info ); - close( sock[1] ); - return; - } - /* thread object will be released when the thread gets killed */ - set_reply_fd( current, sock[1] ); - } current->info = info; } diff --git a/server/queue.c b/server/queue.c index 80cfda69461..8d63e7bc9b5 100644 --- a/server/queue.c +++ b/server/queue.c @@ -36,8 +36,7 @@ static const struct object_ops msg_queue_ops = msg_queue_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ no_destroy /* destroy */ diff --git a/server/registry.c b/server/registry.c index 3c1d57c8d77..af7ba8a0510 100644 --- a/server/registry.c +++ b/server/registry.c @@ -137,8 +137,7 @@ static const struct object_ops key_ops = NULL, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ key_destroy /* destroy */ @@ -1341,7 +1340,7 @@ static void load_registry( struct key *key, int handle ) int fd; if (!(obj = get_handle_obj( current->process, handle, GENERIC_READ, NULL ))) return; - fd = obj->ops->get_read_fd( obj ); + fd = obj->ops->get_fd( obj ); release_object( obj ); if (fd != -1) { @@ -1436,7 +1435,7 @@ static void save_registry( struct key *key, int handle ) return; } if (!(obj = get_handle_obj( current->process, handle, GENERIC_WRITE, NULL ))) return; - fd = obj->ops->get_write_fd( obj ); + fd = obj->ops->get_fd( obj ); release_object( obj ); if (fd != -1) { diff --git a/server/request.c b/server/request.c index 5ad899a90d3..c3928e5ccb0 100644 --- a/server/request.c +++ b/server/request.c @@ -64,8 +64,7 @@ static const struct object_ops master_socket_ops = NULL, /* satisfied */ NULL, /* get_poll_events */ master_socket_poll_event, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ master_socket_destroy /* destroy */ diff --git a/server/request.h b/server/request.h index ec32edfdd23..ef856f31d6d 100644 --- a/server/request.h +++ b/server/request.h @@ -106,8 +106,7 @@ DECL_HANDLER(release_semaphore); DECL_HANDLER(open_semaphore); DECL_HANDLER(create_file); DECL_HANDLER(alloc_file_handle); -DECL_HANDLER(get_read_fd); -DECL_HANDLER(get_write_fd); +DECL_HANDLER(get_handle_fd); DECL_HANDLER(set_file_pointer); DECL_HANDLER(truncate_file); DECL_HANDLER(set_file_time); @@ -222,8 +221,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] = (req_handler)req_open_semaphore, (req_handler)req_create_file, (req_handler)req_alloc_file_handle, - (req_handler)req_get_read_fd, - (req_handler)req_get_write_fd, + (req_handler)req_get_handle_fd, (req_handler)req_set_file_pointer, (req_handler)req_truncate_file, (req_handler)req_set_file_time, diff --git a/server/semaphore.c b/server/semaphore.c index 25c0c519611..710f6ab58bb 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -35,8 +35,7 @@ static const struct object_ops semaphore_ops = semaphore_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ no_destroy /* destroy */ diff --git a/server/serial.c b/server/serial.c index c549becd41b..7d30d4dc957 100644 --- a/server/serial.c +++ b/server/serial.c @@ -37,8 +37,7 @@ #include "request.h" static void serial_dump( struct object *obj, int verbose ); -static int serial_get_read_fd( struct object *obj ); -static int serial_get_write_fd( struct object *obj ); +static int serial_get_fd( struct object *obj ); static int serial_get_info( struct object *obj, struct get_file_info_request *req ); static int serial_get_poll_events( struct object *obj ); @@ -72,8 +71,7 @@ static const struct object_ops serial_ops = no_satisfied, /* satisfied */ serial_get_poll_events, /* get_poll_events */ default_poll_event, /* poll_event */ - serial_get_read_fd, /* get_read_fd */ - serial_get_write_fd, /* get_write_fd */ + serial_get_fd, /* get_fd */ no_flush, /* flush */ serial_get_info, /* get_file_info */ no_destroy /* destroy */ @@ -152,14 +150,7 @@ static int serial_get_poll_events( struct object *obj ) return events; } -static int serial_get_read_fd( struct object *obj ) -{ - struct serial *serial = (struct serial *)obj; - assert( obj->ops == &serial_ops ); - return dup( serial->obj.fd ); -} - -static int serial_get_write_fd( struct object *obj ) +static int serial_get_fd( struct object *obj ) { struct serial *serial = (struct serial *)obj; assert( obj->ops == &serial_ops ); diff --git a/server/snapshot.c b/server/snapshot.c index 0a690eb8eb1..ae4eb4926ac 100644 --- a/server/snapshot.c +++ b/server/snapshot.c @@ -47,8 +47,7 @@ static const struct object_ops snapshot_ops = NULL, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ snapshot_destroy /* destroy */ diff --git a/server/sock.c b/server/sock.c index 72cea8964c0..c5f41e4f0d5 100644 --- a/server/sock.c +++ b/server/sock.c @@ -69,8 +69,7 @@ static const struct object_ops sock_ops = no_satisfied, /* satisfied */ sock_get_poll_events, /* get_poll_events */ sock_poll_event, /* poll_event */ - sock_get_fd, /* get_read_fd */ - sock_get_fd, /* get_write_fd */ + sock_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ sock_destroy /* destroy */ diff --git a/server/thread.c b/server/thread.c index d21cdd7a228..7cfacdc2dad 100644 --- a/server/thread.c +++ b/server/thread.c @@ -76,8 +76,7 @@ static const struct object_ops thread_ops = no_satisfied, /* satisfied */ NULL, /* get_poll_events */ thread_poll_event, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ destroy_thread /* destroy */ diff --git a/server/timer.c b/server/timer.c index d74fc72fe36..198b0f5dd09 100644 --- a/server/timer.c +++ b/server/timer.c @@ -42,8 +42,7 @@ static const struct object_ops timer_ops = timer_satisfied, /* satisfied */ NULL, /* get_poll_events */ NULL, /* poll_event */ - no_read_fd, /* get_read_fd */ - no_write_fd, /* get_write_fd */ + no_get_fd, /* get_fd */ no_flush, /* flush */ no_get_file_info, /* get_file_info */ timer_destroy /* destroy */ diff --git a/server/trace.c b/server/trace.c index 6b6f3abfdaf..bad07e832f8 100644 --- a/server/trace.c +++ b/server/trace.c @@ -256,7 +256,6 @@ static void dump_new_process_request( const struct new_process_request *req ) fprintf( stderr, " hstdout=%d,", req->hstdout ); fprintf( stderr, " hstderr=%d,", req->hstderr ); fprintf( stderr, " cmd_show=%d,", req->cmd_show ); - fprintf( stderr, " alloc_fd=%d,", req->alloc_fd ); fprintf( stderr, " filename=" ); cur_pos += dump_varargs_string( req ); } @@ -657,14 +656,15 @@ static void dump_alloc_file_handle_reply( const struct alloc_file_handle_request fprintf( stderr, " handle=%d", req->handle ); } -static void dump_get_read_fd_request( const struct get_read_fd_request *req ) +static void dump_get_handle_fd_request( const struct get_handle_fd_request *req ) { - fprintf( stderr, " handle=%d", req->handle ); + fprintf( stderr, " handle=%d,", req->handle ); + fprintf( stderr, " access=%08x", req->access ); } -static void dump_get_write_fd_request( const struct get_write_fd_request *req ) +static void dump_get_handle_fd_reply( const struct get_handle_fd_request *req ) { - fprintf( stderr, " handle=%d", req->handle ); + fprintf( stderr, " fd=%d", req->fd ); } static void dump_set_file_pointer_request( const struct set_file_pointer_request *req ) @@ -1487,8 +1487,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = { (dump_func)dump_open_semaphore_request, (dump_func)dump_create_file_request, (dump_func)dump_alloc_file_handle_request, - (dump_func)dump_get_read_fd_request, - (dump_func)dump_get_write_fd_request, + (dump_func)dump_get_handle_fd_request, (dump_func)dump_set_file_pointer_request, (dump_func)dump_truncate_file_request, (dump_func)dump_set_file_time_request, @@ -1600,8 +1599,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { (dump_func)dump_open_semaphore_reply, (dump_func)dump_create_file_reply, (dump_func)dump_alloc_file_handle_reply, - (dump_func)0, - (dump_func)0, + (dump_func)dump_get_handle_fd_reply, (dump_func)dump_set_file_pointer_reply, (dump_func)0, (dump_func)0, @@ -1713,8 +1711,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = { "open_semaphore", "create_file", "alloc_file_handle", - "get_read_fd", - "get_write_fd", + "get_handle_fd", "set_file_pointer", "truncate_file", "set_file_time",