Module: wine Branch: master Commit: f21961cc1427faad65abf36df217a8c888cae7fa URL: http://source.winehq.org/git/wine.git/?a=commit;h=f21961cc1427faad65abf36df2...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Sep 5 00:10:19 2013 +0200
ntdll: Add a configure check for the tcdrain function.
Also remove the tcgetattr check that is no longer used.
---
configure | 2 +- configure.ac | 2 +- dlls/ntdll/file.c | 9 +-------- dlls/ntdll/ntdll_misc.h | 1 + dlls/ntdll/serial.c | 26 ++++++++++++++++++++++++++ include/config.h.in | 4 ++-- 6 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/configure b/configure index 56c983f..6b2c2c8 100755 --- a/configure +++ b/configure @@ -13436,7 +13436,7 @@ for ac_func in \ strtoll \ strtoull \ symlink \ - tcgetattr \ + tcdrain \ thr_kill2 \ timegm \ usleep \ diff --git a/configure.ac b/configure.ac index 3a0007c..7c1cb1c 100644 --- a/configure.ac +++ b/configure.ac @@ -2063,7 +2063,7 @@ AC_CHECK_FUNCS(\ strtoll \ strtoull \ symlink \ - tcgetattr \ + tcdrain \ thr_kill2 \ timegm \ usleep \ diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 83e286e..9420df5 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -2777,14 +2777,7 @@ NTSTATUS WINAPI NtFlushBuffersFile( HANDLE hFile, IO_STATUS_BLOCK* IoStatusBlock
if (!ret && type == FD_TYPE_SERIAL) { - while (tcdrain( fd ) == -1) - { - if (errno != EINTR) - { - ret = FILE_GetNtStatus(); - break; - } - } + ret = COMM_FlushBuffersFile( fd ); } else { diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 3d9264d..a13c55b 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -142,6 +142,7 @@ extern NTSTATUS TAPE_DeviceIoControl(HANDLE hDevice, ULONG IoControlCode, LPVOID lpInBuffer, DWORD nInBufferSize, LPVOID lpOutBuffer, DWORD nOutBufferSize) DECLSPEC_HIDDEN; +extern NTSTATUS COMM_FlushBuffersFile( int fd ) DECLSPEC_HIDDEN;
/* file I/O */ struct stat; diff --git a/dlls/ntdll/serial.c b/dlls/ntdll/serial.c index b4f9aa9..07ba633 100644 --- a/dlls/ntdll/serial.c +++ b/dlls/ntdll/serial.c @@ -1342,3 +1342,29 @@ NTSTATUS COMM_DeviceIoControl(HANDLE hDevice, lpOutBuffer, nOutBufferSize); return status; } + +NTSTATUS COMM_FlushBuffersFile( int fd ) +{ +#ifdef HAVE_TCDRAIN + while (tcdrain( fd ) == -1) + { + if (errno != EINTR) return FILE_GetNtStatus(); + } + return STATUS_SUCCESS; +#elif defined(TIOCDRAIN) + while (ioctl( fd, TIOCDRAIN ) == -1) + { + if (errno != EINTR) return FILE_GetNtStatus(); + } + return STATUS_SUCCESS; +#elif defined(TCSBRK) + while (ioctl( fd, TCSBRK, 1 ) == -1) + { + if (errno != EINTR) return FILE_GetNtStatus(); + } + return STATUS_SUCCESS; +#else + ERR( "not supported\n" ); + return STATUS_NOT_IMPLEMENTED; +#endif +} diff --git a/include/config.h.in b/include/config.h.in index aac10a5..44b34ce 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -1068,8 +1068,8 @@ /* Define to 1 if you have the <sys/wait.h> header file. */ #undef HAVE_SYS_WAIT_H
-/* Define to 1 if you have the `tcgetattr' function. */ -#undef HAVE_TCGETATTR +/* Define to 1 if you have the `tcdrain' function. */ +#undef HAVE_TCDRAIN
/* Define to 1 if you have the <termios.h> header file. */ #undef HAVE_TERMIOS_H