提交 997306fc 编写于 作者: A aliguori

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: NAnthony Liguori <aliguori@us.ibm.com>



git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5322 c046a42c-6fe2-441c-8c8c-71466251a162
上级 2ca83a8d
...@@ -525,6 +525,7 @@ static int posix_aio_init(void) ...@@ -525,6 +525,7 @@ static int posix_aio_init(void)
{ {
sigset_t mask; sigset_t mask;
PosixAioState *s; PosixAioState *s;
struct aioinit ai;
if (posix_aio_state) if (posix_aio_state)
return 0; return 0;
...@@ -545,18 +546,19 @@ static int posix_aio_init(void) ...@@ -545,18 +546,19 @@ static int posix_aio_init(void)
qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s); qemu_aio_set_fd_handler(s->fd, posix_aio_read, NULL, posix_aio_flush, s);
#if defined(__linux__) && defined(__GLIBC_PREREQ) && !__GLIBC_PREREQ(2, 4) memset(&ai, 0, sizeof(ai));
{ #if !defined(__linux__) || (defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 4))
/* XXX: aio thread exit seems to hang on RedHat 9 and this init ai.aio_threads = 5;
seems to fix the problem. */ ai.aio_num = 1;
struct aioinit ai; #else
memset(&ai, 0, sizeof(ai)); /* XXX: aio thread exit seems to hang on RedHat 9 and this init
ai.aio_threads = 1; seems to fix the problem. */
ai.aio_num = 1; ai.aio_threads = 1;
ai.aio_idle_time = 365 * 100000; ai.aio_num = 1;
aio_init(&ai); ai.aio_idle_time = 365 * 100000;
} }
#endif #endif
aio_init(&ai);
posix_aio_state = s; posix_aio_state = s;
return 0; return 0;
......
...@@ -482,8 +482,10 @@ if test "$mingw32" = "yes" ; then ...@@ -482,8 +482,10 @@ if test "$mingw32" = "yes" ; then
linux_user="no" linux_user="no"
fi fi
if [ "$bsd" = "yes" -o "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then if [ "$darwin" = "yes" -o "$mingw32" = "yes" ] ; then
AIOLIBS= AIOLIBS=
elif [ "$bsd" = "yes" ]; then
AIOLIBS="-lpthread"
else else
# Some Linux architectures (e.g. s390) don't imply -lpthread automatically. # Some Linux architectures (e.g. s390) don't imply -lpthread automatically.
AIOLIBS="-lrt -lpthread" AIOLIBS="-lrt -lpthread"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册