Re: [BUG] EPOLL_CLOEXEC undeclared

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Eric,

thank you for taking a look at my problem.

On Monday 16 January 2012 16:36:00 Eric Blake wrote:
> On 01/16/2012 08:07 AM, Philipp Hahn wrote:
> > $ dpkg-query -W linux-libc-dev
> > linux-libc-dev  2.6.32-35~ucs1.48.201109051614
>
> glibc has supported epoll_create1() and EPOLL_CLOEXEC since glibc 2.9.

That's the problem on this (old) Debian Lenny system:
# dpkg-query -W libc6-dev
libc6-dev       2.7-18.32.201101241735

> #define EPOLL_CLOEXEC O_CLOEXEC

Adding that define doesn't solve the problem; the next errors are

lxc/lxc_controller.c: In function ‘lxcControllerMain’:
lxc/lxc_controller.c:1176: warning: implicit declaration of 
function ‘epoll_create1’
lxc/lxc_controller.c:1176: warning: nested extern declaration 
of ‘epoll_create1’ [-Wnested-externs]


# objdump -T /lib/libc-2.7.so | grep epoll_create
00000000000cfb60 g    DF .text  0000000000000025  GLIBC_2.3.2 epoll_create

From a different (newer) Debian Squeeze system:
# objdump -T /lib/libc-2.11.2.so  | grep epoll_create
000cc020 g    DF .text  00000034  GLIBC_2.3.2 epoll_create
000cc060 g    DF .text  00000034  GLIBC_2.9   epoll_create1

> Would you like to submit the patch for that?

For me this looks like lxc now only works with glibc >= 2.9, so an appropriate 
check in configure should be added?
Or a fall-back to epoll_create()?

diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 49727dd..bb36d91 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -1173,7 +1173,11 @@ static int lxcControllerMain(int serverFd,
         consoles[i].hostFd = hostFds[i];
         consoles[i].contFd = contFds[i];
 
+#ifdef EPOLL_CLOEXEC
         if ((consoles[i].epollFd = epoll_create1(EPOLL_CLOEXEC)) < 0) {
+#else
+        if ((consoles[i].epollFd = epoll_create(0)) < 0 || 
virSetInherit(consoles[i].epollFd, false) < 0) {
+#endif
             virReportSystemError(errno, "%s",
                                  _("Unable to create epoll fd"));
             goto cleanup;

Yes, I know it's ugly and not 100% thread/signal/async save, but at least if 
compiles again with older libc versions.

Sincerely
Philipp
-- 
Philipp Hahn           Open Source Software Engineer      hahn@xxxxxxxxxxxxx
Univention GmbH        Linux for Your Business        fon: +49 421 22 232- 0
Mary-Somerville-Str.1  D-28359 Bremen                 fax: +49 421 22 232-99
                                                   http://www.univention.de/

Attachment: signature.asc
Description: This is a digitally signed message part.

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]