From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrAFW-0008SX-CR for qemu-devel@nongnu.org; Tue, 27 Oct 2015 15:49:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZrAFR-0007uU-Cf for qemu-devel@nongnu.org; Tue, 27 Oct 2015 15:49:38 -0400 Received: from e19.ny.us.ibm.com ([129.33.205.209]:45490) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZrAFR-0007u5-9X for qemu-devel@nongnu.org; Tue, 27 Oct 2015 15:49:33 -0400 Received: from localhost by e19.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 27 Oct 2015 15:49:31 -0400 Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by d01dlp03.pok.ibm.com (Postfix) with ESMTP id A10F4C9003C for ; Tue, 27 Oct 2015 15:37:41 -0400 (EDT) Received: from d01av02.pok.ibm.com (d01av02.pok.ibm.com [9.56.224.216]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t9RJnUR859637918 for ; Tue, 27 Oct 2015 19:49:30 GMT Received: from d01av02.pok.ibm.com (localhost [127.0.0.1]) by d01av02.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t9RJnUIS016349 for ; Tue, 27 Oct 2015 15:49:30 -0400 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <562FCCF5.7090807@openvz.org> References: <1445968123-1773-1-git-send-email-den@openvz.org> <1445968123-1773-4-git-send-email-den@openvz.org> <20151027191112.4255.20231@loki> <562FCCF5.7090807@openvz.org> Message-ID: <20151027194928.4255.73297@loki> Date: Tue, 27 Oct 2015 14:49:28 -0500 Subject: Re: [Qemu-devel] [PATCH 3/3] qga: set file descriptor in qmp_guest_file_open non-blocking on Win32 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Olga Krishtal , qemu-devel@nongnu.org, Stefan Weil Quoting Denis V. Lunev (2015-10-27 14:13:57) > On 10/27/2015 10:11 PM, Michael Roth wrote: > > Quoting Denis V. Lunev (2015-10-27 12:48:43) > >> From: Olga Krishtal > >> > >> Set fd non-blocking to avoid common use cases (like reading from a > >> named pipe) from hanging the agent. This was missed in the original > >> code. > >> > >> The patch introduces analog of qemu_set_non/block for HANDLES. > >> The usage of handles in qemu_set_non/block is impossible, because for > >> win32 there is a difference between file discriptors and file handles, > >> and all file ops are made via Win32 api. > > If this is specific to HANDLEs, why do we need to cast back and forth > > between int64_t and HANDLE? I haven't build tested, but it seems like > > this would break for 32-bit mingw builds. > > > > I would define these as qemu_set_*_by_handle(HANDLE fh, ...) instead > > and make them win32 only. If someone wants to introduce a FILE* > > variant for posix they can introduce it as > > qemu_set_*_by_handle(FILE *fh, ...) rather than us needing to > > abstract away the handle type. > = > may be it would be better to add static function for this in QGA for now? I'd be fine with either approach. It could be generally useful for other w32 users. But if we're thinking about dropping the QGA use case soon then maybe having it live in QGA is best. > = > I am eager to drop this code at once for Posix and Windows and > switch to GLIB like was done for guest exec. You mean switching all the guest-file-* interfaces to glib? I took a stab at it once for w32 guest-file-* implementation, but one issue I hit was that I couldn't figure out how to implement guest-file-seek to report back the absolute position in the file, or whether or not we'd hit EOF. You can set position via g_io_channel_seek_position(), but if they hit EOF, or are using relative offsets via G_SEEK_CUR, you don't really know the position and glib doesn't seem to provide a way to query that. We could maybe work around it by tracking it manually via guest-file-* calls but that sounds terrible. Hopefully I just missed something though. Also couldn't figure out how you can get glib to report that you'd already seeked to EOF. I had some comments about it in my WIP: https://github.com/mdroth/qemu/commit/8b2e5c69266bb48e492af9826122c2aaa4a82= 197#diff-7f29c3e51a7b387cc7717e7be4f6e205R525 > = > Den >=20