On Wed, Jan 29, 2025 at 08:33:47AM +0100, Stefano Brivio wrote: > On Wed, 29 Jan 2025 12:03:30 +1100 > David Gibson wrote: > > > On Tue, Jan 28, 2025 at 07:48:49AM +0100, Stefano Brivio wrote: > > > On Tue, 28 Jan 2025 11:59:28 +1100 > > > David Gibson wrote: > > > > > > > On Tue, Jan 28, 2025 at 12:15:30AM +0100, Stefano Brivio wrote: > > > > > These are symmetric to write_remainder() and write_all_buf() and > > > > > almost a copy and paste of them, with the most notable differences > > > > > being reversed reads/writes and a couple of better-safe-than-sorry > > > > > asserts to keep Coverity happy. > > > > > > > > So, there's one thing that needs to be not quite symmetric for the > > > > read() version: we need to handle EOF. At present, I believe these > > > > will enter an infinite loop on EOF, which is not a graceful failure > > > > mode. > > > > > > It doesn't happen in our current usage where we close the socket once > > > we're done, > > > > I don't see how what we do with the socket is relevant. Couldn't we > > hit this case if qemu unexpectedly closed the socket or died? > > Yes, sure. I just mentioned that it's not the intended usage, and > rather an error case we need to handle. Oh, sure, no argument there. -- David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson