Commit 1ab243ba authored by Alexandre Julliard's avatar Alexandre Julliard

Merged the get_read_fd and get_write_fd requests.

parent d88dbb4a
...@@ -198,19 +198,10 @@ HFILE FILE_DupUnixHandle( int fd, DWORD access ) ...@@ -198,19 +198,10 @@ HFILE FILE_DupUnixHandle( int fd, DWORD access )
int FILE_GetUnixHandle( HANDLE handle, DWORD access ) int FILE_GetUnixHandle( HANDLE handle, DWORD access )
{ {
int unix_handle = -1; int unix_handle = -1;
if (access == GENERIC_READ) struct get_handle_fd_request *req = get_req_buffer();
{ req->handle = handle;
struct get_read_fd_request *req = get_req_buffer(); req->access = access;
req->handle = handle; server_call_fd( REQ_GET_HANDLE_FD, -1, &unix_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 );
return unix_handle; return unix_handle;
} }
......
...@@ -130,7 +130,6 @@ struct new_process_request ...@@ -130,7 +130,6 @@ struct new_process_request
IN int hstdout; /* handle for stdout */ IN int hstdout; /* handle for stdout */
IN int hstderr; /* handle for stderr */ IN int hstderr; /* handle for stderr */
IN int cmd_show; /* main window show mode */ 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 */ IN VARARG(filename,string); /* file name of main exe */
}; };
...@@ -542,19 +541,13 @@ struct alloc_file_handle_request ...@@ -542,19 +541,13 @@ struct alloc_file_handle_request
}; };
/* Get a Unix fd to read from a file */ /* Get a Unix fd to access a file */
struct get_read_fd_request struct get_handle_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
{ {
REQUEST_HEADER; /* request header */ REQUEST_HEADER; /* request header */
IN int handle; /* handle to the file */ 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 ...@@ -1396,8 +1389,7 @@ enum request
REQ_OPEN_SEMAPHORE, REQ_OPEN_SEMAPHORE,
REQ_CREATE_FILE, REQ_CREATE_FILE,
REQ_ALLOC_FILE_HANDLE, REQ_ALLOC_FILE_HANDLE,
REQ_GET_READ_FD, REQ_GET_HANDLE_FD,
REQ_GET_WRITE_FD,
REQ_SET_FILE_POINTER, REQ_SET_FILE_POINTER,
REQ_TRUNCATE_FILE, REQ_TRUNCATE_FILE,
REQ_SET_FILE_TIME, REQ_SET_FILE_TIME,
...@@ -1513,8 +1505,7 @@ union generic_request ...@@ -1513,8 +1505,7 @@ union generic_request
struct open_semaphore_request open_semaphore; struct open_semaphore_request open_semaphore;
struct create_file_request create_file; struct create_file_request create_file;
struct alloc_file_handle_request alloc_file_handle; struct alloc_file_handle_request alloc_file_handle;
struct get_read_fd_request get_read_fd; struct get_handle_fd_request get_handle_fd;
struct get_write_fd_request get_write_fd;
struct set_file_pointer_request set_file_pointer; struct set_file_pointer_request set_file_pointer;
struct truncate_file_request truncate_file; struct truncate_file_request truncate_file;
struct set_file_time_request set_file_time; struct set_file_time_request set_file_time;
...@@ -1588,7 +1579,7 @@ union generic_request ...@@ -1588,7 +1579,7 @@ union generic_request
struct async_result_request async_result; struct async_result_request async_result;
}; };
#define SERVER_PROTOCOL_VERSION 29 #define SERVER_PROTOCOL_VERSION 30
/* ### make_requests end ### */ /* ### make_requests end ### */
/* Everything above this line is generated automatically by tools/make_requests */ /* Everything above this line is generated automatically by tools/make_requests */
......
...@@ -778,7 +778,6 @@ BOOL PROCESS_Create( HFILE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env, ...@@ -778,7 +778,6 @@ BOOL PROCESS_Create( HFILE hFile, LPCSTR filename, LPSTR cmd_line, LPCSTR env,
req->hstderr = GetStdHandle( STD_ERROR_HANDLE ); req->hstderr = GetStdHandle( STD_ERROR_HANDLE );
} }
req->cmd_show = startup->wShowWindow; req->cmd_show = startup->wShowWindow;
req->alloc_fd = 0;
if (hFile == -1) /* unix process */ if (hFile == -1) /* unix process */
{ {
......
...@@ -58,8 +58,7 @@ struct async ...@@ -58,8 +58,7 @@ struct async
static void async_dump( struct object *obj, int verbose ); static void async_dump( struct object *obj, int verbose );
static void async_destroy( struct object *obj ); static void async_destroy( struct object *obj );
static int async_get_poll_events( 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_fd( struct object *obj );
static int async_get_write_fd( struct object *obj );
static int async_get_info( struct object *obj, struct get_file_info_request *req ); static int async_get_info( struct object *obj, struct get_file_info_request *req );
static void async_poll_event( struct object *obj, int event ); static void async_poll_event( struct object *obj, int event );
...@@ -73,8 +72,7 @@ static const struct object_ops async_ops = ...@@ -73,8 +72,7 @@ static const struct object_ops async_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
async_get_poll_events, /* get_poll_events */ async_get_poll_events, /* get_poll_events */
async_poll_event, /* poll_event */ async_poll_event, /* poll_event */
async_get_read_fd, /* get_read_fd */ async_get_fd, /* get_fd */
async_get_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
async_get_info, /* get_file_info */ async_get_info, /* get_file_info */
async_destroy /* destroy */ async_destroy /* destroy */
...@@ -115,14 +113,7 @@ static int async_get_poll_events( struct object *obj ) ...@@ -115,14 +113,7 @@ static int async_get_poll_events( struct object *obj )
return serial_async_get_poll_events(ov); return serial_async_get_poll_events(ov);
} }
static int async_get_read_fd( struct object *obj ) static int async_get_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 )
{ {
struct async *async = (struct async *)obj; struct async *async = (struct async *)obj;
assert( obj->ops == &async_ops ); assert( obj->ops == &async_ops );
......
...@@ -54,8 +54,7 @@ static const struct object_ops atom_table_ops = ...@@ -54,8 +54,7 @@ static const struct object_ops atom_table_ops =
NULL, /* satified */ NULL, /* satified */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
atom_table_destroy /* destroy */ atom_table_destroy /* destroy */
......
...@@ -34,8 +34,7 @@ static const struct object_ops change_ops = ...@@ -34,8 +34,7 @@ static const struct object_ops change_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
no_destroy /* destroy */ no_destroy /* destroy */
......
...@@ -58,12 +58,12 @@ struct screen_buffer ...@@ -58,12 +58,12 @@ struct screen_buffer
static void console_input_dump( struct object *obj, int verbose ); 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_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 console_input_destroy( struct object *obj );
static void screen_buffer_dump( struct object *obj, int verbose ); 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_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 ); static void screen_buffer_destroy( struct object *obj );
/* common routine */ /* common routine */
...@@ -79,8 +79,7 @@ static const struct object_ops console_input_ops = ...@@ -79,8 +79,7 @@ static const struct object_ops console_input_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
console_input_get_poll_events, /* get_poll_events */ console_input_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */ default_poll_event, /* poll_event */
console_input_get_read_fd, /* get_read_fd */ console_input_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
console_get_info, /* get_file_info */ console_get_info, /* get_file_info */
console_input_destroy /* destroy */ console_input_destroy /* destroy */
...@@ -96,8 +95,7 @@ static const struct object_ops screen_buffer_ops = ...@@ -96,8 +95,7 @@ static const struct object_ops screen_buffer_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
screen_buffer_get_poll_events, /* get_poll_events */ screen_buffer_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */ default_poll_event, /* poll_event */
no_read_fd, /* get_read_fd */ screen_buffer_get_fd, /* get_fd */
screen_buffer_get_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
console_get_info, /* get_file_info */ console_get_info, /* get_file_info */
screen_buffer_destroy /* destroy */ screen_buffer_destroy /* destroy */
...@@ -352,7 +350,7 @@ static int console_input_get_poll_events( struct object *obj ) ...@@ -352,7 +350,7 @@ static int console_input_get_poll_events( struct object *obj )
return POLLIN; 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; struct console_input *console = (struct console_input *)obj;
assert( obj->ops == &console_input_ops ); assert( obj->ops == &console_input_ops );
...@@ -393,7 +391,7 @@ static int screen_buffer_get_poll_events( struct object *obj ) ...@@ -393,7 +391,7 @@ static int screen_buffer_get_poll_events( struct object *obj )
return POLLOUT; 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; struct screen_buffer *console = (struct screen_buffer *)obj;
assert( obj->ops == &screen_buffer_ops ); assert( obj->ops == &screen_buffer_ops );
...@@ -483,12 +481,12 @@ DECL_HANDLER(set_console_fd) ...@@ -483,12 +481,12 @@ DECL_HANDLER(set_console_fd)
if (!(obj = get_handle_obj( current->process, req->file_handle, if (!(obj = get_handle_obj( current->process, req->file_handle,
GENERIC_READ | GENERIC_WRITE, NULL ))) return; 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 ); release_object( obj );
return; return;
} }
fd_out = obj->ops->get_write_fd( obj ); fd_out = dup( fd_in );
release_object( obj ); release_object( obj );
if (fd_out != -1) if (fd_out != -1)
{ {
......
...@@ -53,8 +53,7 @@ static const struct object_ops debug_event_ops = ...@@ -53,8 +53,7 @@ static const struct object_ops debug_event_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
debug_event_destroy /* destroy */ debug_event_destroy /* destroy */
...@@ -74,8 +73,7 @@ static const struct object_ops debug_ctx_ops = ...@@ -74,8 +73,7 @@ static const struct object_ops debug_ctx_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
debug_ctx_destroy /* destroy */ debug_ctx_destroy /* destroy */
......
...@@ -41,8 +41,7 @@ static const struct object_ops device_ops = ...@@ -41,8 +41,7 @@ static const struct object_ops device_ops =
NULL, /* satisfied */ NULL, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
device_get_info, /* get_file_info */ device_get_info, /* get_file_info */
no_destroy /* destroy */ no_destroy /* destroy */
......
...@@ -35,8 +35,7 @@ static const struct object_ops event_ops = ...@@ -35,8 +35,7 @@ static const struct object_ops event_ops =
event_satisfied, /* satisfied */ event_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
no_destroy /* destroy */ no_destroy /* destroy */
......
...@@ -45,8 +45,7 @@ static struct file *file_hash[NAME_HASH_SIZE]; ...@@ -45,8 +45,7 @@ static struct file *file_hash[NAME_HASH_SIZE];
static void file_dump( struct object *obj, int verbose ); static void file_dump( struct object *obj, int verbose );
static int file_get_poll_events( struct object *obj ); static int file_get_poll_events( struct object *obj );
static int file_get_read_fd( struct object *obj ); static int file_get_fd( struct object *obj );
static int file_get_write_fd( struct object *obj );
static int file_flush( 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 int file_get_info( struct object *obj, struct get_file_info_request *req );
static void file_destroy( struct object *obj ); static void file_destroy( struct object *obj );
...@@ -61,8 +60,7 @@ static const struct object_ops file_ops = ...@@ -61,8 +60,7 @@ static const struct object_ops file_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
file_get_poll_events, /* get_poll_events */ file_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */ default_poll_event, /* poll_event */
file_get_read_fd, /* get_read_fd */ file_get_fd, /* get_fd */
file_get_write_fd, /* get_write_fd */
file_flush, /* flush */ file_flush, /* flush */
file_get_info, /* get_file_info */ file_get_info, /* get_file_info */
file_destroy /* destroy */ file_destroy /* destroy */
...@@ -233,14 +231,7 @@ static int file_get_poll_events( struct object *obj ) ...@@ -233,14 +231,7 @@ static int file_get_poll_events( struct object *obj )
return events; return events;
} }
static int file_get_read_fd( struct object *obj ) static int file_get_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 )
{ {
struct file *file = (struct file *)obj; struct file *file = (struct file *)obj;
assert( obj->ops == &file_ops ); assert( obj->ops == &file_ops );
...@@ -480,26 +471,15 @@ DECL_HANDLER(alloc_file_handle) ...@@ -480,26 +471,15 @@ DECL_HANDLER(alloc_file_handle)
else set_error( STATUS_INVALID_PARAMETER ); else set_error( STATUS_INVALID_PARAMETER );
} }
/* get a Unix fd to read from a file */ /* get a Unix fd to access a file */
DECL_HANDLER(get_read_fd) DECL_HANDLER(get_handle_fd)
{
struct object *obj;
if ((obj = get_handle_obj( current->process, req->handle, GENERIC_READ, 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; struct object *obj;
if ((obj = get_handle_obj( current->process, req->handle, GENERIC_WRITE, NULL ))) req->fd = -1;
if ((obj = get_handle_obj( current->process, req->handle, req->access, NULL )))
{ {
set_reply_fd( current, obj->ops->get_write_fd( obj ) ); set_reply_fd( current, obj->ops->get_fd( obj ) );
release_object( obj ); release_object( obj );
} }
} }
......
...@@ -76,8 +76,7 @@ static const struct object_ops handle_table_ops = ...@@ -76,8 +76,7 @@ static const struct object_ops handle_table_ops =
NULL, /* satisfied */ NULL, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
handle_table_destroy /* destroy */ handle_table_destroy /* destroy */
......
...@@ -43,8 +43,7 @@ static const struct object_ops mapping_ops = ...@@ -43,8 +43,7 @@ static const struct object_ops mapping_ops =
NULL, /* satisfied */ NULL, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
mapping_destroy /* destroy */ mapping_destroy /* destroy */
......
...@@ -39,8 +39,7 @@ static const struct object_ops mutex_ops = ...@@ -39,8 +39,7 @@ static const struct object_ops mutex_ops =
mutex_satisfied, /* satisfied */ mutex_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
mutex_destroy /* destroy */ mutex_destroy /* destroy */
......
...@@ -251,13 +251,7 @@ int no_satisfied( struct object *obj, struct thread *thread ) ...@@ -251,13 +251,7 @@ int no_satisfied( struct object *obj, struct thread *thread )
return 0; /* not abandoned */ return 0; /* not abandoned */
} }
int no_read_fd( struct object *obj ) int no_get_fd( struct object *obj )
{
set_error( STATUS_OBJECT_TYPE_MISMATCH );
return -1;
}
int no_write_fd( struct object *obj )
{ {
set_error( STATUS_OBJECT_TYPE_MISMATCH ); set_error( STATUS_OBJECT_TYPE_MISMATCH );
return -1; return -1;
......
...@@ -46,10 +46,8 @@ struct object_ops ...@@ -46,10 +46,8 @@ struct object_ops
int (*get_poll_events)(struct object *); int (*get_poll_events)(struct object *);
/* a poll() event occured */ /* a poll() event occured */
void (*poll_event)(struct object *,int event); void (*poll_event)(struct object *,int event);
/* return a Unix fd that can be used to read from the object */ /* return a Unix fd that can be used to read/write from the object */
int (*get_read_fd)(struct object *); int (*get_fd)(struct object *);
/* return a Unix fd that can be used to write to the object */
int (*get_write_fd)(struct object *);
/* flush the object buffers */ /* flush the object buffers */
int (*flush)(struct object *); int (*flush)(struct object *);
/* get file information */ /* get file information */
...@@ -93,8 +91,7 @@ extern void release_object( void *obj ); ...@@ -93,8 +91,7 @@ extern void release_object( void *obj );
extern struct object *find_object( const WCHAR *name, size_t len ); 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_add_queue( struct object *obj, struct wait_queue_entry *entry );
extern int no_satisfied( struct object *obj, struct thread *thread ); extern int no_satisfied( struct object *obj, struct thread *thread );
extern int no_read_fd( struct object *obj ); extern int no_get_fd( struct object *obj );
extern int no_write_fd( struct object *obj );
extern int no_flush( 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 int no_get_file_info( struct object *obj, struct get_file_info_request *info );
extern void no_destroy( struct object *obj ); extern void no_destroy( struct object *obj );
......
...@@ -37,8 +37,7 @@ struct pipe ...@@ -37,8 +37,7 @@ struct pipe
static void pipe_dump( struct object *obj, int verbose ); static void pipe_dump( struct object *obj, int verbose );
static int pipe_get_poll_events( struct object *obj ); static int pipe_get_poll_events( struct object *obj );
static int pipe_get_read_fd( struct object *obj ); static int pipe_get_fd( struct object *obj );
static int pipe_get_write_fd( struct object *obj );
static int pipe_get_info( struct object *obj, struct get_file_info_request *req ); static int pipe_get_info( struct object *obj, struct get_file_info_request *req );
static void pipe_destroy( struct object *obj ); static void pipe_destroy( struct object *obj );
...@@ -52,8 +51,7 @@ static const struct object_ops pipe_ops = ...@@ -52,8 +51,7 @@ static const struct object_ops pipe_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
pipe_get_poll_events, /* get_poll_events */ pipe_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */ default_poll_event, /* poll_event */
pipe_get_read_fd, /* get_read_fd */ pipe_get_fd, /* get_fd */
pipe_get_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
pipe_get_info, /* get_file_info */ pipe_get_info, /* get_file_info */
pipe_destroy /* destroy */ pipe_destroy /* destroy */
...@@ -114,7 +112,7 @@ static int pipe_get_poll_events( struct object *obj ) ...@@ -114,7 +112,7 @@ static int pipe_get_poll_events( struct object *obj )
return (pipe->side == READ_SIDE) ? POLLIN : POLLOUT; 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; struct pipe *pipe = (struct pipe *)obj;
assert( obj->ops == &pipe_ops ); assert( obj->ops == &pipe_ops );
...@@ -124,29 +122,6 @@ static int pipe_get_read_fd( struct object *obj ) ...@@ -124,29 +122,6 @@ static int pipe_get_read_fd( struct object *obj )
set_error( STATUS_PIPE_BROKEN ); set_error( STATUS_PIPE_BROKEN );
return -1; 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 ); return dup( pipe->obj.fd );
} }
......
...@@ -48,8 +48,7 @@ static const struct object_ops process_ops = ...@@ -48,8 +48,7 @@ static const struct object_ops process_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
process_destroy /* destroy */ process_destroy /* destroy */
...@@ -87,8 +86,7 @@ static const struct object_ops startup_info_ops = ...@@ -87,8 +86,7 @@ static const struct object_ops startup_info_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
startup_info_destroy /* destroy */ startup_info_destroy /* destroy */
...@@ -716,7 +714,6 @@ DECL_HANDLER(new_process) ...@@ -716,7 +714,6 @@ DECL_HANDLER(new_process)
{ {
size_t len = get_req_data_size( req ); size_t len = get_req_data_size( req );
struct startup_info *info; struct startup_info *info;
int sock[2];
if (current->info) if (current->info)
{ {
...@@ -752,24 +749,6 @@ DECL_HANDLER(new_process) ...@@ -752,24 +749,6 @@ DECL_HANDLER(new_process)
} }
memcpy( info->filename, get_req_data(req), len ); memcpy( info->filename, get_req_data(req), len );
info->filename[len] = 0; 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; current->info = info;
} }
......
...@@ -36,8 +36,7 @@ static const struct object_ops msg_queue_ops = ...@@ -36,8 +36,7 @@ static const struct object_ops msg_queue_ops =
msg_queue_satisfied, /* satisfied */ msg_queue_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
no_destroy /* destroy */ no_destroy /* destroy */
......
...@@ -137,8 +137,7 @@ static const struct object_ops key_ops = ...@@ -137,8 +137,7 @@ static const struct object_ops key_ops =
NULL, /* satisfied */ NULL, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
key_destroy /* destroy */ key_destroy /* destroy */
...@@ -1341,7 +1340,7 @@ static void load_registry( struct key *key, int handle ) ...@@ -1341,7 +1340,7 @@ static void load_registry( struct key *key, int handle )
int fd; int fd;
if (!(obj = get_handle_obj( current->process, handle, GENERIC_READ, NULL ))) return; 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 ); release_object( obj );
if (fd != -1) if (fd != -1)
{ {
...@@ -1436,7 +1435,7 @@ static void save_registry( struct key *key, int handle ) ...@@ -1436,7 +1435,7 @@ static void save_registry( struct key *key, int handle )
return; return;
} }
if (!(obj = get_handle_obj( current->process, handle, GENERIC_WRITE, NULL ))) 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 ); release_object( obj );
if (fd != -1) if (fd != -1)
{ {
......
...@@ -64,8 +64,7 @@ static const struct object_ops master_socket_ops = ...@@ -64,8 +64,7 @@ static const struct object_ops master_socket_ops =
NULL, /* satisfied */ NULL, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
master_socket_poll_event, /* poll_event */ master_socket_poll_event, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
master_socket_destroy /* destroy */ master_socket_destroy /* destroy */
......
...@@ -106,8 +106,7 @@ DECL_HANDLER(release_semaphore); ...@@ -106,8 +106,7 @@ DECL_HANDLER(release_semaphore);
DECL_HANDLER(open_semaphore); DECL_HANDLER(open_semaphore);
DECL_HANDLER(create_file); DECL_HANDLER(create_file);
DECL_HANDLER(alloc_file_handle); DECL_HANDLER(alloc_file_handle);
DECL_HANDLER(get_read_fd); DECL_HANDLER(get_handle_fd);
DECL_HANDLER(get_write_fd);
DECL_HANDLER(set_file_pointer); DECL_HANDLER(set_file_pointer);
DECL_HANDLER(truncate_file); DECL_HANDLER(truncate_file);
DECL_HANDLER(set_file_time); DECL_HANDLER(set_file_time);
...@@ -222,8 +221,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] = ...@@ -222,8 +221,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_open_semaphore, (req_handler)req_open_semaphore,
(req_handler)req_create_file, (req_handler)req_create_file,
(req_handler)req_alloc_file_handle, (req_handler)req_alloc_file_handle,
(req_handler)req_get_read_fd, (req_handler)req_get_handle_fd,
(req_handler)req_get_write_fd,
(req_handler)req_set_file_pointer, (req_handler)req_set_file_pointer,
(req_handler)req_truncate_file, (req_handler)req_truncate_file,
(req_handler)req_set_file_time, (req_handler)req_set_file_time,
......
...@@ -35,8 +35,7 @@ static const struct object_ops semaphore_ops = ...@@ -35,8 +35,7 @@ static const struct object_ops semaphore_ops =
semaphore_satisfied, /* satisfied */ semaphore_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
no_destroy /* destroy */ no_destroy /* destroy */
......
...@@ -37,8 +37,7 @@ ...@@ -37,8 +37,7 @@
#include "request.h" #include "request.h"
static void serial_dump( struct object *obj, int verbose ); static void serial_dump( struct object *obj, int verbose );
static int serial_get_read_fd( struct object *obj ); static int serial_get_fd( struct object *obj );
static int serial_get_write_fd( struct object *obj );
static int serial_get_info( struct object *obj, struct get_file_info_request *req ); static int serial_get_info( struct object *obj, struct get_file_info_request *req );
static int serial_get_poll_events( struct object *obj ); static int serial_get_poll_events( struct object *obj );
...@@ -72,8 +71,7 @@ static const struct object_ops serial_ops = ...@@ -72,8 +71,7 @@ static const struct object_ops serial_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
serial_get_poll_events, /* get_poll_events */ serial_get_poll_events, /* get_poll_events */
default_poll_event, /* poll_event */ default_poll_event, /* poll_event */
serial_get_read_fd, /* get_read_fd */ serial_get_fd, /* get_fd */
serial_get_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
serial_get_info, /* get_file_info */ serial_get_info, /* get_file_info */
no_destroy /* destroy */ no_destroy /* destroy */
...@@ -152,14 +150,7 @@ static int serial_get_poll_events( struct object *obj ) ...@@ -152,14 +150,7 @@ static int serial_get_poll_events( struct object *obj )
return events; return events;
} }
static int serial_get_read_fd( struct object *obj ) static int serial_get_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 )
{ {
struct serial *serial = (struct serial *)obj; struct serial *serial = (struct serial *)obj;
assert( obj->ops == &serial_ops ); assert( obj->ops == &serial_ops );
......
...@@ -47,8 +47,7 @@ static const struct object_ops snapshot_ops = ...@@ -47,8 +47,7 @@ static const struct object_ops snapshot_ops =
NULL, /* satisfied */ NULL, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
snapshot_destroy /* destroy */ snapshot_destroy /* destroy */
......
...@@ -69,8 +69,7 @@ static const struct object_ops sock_ops = ...@@ -69,8 +69,7 @@ static const struct object_ops sock_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
sock_get_poll_events, /* get_poll_events */ sock_get_poll_events, /* get_poll_events */
sock_poll_event, /* poll_event */ sock_poll_event, /* poll_event */
sock_get_fd, /* get_read_fd */ sock_get_fd, /* get_fd */
sock_get_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
sock_destroy /* destroy */ sock_destroy /* destroy */
......
...@@ -76,8 +76,7 @@ static const struct object_ops thread_ops = ...@@ -76,8 +76,7 @@ static const struct object_ops thread_ops =
no_satisfied, /* satisfied */ no_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
thread_poll_event, /* poll_event */ thread_poll_event, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
destroy_thread /* destroy */ destroy_thread /* destroy */
......
...@@ -42,8 +42,7 @@ static const struct object_ops timer_ops = ...@@ -42,8 +42,7 @@ static const struct object_ops timer_ops =
timer_satisfied, /* satisfied */ timer_satisfied, /* satisfied */
NULL, /* get_poll_events */ NULL, /* get_poll_events */
NULL, /* poll_event */ NULL, /* poll_event */
no_read_fd, /* get_read_fd */ no_get_fd, /* get_fd */
no_write_fd, /* get_write_fd */
no_flush, /* flush */ no_flush, /* flush */
no_get_file_info, /* get_file_info */ no_get_file_info, /* get_file_info */
timer_destroy /* destroy */ timer_destroy /* destroy */
......
...@@ -256,7 +256,6 @@ static void dump_new_process_request( const struct new_process_request *req ) ...@@ -256,7 +256,6 @@ static void dump_new_process_request( const struct new_process_request *req )
fprintf( stderr, " hstdout=%d,", req->hstdout ); fprintf( stderr, " hstdout=%d,", req->hstdout );
fprintf( stderr, " hstderr=%d,", req->hstderr ); fprintf( stderr, " hstderr=%d,", req->hstderr );
fprintf( stderr, " cmd_show=%d,", req->cmd_show ); fprintf( stderr, " cmd_show=%d,", req->cmd_show );
fprintf( stderr, " alloc_fd=%d,", req->alloc_fd );
fprintf( stderr, " filename=" ); fprintf( stderr, " filename=" );
cur_pos += dump_varargs_string( req ); cur_pos += dump_varargs_string( req );
} }
...@@ -657,14 +656,15 @@ static void dump_alloc_file_handle_reply( const struct alloc_file_handle_request ...@@ -657,14 +656,15 @@ static void dump_alloc_file_handle_reply( const struct alloc_file_handle_request
fprintf( stderr, " handle=%d", req->handle ); 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 ) 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] = { ...@@ -1487,8 +1487,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_open_semaphore_request, (dump_func)dump_open_semaphore_request,
(dump_func)dump_create_file_request, (dump_func)dump_create_file_request,
(dump_func)dump_alloc_file_handle_request, (dump_func)dump_alloc_file_handle_request,
(dump_func)dump_get_read_fd_request, (dump_func)dump_get_handle_fd_request,
(dump_func)dump_get_write_fd_request,
(dump_func)dump_set_file_pointer_request, (dump_func)dump_set_file_pointer_request,
(dump_func)dump_truncate_file_request, (dump_func)dump_truncate_file_request,
(dump_func)dump_set_file_time_request, (dump_func)dump_set_file_time_request,
...@@ -1600,8 +1599,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = { ...@@ -1600,8 +1599,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_open_semaphore_reply, (dump_func)dump_open_semaphore_reply,
(dump_func)dump_create_file_reply, (dump_func)dump_create_file_reply,
(dump_func)dump_alloc_file_handle_reply, (dump_func)dump_alloc_file_handle_reply,
(dump_func)0, (dump_func)dump_get_handle_fd_reply,
(dump_func)0,
(dump_func)dump_set_file_pointer_reply, (dump_func)dump_set_file_pointer_reply,
(dump_func)0, (dump_func)0,
(dump_func)0, (dump_func)0,
...@@ -1713,8 +1711,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = { ...@@ -1713,8 +1711,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"open_semaphore", "open_semaphore",
"create_file", "create_file",
"alloc_file_handle", "alloc_file_handle",
"get_read_fd", "get_handle_fd",
"get_write_fd",
"set_file_pointer", "set_file_pointer",
"truncate_file", "truncate_file",
"set_file_time", "set_file_time",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment