From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51824) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHfAl-0003EU-A1 for qemu-devel@nongnu.org; Mon, 27 Jun 2016 18:38:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bHfAf-0006Je-BF for qemu-devel@nongnu.org; Mon, 27 Jun 2016 18:38:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60476) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bHfAf-0006Ic-2W for qemu-devel@nongnu.org; Mon, 27 Jun 2016 18:38:25 -0400 References: <1467065523-13881-1-git-send-email-thuth@redhat.com> From: Eric Blake Message-ID: <5771AADF.1070403@redhat.com> Date: Mon, 27 Jun 2016 16:38:23 -0600 MIME-Version: 1.0 In-Reply-To: <1467065523-13881-1-git-send-email-thuth@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tNRQdnnrV4xhQugBtkkuRKDKpX9RkQlnC" Subject: Re: [Qemu-devel] [PATCH] virtio: Tell the user what went wrong when event_notifier_init failed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Thomas Huth , "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Cornelia Huck , armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --tNRQdnnrV4xhQugBtkkuRKDKpX9RkQlnC From: Eric Blake To: Thomas Huth , "Michael S. Tsirkin" , qemu-devel@nongnu.org Cc: Cornelia Huck , armbru@redhat.com Message-ID: <5771AADF.1070403@redhat.com> Subject: Re: [Qemu-devel] [PATCH] virtio: Tell the user what went wrong when event_notifier_init failed References: <1467065523-13881-1-git-send-email-thuth@redhat.com> In-Reply-To: <1467065523-13881-1-git-send-email-thuth@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/27/2016 04:12 PM, Thomas Huth wrote: > event_notifier_init() can fail in real life, for example when there > are not enough open file handles available (EMFILE) when using a lot > of devices. So instead of leaving the average user with a cryptic > error number only, print out a proper error message with strerror() > instead, so that the user has a better way to figure out what is > going on and that using "ulimit -n" might help here for example. >=20 > Signed-off-by: Thomas Huth > --- > hw/virtio/virtio-bus.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/hw/virtio/virtio-bus.c b/hw/virtio/virtio-bus.c > index 1313760..08e38fb 100644 > --- a/hw/virtio/virtio-bus.c > +++ b/hw/virtio/virtio-bus.c > @@ -164,7 +164,8 @@ static int set_host_notifier_internal(DeviceState *= proxy, VirtioBusState *bus, > if (assign) { > r =3D event_notifier_init(notifier, 1); > if (r < 0) { > - error_report("%s: unable to init event notifier: %d", __fu= nc__, r); > + error_report("%s: unable to init event notifier: %s (%d)",= > + __func__, strerror(-r), r); Yet another case where we have error_report(...strerror()), which argues that someday we should add error_report_errno() to match error_setg_errno(). But not your fault. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --tNRQdnnrV4xhQugBtkkuRKDKpX9RkQlnC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXcarfAAoJEKeha0olJ0NqEMMH/iynuILBs4bbhFLvcoV3+pqz mu1Pj2X5/CtPIkCHTscwPdgt4Co54WDxgyuQ9AiwcrFWTPA6xZNcLPAHyKtZlP5x gsoKLOCzofV9HJ5Cg/hfnx5QMxK3TS7FUoAJXaltLJxYyzCfkytup/11XG9YI8Sm zL8iG3NISGyqkK0Sw2ZsUFaBsDaLoYhLR3wQkkr6o7dPVMFm7M9v6NADtUGt4x3v NBMIwSzdW+wN4hMaVZnCj6uEuZ6UN/VmkZ/I8ZLbRR/LPKbZwpwFbCzSmdt+QUUP QqNEnm+JeJxG6OwsmWscKw10dKy8/eIa+9jq+h/+pkoiLsalfF3LtrQT7clsc0c= =tRg6 -----END PGP SIGNATURE----- --tNRQdnnrV4xhQugBtkkuRKDKpX9RkQlnC--