From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37935) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSifl-0004ia-GT for qemu-devel@nongnu.org; Thu, 28 Jul 2016 06:36:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bSiff-0006s1-0R for qemu-devel@nongnu.org; Thu, 28 Jul 2016 06:36:12 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60697) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bSife-0006rw-On for qemu-devel@nongnu.org; Thu, 28 Jul 2016 06:36:06 -0400 Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.11/8.16.0.11) with SMTP id u6SAY5TN078454 for ; Thu, 28 Jul 2016 06:36:05 -0400 Received: from e06smtp09.uk.ibm.com (e06smtp09.uk.ibm.com [195.75.94.105]) by mx0a-001b2d01.pphosted.com with ESMTP id 24fdrpyc5e-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 28 Jul 2016 06:36:04 -0400 Received: from localhost by e06smtp09.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 28 Jul 2016 11:36:02 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 888992190056 for ; Thu, 28 Jul 2016 11:35:26 +0100 (BST) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u6SAZxb639583926 for ; Thu, 28 Jul 2016 10:35:59 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u6SAZxTn032508 for ; Thu, 28 Jul 2016 04:35:59 -0600 From: Sascha Silbe In-Reply-To: <57991CC1.40003@redhat.com> References: <1469611466-31574-1-git-send-email-silbe@linux.vnet.ibm.com> <57991CC1.40003@redhat.com> Date: Thu, 28 Jul 2016 12:35:58 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Message-Id: <8737mudp81.fsf@oc4731375738.ibm.com> Subject: Re: [Qemu-devel] [PATCH] error: error_setg_errno(): errno gets preserved List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake , qemu-devel@nongnu.org Cc: Kevin Wolf , Halil Pasic , Michael Roth , Markus Armbruster , Cornelia Huck , Max Reitz Dear Eric, Eric Blake writes: >> +++ b/include/qapi/error.h >> @@ -170,6 +170,9 @@ void error_setg_internal(Error **errp, >> * Just like error_setg(), with @os_error info added to the message. >> * If @os_error is non-zero, ": " + strerror(os_error) is appended to >> * the human-readable error message. >> + * >> + * The value of errno (which usually can get clobbered by almost any >> + * function call) will be preserved. >> */ >> #define error_setg_errno(errp, os_error, fmt, ...) = \ >> error_setg_errno_internal((errp), __FILE__, __LINE__, __func__, = \ > > Do we need/want to make the guarantee of preserving errno across any of > the other functions and macros declared in error.h? It would be more consistent to have all error reporting functions promise this, even if they do not get passed the errno. In some cases the errno might not matter to the user (so error_setg_errno() isn't used), but still be passed on to the caller to signal an error (so clobbering it could be problematic). Can prepare a follow-up patch that makes sure error_setg(), error_propagate(), error_setg_file_open(), error_set() preserve errno. Optionally also the other functions listed in include/qapi/error.h and include/qemu/error-report.h. Sascha --=20 Softwareentwicklung Sascha Silbe, Niederhofenstra=C3=9Fe 5/1, 71229 Leonberg https://se-silbe.de/ USt-IdNr. DE281696641