Re: [PATCH v4 15/23] utils: Write a maximum of MAX_PIPE_WRITE_BYTES into a pipe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 11, 2019 at 03:41:43PM -0400, Stefan Berger wrote:
> To avoid blocking on a write on a pipe that the receiving process
> does not read from, write only MAX_PIPE_WRITE_BYTES into the pipe
> so that we can serve other pipes as well.

This doesn't work. The pipe can have 1025 bytes free space, so you'll
write 1024 bytes first fine, and next iteration there'll be one byte
free space and you'll block. If you need to avoid blocking you must
use O_NONBLOCK on the fd. Don't try to guess how much you can write,
just write until you get EAGAIN.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux