From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsU9k-00025E-Ig for qemu-devel@nongnu.org; Fri, 07 Oct 2016 08:21:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsU9g-0004WX-EA for qemu-devel@nongnu.org; Fri, 07 Oct 2016 08:21:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49850) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsU9g-0004WO-7o for qemu-devel@nongnu.org; Fri, 07 Oct 2016 08:21:36 -0400 Date: Fri, 7 Oct 2016 13:21:32 +0100 From: Stefan Hajnoczi Message-ID: <20161007122132.GA5834@stefanha-x1.localdomain> References: <1475772018-27484-1-git-send-email-stefanha@redhat.com> <1475772018-27484-4-git-send-email-stefanha@redhat.com> <96805a9d-3211-51fa-b0f3-677fb3905696@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="LZvS9be/3tNcYl/X" Content-Disposition: inline In-Reply-To: <96805a9d-3211-51fa-b0f3-677fb3905696@redhat.com> Subject: Re: [Qemu-devel] [PATCH 3/4] sockets: add AF_VSOCK support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Michael Roth --LZvS9be/3tNcYl/X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Oct 06, 2016 at 01:14:08PM -0500, Eric Blake wrote: > On 10/06/2016 11:40 AM, Stefan Hajnoczi wrote: > > +static int vsock_connect_addr(const struct sockaddr_vm *svm, bool *in_= progress, > > + ConnectState *connect_state, Error **err= p) > > +{ > > + int sock, rc; > > + > > + *in_progress =3D false; > > + > > + sock =3D qemu_socket(AF_VSOCK, SOCK_STREAM, 0); > > + if (sock < 0) { > > + error_setg_errno(errp, errno, "Failed to create socket"); > > + return -1; > > + } > > + if (connect_state !=3D NULL) { > > + qemu_set_nonblock(sock); >=20 > Isn't the presence of vsock support sufficient to prove that we have > SOCK_NONBLOCK support as part of our socket() call? In which case, > wouldn't it be better to pass that option up front to atomically get a > non-blocking socket, rather than having to change its state after the fac= t? I'm sending a separate patch series to introduce a QemuSockFlags argument for qemu_socket() and qemu_accept(). It will convert existing qemu_set_nonblock() callers too. > > +static VsockSocketAddress *vsock_parse(const char *str, Error **errp) > > +{ > > + VsockSocketAddress *addr =3D NULL; > > + char cid[33]; > > + char port[33]; > > + > > + if (sscanf(str, "%32[^:]:%32[^,]", cid, port) !=3D 2) { >=20 > Would it be a wise idea to also use %n to ensure that you aren't > ignoring trailing garbage? Okay, will fix in the next version. --LZvS9be/3tNcYl/X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJX95NMAAoJEJykq7OBq3PIfrsIAKctJK7fMRthQtvx5qkM4XiD tOe1se4jpxnuNXh7DlRtv03/XRO3DSAVj1e2WzgZO3e/H11mkMX0jVQF0OdggNNC Ee1A/55+iNksh7VR42+QeiF8l8EPLQRMywBncCInEKneDr5FC4WPnZS02BbQFw9T TTO19cwWcHN4rgJSGhFK8ChQFuLRd9Vtae+CFRQFdHOGrQbmybVgj1a0vMo/Qwqj TmsjjqUO2SJLUCqXIL+qrWUdsJZjsp6F1kCxVCF79dULiIVIotJyPavsviz4xsc+ aUO37pdfcJcS9YL/SG2+WzxgURciBICxwrnLsXDp3So5zj+nmcYaIJmbNDzTOo4= =zMxX -----END PGP SIGNATURE----- --LZvS9be/3tNcYl/X--