Commit 997306fc2246048b9a4e8df4b4bb96eab6c65a82
1 parent
2ca83a8d
Fix build on FreeBSD
__GLIBC_PREREQ is defined in such a way that the ! cannot be used in front of it on FreeBSD. Also, -lpthread is not implied by the build and we definitely use it for compatfd support. While at it, I added a default initialization for posix-aio that seems to perform well in our testing. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5322 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
15 additions
and
11 deletions
block-raw-posix.c
| @@ -525,6 +525,7 @@ static int posix_aio_init(void) | @@ -525,6 +525,7 @@ static int posix_aio_init(void) | ||
| 525 | { | 525 | { |
| 526 | sigset_t mask; | 526 | sigset_t mask; |
| 527 | PosixAioState *s; | 527 | PosixAioState *s; |
| 528 | + struct aioinit ai; | ||
| 528 | 529 | ||
| 529 | if (posix_aio_state) | 530 | if (posix_aio_state) |
| 530 | return 0; | 531 | return 0; |
| @@ -545,18 +546,19 @@ static int posix_aio_init(void) | @@ -545,18 +546,19 @@ static int posix_aio_init(void) | ||
| 545 | 546 | ||
| 546 | qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s); | 547 | qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s); |
| 547 | 548 | ||
| 548 | -#if defined(__linux__) && defined(__GLIBC_PREREQ) && !__GLIBC_PREREQ(2, 4) | ||
| 549 | - { | ||
| 550 | - /* XXX: aio thread exit seems to hang on RedHat 9 and this init | ||
| 551 | - seems to fix the problem. */ | ||
| 552 | - struct aioinit ai; | ||
| 553 | - memset(&ai, 0, sizeof(ai)); | ||
| 554 | - ai.aio_threads = 1; | ||
| 555 | - ai.aio_num = 1; | ||
| 556 | - ai.aio_idle_time = 365 * 100000; | ||
| 557 | - aio_init(&ai); | 549 | + memset(&ai, 0, sizeof(ai)); |
| 550 | +#if !defined(__linux__) || (defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 4)) | ||
| 551 | + ai.aio_threads = 5; | ||
| 552 | + ai.aio_num = 1; | ||
| 553 | +#else | ||
| 554 | + /* XXX: aio thread exit seems to hang on RedHat 9 and this init | ||
| 555 | + seems to fix the problem. */ | ||
| 556 | + ai.aio_threads = 1; | ||
| 557 | + ai.aio_num = 1; | ||
| 558 | + ai.aio_idle_time = 365 * 100000; | ||
| 558 | } | 559 | } |
| 559 | #endif | 560 | #endif |
| 561 | + aio_init(&ai); | ||
| 560 | posix_aio_state = s; | 562 | posix_aio_state = s; |
| 561 | 563 | ||
| 562 | return 0; | 564 | return 0; |
configure
| @@ -482,8 +482,10 @@ if test "$mingw32" = "yes" ; then | @@ -482,8 +482,10 @@ if test "$mingw32" = "yes" ; then | ||
| 482 | linux_user="no" | 482 | linux_user="no" |
| 483 | fi | 483 | fi |
| 484 | 484 | ||
| 485 | -if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then | 485 | +if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then |
| 486 | AIOLIBS= | 486 | AIOLIBS= |
| 487 | +elif [ "$bsd" = "yes" ]; then | ||
| 488 | + AIOLIBS="-lpthread" | ||
| 487 | else | 489 | else |
| 488 | # Some Linux architectures (e.g. s390) don't imply -lpthread automatically. | 490 | # Some Linux architectures (e.g. s390) don't imply -lpthread automatically. |
| 489 | AIOLIBS="-lrt -lpthread" | 491 | AIOLIBS="-lrt -lpthread" |