Received: from eggs.gnu.org ([2001:4830:134:3::10]:41962) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y5gv9-0003Ca-JR for qemu-devel@nongnu.org; Mon, 29 Dec 2014 15:28:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y5gv8-0001TM-Ft for qemu-devel@nongnu.org; Mon, 29 Dec 2014 15:28:07 -0500 From: Don Slutz Message-ID: <54A1B945.20509@terremark.com> Date: Mon, 29 Dec 2014 15:27:49 -0500 MIME-Version: 1.0 References: <1419260640-2922-1-git-send-email-dslutz@verizon.com> <54A125E6.4050807@msgid.tls.msk.ru> In-Reply-To: <54A125E6.4050807@msgid.tls.msk.ru> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [Qemu-trivial] [PATCH 1/1] Do not hang on full PTY List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev , Don Slutz , qemu-devel@nongnu.org, QEMU Trivial Cc: Paolo Bonzini , Anthony Liguori On 12/29/14 04:59, Michael Tokarev wrote: > 22.12.2014 18:04, Don Slutz wrote: > >> --- a/qemu-char.c >> +++ b/qemu-char.c >> @@ -1387,6 +1387,7 @@ static CharDriverState *qemu_chr_open_pty(const char *id, >> } >> >> close(slave_fd); >> + qemu_set_nonblock(master_fd); >> >> chr = qemu_chr_alloc(); > > > Hm. I'm not sure at all this is a trivial change. While the > patch itself is trivial indeed, it changes behavour of the file > descriptor significantly. Are all the places where this fd is > subsequently used prepared for it being non-blocking? Oh well... ;) I was not sure on this being trivial also, but it looked like it could be to me. The uses of this FD all looked that they handle non-blocking. Here are the calls to qemu_set_nonblock in qemu-char.c (including this add) : b qemu-char.c qemu_chr_open_fd 1070 qemu_set_nonblock(fd_out); c qemu-char.c qemu_chr_open_stdio 1166 qemu_set_nonblock(0); d qemu-char.c qemu_chr_open_pty 1390 qemu_set_nonblock(master_fd); e qemu-char.c tcp_chr_add_client 2952 qemu_set_nonblock(fd); f qemu-char.c qmp_chardev_open_serial 4060 qemu_set_nonblock(fd); g qemu-char.c qmp_chardev_open_socket 4172 qemu_set_nonblock(s->listen_fd); So there are many cases where the FD is non-blocking already. Hope this info helps. > > Thanks, > > /mjt >