On 12/19/2017 09:46 AM, Ivan Kozik wrote:
Thanks, I can confirm that the 2017-12-18 snapshot fixed the test
program I posted.

What about the harder case where the program calls fflush, though?

#include <stdio.h>

int main(int argc, char *argv[]) {
     FILE *f = fopen(argv[1], "w");
     char x[65536 + 1];
     fwrite(x, 1, 65536 + 1, f);
     fflush(f);
     printf("%ld", ftell(f));

Can block devices report an unaligned offset to lseek()? If not, then when writing an unaligned value to a block device, don't we have to do a read-modify-write of the larger aligned cluster, and then put lseek() back to the unaligned boundary, and have extra magic in ftell() to track that we are at an unaligned position within the block device? But that sounds like a lot of nasty overhead; and that it would be better to make sure that block devices can report unaligned lseek() locations (caveat: I haven't tested what Linux does in that regards).

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to