From mboxrd@z Thu Jan 1 00:00:00 1970 From: Don Slutz Subject: Re: [PATCH] libxl: use libxl_fd_set_{cloexec, nonblock} helpers Date: Fri, 01 Aug 2014 09:43:40 -0400 Message-ID: <53DB998C.5020305@terremark.com> References: <53D28D9F020000780002615D@mail.emea.novell.com> <21458.36567.506481.423244@mariner.uk.xensource.com> <53D60AB602000078000265E2@mail.emea.novell.com> <53D66362.8000901@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060005020701080306060101" Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XDD7Y-0004ot-Uw for xen-devel@lists.xenproject.org; Fri, 01 Aug 2014 13:43:45 +0000 In-Reply-To: <53D66362.8000901@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: David Vrabel Cc: Ian Campbell , xen-devel , Ian Jackson , Jan Beulich , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------060005020701080306060101 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 07/28/14 10:51, David Vrabel wrote: > On 28/07/14 07:32, Jan Beulich wrote: >>>>> On 25.07.14 at 19:07, wrote: >>> Jan Beulich writes ("[PATCH] libxl: use libxl_fd_set_{cloexec,nonblock} >>>> --- a/tools/libxl/libxl_qmp.c >>>> +++ b/tools/libxl/libxl_qmp.c >>>> @@ -358,19 +358,14 @@ static int qmp_open(libxl__qmp_handler * >>>> int timeout) >>> ... >>>> --- a/tools/libxl/libxl_utils.c >>>> +++ b/tools/libxl/libxl_utils.c >>>> @@ -1047,11 +1047,17 @@ int libxl__random_bytes(libxl__gc *gc, u >>> ... >>>> - fd = open(dev, O_RDONLY | O_CLOEXEC); >>>> + fd = open(dev, O_RDONLY); >>> Firstly, I don't understand why we care about cloexec on this fd, but >>> it's harmless to do so. >> And of course I'd be perfectly fine with a one liner just dropping it >> (all I really care about is that the file builds correctly in all cases). >> The question of why cloexec is needed/wanted here I'll pass on to >> author and committer, but I'd guess this is just to avoid >> proliferation of file handles into clones. > Surely it should be standard practice for a library to always set > CLOEXEC on any files it opens, to minimize the side effects the library > call has? > > And if CLOEXEC is required then setting it at open time is the only safe > way. > > David Since this is an open, read, close; CLOEXEC is not needed at all. And it breaks the build on RHEL5. So I did a quick one liner. From 46e776a2b770857d869ef54c418924af043274d0 Mon Sep 17 00:00:00 2001 From: Don Slutz Date: Thu, 31 Jul 2014 01:26:58 +0000 Subject: [PATCH] Make RHEL5 build again Signed-off-by: Don Slutz --- tools/libxl/libxl_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 1fdf5ea..2649778 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -1047,7 +1047,7 @@ int libxl__random_bytes(libxl__gc *gc, uint8_t *buf, size_t len) int fd; int ret; - fd = open(dev, O_RDONLY | O_CLOEXEC); + fd = open(dev, O_RDONLY); if (fd < 0) { LOGE(ERROR, "failed to open \"%s\"", dev); return ERROR_FAIL; -- 1.8.2.1 -Don Slutz > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel --------------060005020701080306060101 Content-Type: text/x-patch; name="0001-Make-RHEL5-build-again.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Make-RHEL5-build-again.patch" >>From 46e776a2b770857d869ef54c418924af043274d0 Mon Sep 17 00:00:00 2001 From: Don Slutz Date: Thu, 31 Jul 2014 01:26:58 +0000 Subject: [PATCH] Make RHEL5 build again Signed-off-by: Don Slutz --- tools/libxl/libxl_utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c index 1fdf5ea..2649778 100644 --- a/tools/libxl/libxl_utils.c +++ b/tools/libxl/libxl_utils.c @@ -1047,7 +1047,7 @@ int libxl__random_bytes(libxl__gc *gc, uint8_t *buf, size_t len) int fd; int ret; - fd = open(dev, O_RDONLY | O_CLOEXEC); + fd = open(dev, O_RDONLY); if (fd < 0) { LOGE(ERROR, "failed to open \"%s\"", dev); return ERROR_FAIL; -- 1.8.2.1 --------------060005020701080306060101 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --------------060005020701080306060101--