WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] tools/libxl: remove O_CLOEXEC in xl_cmdimpl.c

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Vincent Hanquez <vincent.hanquez@xxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] tools/libxl: remove O_CLOEXEC in xl_cmdimpl.c
From: "Ren, Yongjie" <yongjie.ren@xxxxxxxxx>
Date: Tue, 21 Jun 2011 15:28:48 +0800
Accept-language: zh-CN, en-US
Acceptlanguage: zh-CN, en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 21 Jun 2011 00:32:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <19967.22842.105013.682473@xxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <CE59C043D0EC3349B2BF41C0EC72229B12D187CB5E@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4DFAFBDA.8070001@xxxxxxxxxxxxx> <749B9D3DBF0F054390025D9EAFF47F2212D078C447@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <4DFB0C87.7090807@xxxxxxxxxxxxx> <19967.22842.105013.682473@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcwvVnDB2Z7JZX5fQmW/+qM1Uar66wAi2O5Q
Thread-topic: [PATCH] tools/libxl: remove O_CLOEXEC in xl_cmdimpl.c
Hi all,
Some old linux kernel such as 2.6.18 which rhel5u5 natively used haven't 
defined O_CLOEXEC, so remove O_CLOEXEC in xl_cmdimpl.c

Signed-off-by: Yongjie Ren <yongjie.ren@xxxxxxxxx>

diff -r eca057e4475c tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Fri Jun 17 08:08:13 2011 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue Jun 21 14:37:03 2011 +0800
@@ -199,11 +199,16 @@
     fl.l_whence = SEEK_SET;
     fl.l_start = 0;
     fl.l_len = 0;
-    fd_lock = open(lockfile, O_WRONLY|O_CREAT|O_CLOEXEC, S_IWUSR);
+    fd_lock = open(lockfile, O_WRONLY|O_CREAT, S_IWUSR);
     if (fd_lock < 0) {
         fprintf(stderr, "cannot open the lockfile %s errno=%d\n", lockfile, 
errno);
         return ERROR_FAIL;
     }
+    if (fcntl(fd_lock, F_SETFD, FD_CLOEXEC) < 0) {
+        close(fd_lock);
+        fprintf(stderr, "cannot set cloexec to lockfile %s errno=%d\n", 
lockfile, errno);
+        return ERROR_FAIL;
+    }
 get_lock:
     rc = fcntl(fd_lock, F_SETLKW, &fl);
     if (rc < 0 && errno == EINTR)


Best Regards,
     Yongjie Ren    (Jay)


-----Original Message-----
From: Ian Jackson [mailto:Ian.Jackson@xxxxxxxxxxxxx] 
Sent: Monday, June 20, 2011 10:29 PM
To: Vincent Hanquez; Ren, Yongjie
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] make tools ERROR in latest xen-unstable.hg [and 1 more 
messages]

Ren, Yongjie writes ("[Xen-devel] make tools ERROR in latest xen-unstable.hg"):
> Hi all,
> In our test, xen-unstable build fails. When running 'make tools', I got the 
> following error. Do you have the same issue ? 
> xl_cmdimpl.c: In function 'acquire_lock':
> xl_cmdimpl.c:202: error: 'O_CLOEXEC' undeclared (first use in this function)
> xl_cmdimpl.c:202: error: (Each undeclared identifier is reported only once
> xl_cmdimpl.c:202: error: for each function it appears in.)

Thanks for the report.

Vincent Hanquez writes ("Re: [Xen-devel] make tools ERROR in latest 
xen-unstable.hg"):
> I'm not in a position to submit a patch right now, otherwise i would
> have done so already. So i expect someone else will do it; And the
> best scenario would be the reporter of the bug, that can actually
> test the fix to actually do it (specially with guided instructions
> on how to fix it).

Thanks for the diagnosis etc.  Quite so.

Yongjie Ren, would you care to propose such a patch ?  It shouldn't be
too hard.  Remove O_CLOEXEC and add a call to fcntl F_SETFD
FD_CLOEXEC; there's an example in libxl_bootloader.c.

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel