Hi,
The following patch is used by my next named pipe patch.
Mike
ChangeLog: * allow NtFileFlushBuffers to block, as flushing a named pipe requires this
Index: server/fd.c =================================================================== RCS file: /home/wine/wine/server/fd.c,v retrieving revision 1.9 diff -u -r1.9 fd.c --- server/fd.c 17 Apr 2003 02:14:04 -0000 1.9 +++ server/fd.c 8 May 2003 08:45:30 -0000 @@ -958,7 +958,7 @@ } /* default flush() routine */ -int no_flush( struct fd *fd ) +int no_flush( struct fd *fd, struct event *event ) { set_error( STATUS_OBJECT_TYPE_MISMATCH ); return 0; @@ -997,10 +997,16 @@ DECL_HANDLER(flush_file) { struct fd *fd = get_handle_fd_obj( current->process, req->handle, 0 ); + struct event * event; if (fd) { - fd->fd_ops->flush( fd ); + event = get_event_obj( current->process, req->event, 0); + if( event ) + { + fd->fd_ops->flush( fd, event ); + release_object( event ); + } release_object( fd ); } } Index: server/file.c =================================================================== RCS file: /home/wine/wine/server/file.c,v retrieving revision 1.67 diff -u -r1.67 file.c --- server/file.c 26 Mar 2003 23:41:43 -0000 1.67 +++ server/file.c 8 May 2003 08:45:30 -0000 @@ -72,7 +72,7 @@ static int file_get_poll_events( struct fd *fd ); static void file_poll_event( struct fd *fd, int event ); -static int file_flush( struct fd *fd ); +static int file_flush( struct fd *fd, struct event *event ); static int file_get_info( struct fd *fd, struct get_file_info_reply *reply, int *flags ); static void file_queue_async( struct fd *fd, void *ptr, unsigned int status, int type, int count ); @@ -301,7 +301,7 @@ } -static int file_flush( struct fd *fd ) +static int file_flush( struct fd *fd, struct event *event ) { int ret = (fsync( get_unix_fd(fd) ) != -1); if (!ret) file_set_error(); Index: server/file.h =================================================================== RCS file: /home/wine/wine/server/file.h,v retrieving revision 1.7 diff -u -r1.7 file.h --- server/file.h 26 Mar 2003 23:41:43 -0000 1.7 +++ server/file.h 8 May 2003 08:45:30 -0000 @@ -35,7 +35,7 @@ /* a poll() event occured */ void (*poll_event)(struct fd *,int event); /* flush the object buffers */ - int (*flush)(struct fd *); + int (*flush)(struct fd *, struct event *); /* get file information */ int (*get_file_info)(struct fd *,struct get_file_info_reply *, int *flags); /* queue an async operation - see register_async handler in async.c*/ @@ -60,7 +60,7 @@ extern void default_fd_remove_queue( struct object *obj, struct wait_queue_entry *entry ); extern int default_fd_signaled( struct object *obj, struct thread *thread ); extern void default_poll_event( struct fd *fd, int event ); -extern int no_flush( struct fd *fd ); +extern int no_flush( struct fd *fd, struct event *event ); extern int no_get_file_info( struct fd *fd, struct get_file_info_reply *info, int *flags ); extern void no_queue_async( struct fd *fd, void* ptr, unsigned int status, int type, int count ); extern void main_loop(void); Index: server/protocol.def =================================================================== RCS file: /home/wine/wine/server/protocol.def,v retrieving revision 1.65 diff -u -r1.65 protocol.def --- server/protocol.def 4 Apr 2003 22:26:34 -0000 1.65 +++ server/protocol.def 8 May 2003 08:45:32 -0000 @@ -665,6 +665,7 @@ /* Flush a file buffers */ @REQ(flush_file) obj_handle_t handle; /* handle to the file */ + obj_handle_t event; /* event to set when finished */ @END Index: dlls/ntdll/file.c =================================================================== RCS file: /home/wine/wine/dlls/ntdll/file.c,v retrieving revision 1.21 diff -u -r1.21 file.c --- dlls/ntdll/file.c 22 Apr 2003 04:04:17 -0000 1.21 +++ dlls/ntdll/file.c 8 May 2003 08:45:32 -0000 @@ -498,11 +498,21 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK* IoStatusBlock ) { NTSTATUS ret; + HANDLE hEvent = NULL; + + ret = NtCreateEvent( &hEvent, GENERIC_READ | SYNCHRONIZE, NULL, 0, 0 ); + if( ret ) + return ret; + SERVER_START_REQ( flush_file ) { req->handle = hFile; + req->event = hEvent; ret = wine_server_call( req ); } SERVER_END_REQ; + if( ret == STATUS_PENDING ) + ret = NtWaitForSingleObject( hEvent, FALSE, NULL ); + NtClose( hEvent ); return ret; }