From: Don Slutz <dslutz@verizon.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
xen-devel <xen-devel@lists.xenproject.org>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Jan Beulich <JBeulich@suse.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH] libxl: use libxl_fd_set_{cloexec, nonblock} helpers
Date: Fri, 01 Aug 2014 09:43:40 -0400 [thread overview]
Message-ID: <53DB998C.5020305@terremark.com> (raw)
In-Reply-To: <53D66362.8000901@citrix.com>
[-- Attachment #1: Type: text/plain, Size: 2391 bytes --]
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, <Ian.Jackson@eu.citrix.com> 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 <dslutz@verizon.com>
Date: Thu, 31 Jul 2014 01:26:58 +0000
Subject: [PATCH] Make RHEL5 build again
Signed-off-by: Don Slutz <dslutz@verizon.com>
---
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
[-- Attachment #2: 0001-Make-RHEL5-build-again.patch --]
[-- Type: text/x-patch, Size: 783 bytes --]
>From 46e776a2b770857d869ef54c418924af043274d0 Mon Sep 17 00:00:00 2001
From: Don Slutz <dslutz@verizon.com>
Date: Thu, 31 Jul 2014 01:26:58 +0000
Subject: [PATCH] Make RHEL5 build again
Signed-off-by: Don Slutz <dslutz@verizon.com>
---
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
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-08-01 13:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-25 15:02 [PATCH] libxl: use libxl_fd_set_{cloexec, nonblock} helpers Jan Beulich
2014-07-25 17:07 ` Ian Jackson
2014-07-28 6:32 ` Jan Beulich
2014-07-28 14:51 ` David Vrabel
2014-07-29 9:15 ` Ian Campbell
2014-08-01 13:43 ` Don Slutz [this message]
2014-07-28 7:30 ` [PATCH v2] " Jan Beulich
2014-07-29 14:29 ` Ian Jackson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53DB998C.5020305@terremark.com \
--to=dslutz@verizon.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=david.vrabel@citrix.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).