Skip to contentSkip to conversation

configure: check for EFD_NONBLOCK | EFD_CLOEXEC flags

PATCH Applied Max Filippov 3 participants 3 messages Nov 21, 2011 – Nov 22, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 configure: check for EFD_NONBLOCK | EFD_CLOEXEC flags

Add check for the EFD_NONBLOCK and EFD_CLOEXEC flags to the CONFIG_EVENTFD test.
This fixes the following build failure on Fedora 9:

CC event_notifier.o
event_notifier.c: In function `event_notifier_init':
event_notifier.c:21: error: `EFD_NONBLOCK' undeclared (first use in this function) event_notifier.c:21: error: (Each undeclared identifier is reported only once event_notifier.c:21: error: for each function it appears in.) event_notifier.c:21: error: `EFD_CLOEXEC' undeclared (first use in this function)
make: *** [event_notifier.o] Error 1

---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
index 6c77fbb..580cd4d 100755
@@ -2200,7 +2200,7 @@ cat > $TMPC << EOF
 
 int main(void)
 {
-    int efd = eventfd(0, 0);
+    int efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
     return 0;
 }
 EOF
Signature · 1 line
1.7.6.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 12 lines · Max Filippov

Add check for the EFD_NONBLOCK and EFD_CLOEXEC flags to the CONFIG_EVENTFD test.
This fixes the following build failure on Fedora 9:

     CC    event_notifier.o
   event_notifier.c: In function `event_notifier_init':
   event_notifier.c:21: error: `EFD_NONBLOCK' undeclared (first use in this function) event_notifier.c:21: error: (Each undeclared identifier is reported only once event_notifier.c:21: error: for each function it appears in.) event_notifier.c:21: error: `EFD_CLOEXEC' undeclared (first use in this function)
   make: *** [event_notifier.o] Error 1

Quoted 4 lines

---
 configure |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)

At first this patch seemed suspicious because is undefines CONFIG_EVENTFD on hosts that previously had it defined. A graceful fallback that sets nonblocking and close-on-exec using fcntl(2) is possible, so we don't *need* to be as aggressive as this patch.

However, I chased up the dependencies and it doesn't seem worth doing.
CONFIG_EVENTFD is a dependency for vhost-net, aio=native, and has
fallbacks elsewhere in QEMU. Given that vhost-net was merged in 2.6.34 and the eventfd open flags were introduced in 2.6.27, I think the only feature we actually risk losing here is Linux AIO (aio=native).

2.6.27-based kernels are old so I'm happy with this change.

Stefan

#2 lore raw
In reply to Max Filippov
Quoted 12 lines · Max Filippov

Add check for the EFD_NONBLOCK and EFD_CLOEXEC flags to the CONFIG_EVENTFD test.
This fixes the following build failure on Fedora 9:

CC event_notifier.o
event_notifier.c: In function `event_notifier_init':
event_notifier.c:21: error: `EFD_NONBLOCK' undeclared (first use in this function) event_notifier.c:21: error: (Each undeclared identifier is reported only once event_notifier.c:21: error: for each function it appears in.) event_notifier.c:21: error: `EFD_CLOEXEC' undeclared (first use in this function)
make: *** [event_notifier.o] Error 1

Quoted 1 line

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 17 lines
---
  configure |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)
configure +1 -1
index 6c77fbb..580cd4d 100755
@@ -2200,7 +2200,7 @@ cat>  $TMPC<<  EOF
 
  int main(void)
  {
-    int efd = eventfd(0, 0);
+    int efd = eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC);
      return 0;
  }
  EOF