[PATCH] Initialize IO_STATUS_BLOCK for pread, pwrite

Mark Geisert mark@maxrnd.com
Tue Nov 28 08:03:00 GMT 2017


Mark Geisert wrote:
> ---
>  winsup/cygwin/fhandler_disk_file.cc | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc
> index 5dfcae4d9..2ead9948c 100644
[...]

Oops, I neglected to include an explanatory comment. Issuing simultaneous 
pwrite(s) on one file descriptor from multiple threads, as one might do in a 
forthcoming POSIX aio implementation, sometimes results in garbage status in the 
IO_STATUS_BLOCK on return from NtWriteFile(). Zeroing beforehand made the issue 
go away.

This is mildly concerning to me because there are many other uses of 
IO_STATUS_BLOCK in the Cygwin DLL that haven't seemed to have needed initialization.

Puzzledly,

..mark



More information about the Cygwin-patches mailing list