On Monday 22 December 2008, Alexandre Julliard wrote:
Wolfgang Walter w...@stwm.de writes:
@@ -201,7 +202,17 @@ static void serial_flush( struct fd *fd, struct event
**event )
/* MSDN says: If hFile is a handle to a communications device,
* the function only flushes the transmit buffer.
*/
-if (tcflush( get_unix_fd(fd), TCOFLUSH ) == -1) file_set_error();
+/* FlushFileBuffers does NOT have the semantics of tcflush.
+ * Whereas tcflush discards any data not yet transmitted
+ * FlushFileBuffers ensures they are written out.
+ * The POSIX equivalent is tcdrain
+ */
+while (tcdrain( get_unix_fd(fd)) == -1) {
+ if (errno != EINTR) {
+file_set_error();
+return;
+}
This will block, you can't do that in the server.
--
Alexandre Julliard
julli...@winehq.org
Would it be acceptable to call tcdrain directly in NtFlushBuffersFile:
=
NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK*
IoStatusBlock )
{
NTSTATUS ret;
HANDLE hEvent = NULL;
enum server_fd_type type;
NTSTATUS status;
unsigned int options;
int needs_close;
int unix_handle;
status = server_get_unix_fd( hFile, FILE_WRITE_DATA, unix_handle,
needs_close, type, options );
if (type == FD_TYPE_SERIAL) {
while (tcdrain(unix_handle) == -1) {
if (errno != EINTR) {
return FILE_GetNtStatus();
}
}
return STATUS_SUCCESS;
}
SERVER_START_REQ( flush_file )
{
req-handle = wine_server_obj_handle( hFile );
ret = wine_server_call( req );
hEvent = wine_server_ptr_handle( reply-event );
}
SERVER_END_REQ;
if (!ret hEvent)
{
ret = NtWaitForSingleObject( hEvent, FALSE, NULL );
NtClose( hEvent );
}
return ret;
}
=
Regards,
--
Wolfgang Walter
Studentenwerk München
Anstalt des öffentlichen Rechts
Leiter EDV
Leopoldstraße 15
80802 München