Build fixes for Haiku
v3 cover Build fixes for Haiku
This patchset is essentially a resend of David Carlier's build fixes for the Haiku platform. I've taken David's patches and put them together into a set of emails threaded in the way our CI tools expect, as the easiest way to get the patchew robot to run the build tests so we can check they didn't accidentally break one of the BSDs. I've also put in the patch from Gerd that fixes the drm.c issue. I've also expanded on the commit messages for all the patches so that we have a record of why we made the changes if we need to look back at it in future.
Assuming no issues turn up, I'll arrange to get these into master at some point before the 5.1 release.
Thanks for reporting these problems and providing the fixes, David.
-- PMM
David CARLIER (8):
build: Enable BSD symbols for Haiku util/qemu-openpty.c: Don't assume pty.h is glibc-only
build: Check that mlockall() exists
osdep.h: Always include <sys/signal.h> if it exists osdep.h: For Haiku, define SIGIO as equivalent to SIGPOLL bswap.h: Include <endian.h> on Haiku for bswap operations util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD util/oslib-posix.c: Implement qemu_init_exec_dir() for Haiku
Gerd Hoffmann (1):
util/drm: make portable by avoiding struct dirent d_type
configure | 36 ++++++++++++++++++++++++++++++++++-- include/qemu/bswap.h | 2 ++ include/qemu/osdep.h | 6 +++++- hw/xen/xen-legacy-backend.c | 1 - os-posix.c | 4 ++++ util/compatfd.c | 2 ++ util/drm.c | 19 ++++++++++++++----- util/oslib-posix.c | 20 +++++++++++++++++++- util/qemu-openpty.c | 2 +- 9 files changed, 81 insertions(+), 11 deletions(-)
Signature · 1 line
2.20.1
PATCH v3 1/9 build: Enable BSD symbols for Haiku
From: David CARLIER <[email protected]>
Tell Haiku to provide various BSD functions by setting BSD_SOURCE and linking libbsd.
--- configure | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
configure +2 -2
@@ -903,8 +903,8 @@ SunOS) ;; Haiku) haiku="yes" - QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS $QEMU_CFLAGS" - LIBS="-lposix_error_mapper -lnetwork $LIBS" + QEMU_CFLAGS="-DB_USE_POSITIVE_POSIX_ERRORS -DBSD_SOURCE $QEMU_CFLAGS" + LIBS="-lposix_error_mapper -lnetwork -lbsd $LIBS" ;; Linux) audio_drv_list="try-pa oss"
Signature · 1 line
2.20.1
PATCH v3 2/9 util/qemu-openpty.c: Don't assume pty.h is glibc-only
In reply to Peter MaydellFrom: David CARLIER <[email protected]>
Instead of using an OS-specific ifdef test to select the "openpty() is in pty.h" codepath, make configure check for the existence of the header and use the new CONFIG_PTY instead.
This is necessary to build on Haiku, which also provides openpty() via pty.h.
--- configure | 9 +++++++++ util/qemu-openpty.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)
configure +9 -0
@@ -2386,6 +2386,12 @@ else l2tpv3=no fi +if check_include "pty.h" ; then + pty_h=yes +else + pty_h=no +fi + ######################################### # vhost interdependencies and host support
@@ -7856,6 +7862,9 @@ fi if test "$sheepdog" = "yes" ; then echo "CONFIG_SHEEPDOG=y" >> $config_host_mak fi +if test "$pty_h" = "yes" ; then + echo "CONFIG_PTY=y" >> $config_host_mak +fi if test "$fuzzing" = "yes" ; then if test "$have_fuzzer" = "yes"; then FUZZ_LDFLAGS=" -fsanitize=address,fuzzer"
util/qemu-openpty.c +1 -1
@@ -35,7 +35,7 @@#include "qemu/osdep.h" #include "qemu-common.h" -#if defined(__GLIBC__) +#if definedCONFIG_PTY # include <pty.h> #elif definedCONFIG_BSD # include <termios.h>
Signature · 1 line
2.20.1
Re: [PATCH v3 2/9] util/qemu-openpty.c: Don't assume pty.h is glibc-only
Quoted 17 lines · Peter Maydell
From: David CARLIER <[email protected]>
Instead of using an OS-specific ifdef test to select the "
openpty()is inpty.h" codepath, make configure check for the existence of the header and use the newCONFIG_PTYinstead.This is necessary to build on Haiku, which also provides
openpty()viapty.h.Signed-off-by David Carlier <[email protected]>[PMM: Expanded commit message]Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- configure | 9 +++++++++ util/qemu-openpty.c | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-)
[...]
util/qemu-openpty.c line 38
Quoted 10 lines
util/qemu-openpty.c +1
-1@@ -35,7 +35,7 @@#include "qemu/osdep.h" #include "qemu-common.h" -#if defined(__GLIBC__) +#if definedCONFIG_PTY
Shouldn't there be some parentheses around CONFIG_PTY here?
Thomas
Re: [PATCH v3 2/9] util/qemu-openpty.c: Don't assume pty.h is glibc-only
Quoted 10 lines · Thomas Huth
util/qemu-openpty.c line 38
Quoted 7 lines
+++
b/util/qemu-openpty.cutil/qemu-openpty.c +1
-1@@ -35,7 +35,7 @@#include "qemu/osdep.h" #include "qemu-common.h" -#if defined(__GLIBC__) +#if definedCONFIG_PTY Shouldn't there be some parentheses around
CONFIG_PTYhere?
No, they are optional, and omitting them is more consistent with the CONFIG_BSD just below.
Quoted 2 lines
#elif defined
CONFIG_BSD# include <termios.h>
Signature · 3 lines
Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3226 Virtualization: qemu.org | libvirt.org
Re: [PATCH v3 2/9] util/qemu-openpty.c: Don't assume pty.h is glibc-only
Quoted 12 lines · Eric Blake
Quoted 9 lines · Thomas Huth
util/qemu-openpty.c line 38
Quoted 6 lines
+++
b/util/qemu-openpty.cutil/qemu-openpty.c +1
-0@@ -35,7 +35,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" -#if defined(__GLIBC__) +#if definedCONFIG_PTY Shouldn't there be some parentheses around
CONFIG_PTYhere?
Quoted 2 lines
No, they are optional, and omitting them is more consistent with the
CONFIG_BSDjust below.
Thanks, TIL - I'm doing so many years of C programming already, and until now I never noticed any code that does not use parentheses after "defined" ...
Thomas
PATCH v3 3/9 build: Check that mlockall() exists
In reply to Peter MaydellFrom: David CARLIER <[email protected]>
Instead of assuming that all POSIX platforms provide mlockall(), test for it in configure. If the host doesn't provide this platform then os_mlock() will fail -ENOSYS, as it does already on Windows.
This is necessary for Haiku, which does not have mlockall().
--- configure | 15 +++++++++++++++ os-posix.c | 4 ++++ 2 files changed, 19 insertions(+)
configure +15 -0
@@ -2392,6 +2392,18 @@ else pty_h=no fi +cat > $TMPC <<EOF +#include <sys/mman.h> +int main(int argc, char *argv[]) { + return mlockall(MCL_FUTURE); +} +EOF +if compile_prog "" "" ; then + have_mlockall=yes +else + have_mlockall=no +fi + ######################################### # vhost interdependencies and host support
@@ -7865,6 +7877,9 @@ fi if test "$pty_h" = "yes" ; then echo "CONFIG_PTY=y" >> $config_host_mak fi +if test "$have_mlockall" = "yes" ; then + echo "CONFIG_MLOCKALL=y" >> $config_host_mak +fi if test "$fuzzing" = "yes" ; then if test "$have_fuzzer" = "yes"; then FUZZ_LDFLAGS=" -fsanitize=address,fuzzer"
os-posix.c +4 -0
@@ -337,6 +337,7 @@ bool is_daemonized(void)int os_mlock (void ) { +#if definedCONFIG_MLOCKALL int ret =0 ; ret =mlockall (MCL_CURRENT |MCL_FUTURE );
@@ -345,4 +346,7 @@ int os_mlock(void) }return ret; +#else +return -ENOSYS ; +#endif }
Signature · 1 line
2.20.1
Re: [PATCH v3 3/9] build: Check that mlockall() exists
Quoted 16 lines · Peter Maydell
From: David CARLIER <[email protected]>
Instead of assuming that all POSIX platforms provide
mlockall(), test for it in configure. If the host doesn't provide this platform thenos_mlock()will fail-ENOSYS, as it does already on Windows.This is necessary for Haiku, which does not have
mlockall().Signed-off-by David Carlier <[email protected]>[PMM: Expanded commit message]Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- configure | 15 +++++++++++++++ os-posix.c | 4 ++++ 2 files changed, 19 insertions(+)
[...]
os-posix.c bool is_daemonized(void) · line 340
Quoted 9 lines
os-posix.c +1
-0@@ -337,6 +337,7 @@ bool is_daemonized(void)int os_mlock (void ) { +#if definedCONFIG_MLOCKALL
Also missing the parentheses?
Thomas
PATCH v3 4/9 osdep.h: Always include <sys/signal.h> if it exists
In reply to Peter MaydellFrom: David CARLIER <[email protected]>
Regularize our handling of <sys/signal.h>: currently we include it in osdep.h, but only for OpenBSD, and we include it without an ifdef guard in a couple of C files. This causes problems for Haiku, which doesn't have that header.
Instead, check in configure whether sys/signal.h exists, and if it does then always include it from osdep.h.
--- configure | 8 ++++++++ include/qemu/osdep.h | 2 +- hw/xen/xen-legacy-backend.c | 1 - util/oslib-posix.c | 1 - 4 files changed, 9 insertions(+), 3 deletions(-)
configure +8 -0
@@ -3212,6 +3212,11 @@ if ! check_include "ifaddrs.h" ; then have_ifaddrs_h=no fi +have_sys_signal_h=no +if check_include "sys/signal.h" ; then + have_sys_signal_h=yes +fi + ########################################## # VTE probe
@@ -7398,6 +7403,9 @@ fi if test "$have_broken_size_max" = "yes" ; then echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak fi +if test "$have_sys_signal_h" = "yes" ; then + echo "CONFIG_SYS_SIGNAL=y" >> $config_host_mak +fi # Work around a system header bug with some kernel/XFS header # versions where they both try to define 'struct fsxattr':
include/qemu/osdep.h +1 -1
@@ -104,7 +104,7 @@ extern int daemon(int, int);#include <setjmp.h> #include <signal.h> -#ifdef __OpenBSD__ +#ifdef CONFIG_SYS_SIGNAL #include <sys/signal.h> #endif
hw/xen/xen-legacy-backend.c +0 -1
@@ -23,7 +23,6 @@*/ #include "qemu/osdep.h" -#include <sys/signal.h> #include "hw/sysbus.h" #include "hw/boards.h"
util/oslib-posix.c +0 -1
@@ -38,7 +38,6 @@#include "qemu/sockets.h" #include "qemu/thread.h" #include <libgen.h> -#include <sys/signal.h> #include "qemu/cutils.h" #ifdef CONFIG_LINUX
Signature · 1 line
2.20.1
Re: [PATCH v3 4/9] osdep.h: Always include <sys/signal.h> if it exists
Quoted 38 lines · Peter Maydell
From: David CARLIER <[email protected]>
Regularize our handling of <
sys/signal.h>: currently we include it inosdep.h, but only for OpenBSD, and we include it without an ifdef guard in a couple of C files. This causes problems for Haiku, which doesn't have that header.Instead, check in configure whether
sys/signal.hexists, and if it does then always include it fromosdep.h.Signed-off-by David Carlier <[email protected]>[PMM: Expanded commit message]Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- configure | 8 ++++++++ include/qemu/osdep.h | 2 +- hw/xen/xen-legacy-backend.c | 1 - util/oslib-posix.c | 1 - 4 files changed, 9 insertions(+), 3 deletions(-)configure +5
-0@@ -3212,6 +3212,11 @@ if ! check_include "ifaddrs.h" ; then have_ifaddrs_h=no fi +have_sys_signal_h=no +if check_include "sys/signal.h" ; then + have_sys_signal_h=yes +fi + ########################################## # VTE probe
configure fi · line 7408
Quoted 6 lines
configure +3
-0@@ -7398,6 +7403,9 @@ fi if test "$have_broken_size_max" = "yes" ; then echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak fi +if test "$have_sys_signal_h" = "yes" ; then + echo "CONFIG_SYS_SIGNAL=y" >> $config_host_mak +fi
I'd maybe rather name it HAVE_SYS_SIGNAL_H, but I guess that's just a matter of taste.
Philippe Mathieu-Daudé
Reviewed-byRe: [PATCH v3 4/9] osdep.h: Always include <sys/signal.h> if it exists
Quoted 38 lines · Thomas Huth
Quoted 37 lines · Peter Maydell
From: David CARLIER <[email protected]>
Regularize our handling of <
sys/signal.h>: currently we include it inosdep.h, but only for OpenBSD, and we include it without an ifdef guard in a couple of C files. This causes problems for Haiku, which doesn't have that header.Instead, check in configure whether
sys/signal.hexists, and if it does then always include it fromosdep.h.Signed-off-by David Carlier <[email protected]>[PMM: Expanded commit message]Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- configure | 8 ++++++++ include/qemu/osdep.h | 2 +- hw/xen/xen-legacy-backend.c | 1 - util/oslib-posix.c | 1 - 4 files changed, 9 insertions(+), 3 deletions(-)configure +5
-0@@ -3212,6 +3212,11 @@ if ! check_include "ifaddrs.h" ; then have_ifaddrs_h=no fi +have_sys_signal_h=no +if check_include "sys/signal.h" ; then + have_sys_signal_h=yes +fi + ########################################## # VTE probe
Quoted 10 lines
configure fi · line 7408
Quoted 7 lines
configure +3
-0@@ -7398,6 +7403,9 @@ fi if test "$have_broken_size_max" = "yes" ; then echo "HAVE_BROKEN_SIZE_MAX=y" >> $config_host_mak fi +if test "$have_sys_signal_h" = "yes" ; then + echo "CONFIG_SYS_SIGNAL=y" >> $config_host_mak +fiI'd maybe rather name it
HAVE_SYS_SIGNAL_H, but I guess that's just a matter of taste.
Agreed, if possible.
Quoted 4 lines
Reviewed-by Thomas Huth <[email protected]>
PATCH v3 5/9 osdep.h: For Haiku, define SIGIO as equivalent to SIGPOLL
In reply to Peter MaydellFrom: David CARLIER <[email protected]>
Haiku doesn't provide SIGIO; fix this up in osdep.h by defining it as equal to SIGPOLL.
--- include/qemu/osdep.h | 4 ++++ 1 file changed, 4 insertions(+)
include/qemu/osdep.h +4 -0
@@ -425,6 +425,10 @@ void qemu_anon_ram_free(void *ptr, size_t size);#define HAVE_CHARDEV_PARPORT 1#endif +#if defined(__HAIKU__) +#define SIGIO SIGPOLL +#endif +#if defined(CONFIG_LINUX )#ifndef BUS_MCEERR_AR #define BUS_MCEERR_AR 4
Signature · 1 line
2.20.1
Re: [PATCH v3 5/9] osdep.h: For Haiku, define SIGIO as equivalent to SIGPOLL
Quoted 18 lines · Peter Maydell
From: David CARLIER <[email protected]>
Haiku doesn't provide SIGIO; fix this up in
osdep.hby defining it as equal to SIGPOLL.Signed-off-by David Carlier <[email protected]>[PMM: Expanded commit message]Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- include/qemu/osdep.h | 4 ++++ 1 file changed, 4 insertions(+)include/qemu/osdep.h +0
-0
include/qemu/osdep.h void qemu_anon_ram_free(void *ptr, size_t size); · line 434
Quoted 10 lines
include/qemu/osdep.h +4
-0@@ -425,6 +425,10 @@ void qemu_anon_ram_free(void *ptr, size_t size);#define HAVE_CHARDEV_PARPORT 1#endif +#if defined(__HAIKU__) +#define SIGIO SIGPOLL +#endif +#if defined(CONFIG_LINUX )#ifndef BUS_MCEERR_AR #define BUS_MCEERR_AR 4
Sounds reasonable.
PATCH v3 6/9 bswap.h: Include <endian.h> on Haiku for bswap operations
In reply to Peter MaydellFrom: David CARLIER <[email protected]>
Haiku puts the bswap* functions in <endian.h>; pull in that include file on that platform.
--- include/qemu/bswap.h | 2 ++ 1 file changed, 2 insertions(+)
include/qemu/bswap.h +2 -0
@@ -8,6 +8,8 @@# include <machine/bswap.h> #elif defined(__FreeBSD__)# include <sys/endian.h> +#elif defined(__HAIKU__) +# include <endian.h> #elif defined(CONFIG_BYTESWAP_H )# include <byteswap.h>
Signature · 1 line
2.20.1
Re: [PATCH v3 6/9] bswap.h: Include <endian.h> on Haiku for bswap operations
Quoted 18 lines · Peter Maydell
From: David CARLIER <[email protected]>
Haiku puts the bswap* functions in <
endian.h>; pull in that include file on that platform.Signed-off-by David Carlier <[email protected]>[PMM: Expanded commit message]Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- include/qemu/bswap.h | 2 ++ 1 file changed, 2 insertions(+)include/qemu/bswap.h +0
-0
include/qemu/bswap.h line 14
Quoted 7 lines
include/qemu/bswap.h +2
-0@@ -8,6 +8,8 @@# include <machine/bswap.h> #elif defined(__FreeBSD__)# include <sys/endian.h> +#elif defined(__HAIKU__) +# include <endian.h> #elif defined(CONFIG_BYTESWAP_H )# include <byteswap.h>
Re: [PATCH v3 6/9] bswap.h: Include <endian.h> on Haiku for bswap operations
In reply to Peter MaydellQuoted 19 lines · Peter Maydell
From: David CARLIER <[email protected]>
Haiku puts the bswap* functions in <
endian.h>; pull in that include file on that platform.Signed-off-by David Carlier <[email protected]>[PMM: Expanded commit message]Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- include/qemu/bswap.h | 2 ++ 1 file changed, 2 insertions(+)include/qemu/bswap.h +0
-0
include/qemu/bswap.h line 15
Quoted 8 lines
include/qemu/bswap.h +2
-0@@ -8,6 +8,8 @@# include <machine/bswap.h> #elif defined(__FreeBSD__)# include <sys/endian.h> +#elif defined(__HAIKU__) +# include <endian.h> #elif defined(CONFIG_BYTESWAP_H )# include <byteswap.h>
PATCH v3 7/9 util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD
In reply to Peter MaydellFrom: David CARLIER <[email protected]>
util/compatfd.c includes <sys/syscall.h> so that the CONFIG_SIGNALFD code can use SYS_signalfd. Guard the #include with CONFIG_SIGNALFD to avoid portability issues on hosts like Haiku which do not provide that header file.
--- util/compatfd.c | 2 ++ 1 file changed, 2 insertions(+)
util/compatfd.c +2 -0
@@ -16,7 +16,9 @@#include "qemu/osdep.h" #include "qemu/thread.h" +#if defined(CONFIG_SIGNALFD )#include <sys/syscall.h> +#endif struct sigfd_compat_info {
Signature · 1 line
2.20.1
Re: [PATCH v3 7/9] util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD
Quoted 20 lines · Peter Maydell
From: David CARLIER <[email protected]>
util/compatfd.cincludes <sys/syscall.h> so that theCONFIG_SIGNALFDcode can useSYS_signalfd. Guard the #include withCONFIG_SIGNALFDto avoid portability issues on hosts like Haiku which do not provide that header file.Signed-off-by David Carlier <[email protected]>[PMM: Expanded commit message]Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- util/compatfd.c | 2 ++ 1 file changed, 2 insertions(+)util/compatfd.c +0
-0
util/compatfd.c line 24
Quoted 9 lines
util/compatfd.c +2
-0@@ -16,7 +16,9 @@#include "qemu/osdep.h" #include "qemu/thread.h" +#if defined(CONFIG_SIGNALFD )#include <sys/syscall.h> +#endif struct sigfd_compat_info {
Re: [PATCH v3 7/9] util/compatfd.c: Only include <sys/syscall.h> if CONFIG_SIGNALFD
In reply to Peter MaydellQuoted 20 lines · Peter Maydell
From: David CARLIER <[email protected]>
util/compatfd.cincludes <sys/syscall.h> so that theCONFIG_SIGNALFDcode can useSYS_signalfd. Guard the #include withCONFIG_SIGNALFDto avoid portability issues on hosts like Haiku which do not provide that header file.Signed-off-by David Carlier <[email protected]>[PMM: Expanded commit message]Reviewed-by Peter Maydell <[email protected]>Signed-off-by Peter Maydell <[email protected]>--- util/compatfd.c | 2 ++ 1 file changed, 2 insertions(+)util/compatfd.c +0
-0
util/compatfd.c line 19
Quoted 4 lines
util/compatfd.c +1
-0@@ -16,7 +16,9 @@#include "qemu/osdep.h" #include "qemu/thread.h" +#if defined(CONFIG_SIGNALFD )
Most of the code base guards <sys/syscall.h> with '#ifdef CONFIG_LINUX', bsd-user/strace.c is the BSD exception.
CONFIG_SIGNALFD guards SYS_signalfd.
Quoted 6 lines
util/compatfd.c +1
-0#include <sys/syscall.h> +#endif struct sigfd_compat_info {
PATCH v3 8/9 util/oslib-posix.c: Implement qemu_init_exec_dir() for Haiku
In reply to Peter MaydellFrom: David CARLIER <[email protected]>
The qemu_init_exec_dir() function is inherently non-portable; provide an implementation for Haiku hosts.
--- util/oslib-posix.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
util/oslib-posix.c +19 -0
@@ -60,6 +60,10 @@#include <mach-o/dyld.h> #endif +#ifdef __HAIKU__ +#include <kernel/image.h> +#endif +#include "qemu/mmap-alloc.h" #ifdef CONFIG_DEBUG_STACK_USAGE
@@ -389,6 +393,21 @@ void qemu_init_exec_dir(const char *argv0) } } } +#elif defined(__HAIKU__) + { +image_info ii; +int32_t c =0 ; + + *buf ='\0' ; +while (get_next_image_info (0 , &c, &ii) ==B_OK ) { +if (ii.type ==B_APP_IMAGE ) { +strncpy (buf, ii.name,sizeof (buf)); + buf[sizeof (buf) -1 ] =0 ; + p = buf; +break ; + } + } + }#endif /* If we don't have any way of figuring out the actual executable location then try argv[0]. */
Signature · 1 line
2.20.1
PATCH v3 9/9 util/drm: make portable by avoiding struct dirent d_type
In reply to Peter MaydellFrom: Gerd Hoffmann <[email protected]>
Given this isn't perforance critical at all lets avoid the non-portable d_type and use fstat instead to check whenever the file is a chardev.
Message-id: [email protected]
--- util/drm.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
util/drm.c +14 -5
@@ -24,7 +24,8 @@ int qemu_drm_rendernode_open(const char *rendernode) {DIR *dir;struct dirent *e; -int r, fd; +struct stat st; +int r, fd, ret;char *p;if (rendernode) {
@@ -38,10 +39,6 @@ int qemu_drm_rendernode_open(const char *rendernode) fd =-1 ;while ((e =readdir (dir))) { -if (e->d_type !=DT_CHR ) { -continue ; - } -if (strncmp (e->d_name,"renderD" ,7 )) {continue ; }
@@ -53,6 +50,18 @@ int qemu_drm_rendernode_open(const char *rendernode)g_free (p);continue ; } + +/* +* prefer fstat() over checking e->d_type == DT_CHR for +* portability reasons +*/ + ret =fstat (r, &st); +if (ret <0 || (st.st_mode &S_IFMT ) !=S_IFCHR ) { +close (r); +g_free (p); +continue ; + } + fd = r;g_free (p);break ;
Signature · 1 line
2.20.1
Quoted 10 lines · Peter Maydell
This patchset is essentially a resend of David Carlier's build fixes for the Haiku platform. I've taken David's patches and put them together into a set of emails threaded in the way our CI tools expect, as the easiest way to get the patchew robot to run the build tests so we can check they didn't accidentally break one of the BSDs. I've also put in the patch from Gerd that fixes the
drm.cissue. I've also expanded on the commit messages for all the patches so that we have a record of why we made the changes if we need to look back at it in future.
Quoted 2 lines
Assuming no issues turn up, I'll arrange to get these into master at some point before the 5.1 release.
I've made the minor renames from CONFIG_ to HAVE_ where suggested and will put these into the tree via a target-arm pullreq I'm planning for Monday.
thanks
-- PMM
Alright thanks for the assistance. Regards.
Quoted 22 lines · Peter Maydell
Quoted 10 lines · Peter Maydell
This patchset is essentially a resend of David Carlier's build fixes for the Haiku platform. I've taken David's patches and put them together into a set of emails threaded in the way our CI tools expect, as the easiest way to get the patchew robot to run the build tests so we can check they didn't accidentally break one of the BSDs. I've also put in the patch from Gerd that fixes the
drm.cissue. I've also expanded on the commit messages for all the patches so that we have a record of why we made the changes if we need to look back at it in future.Quoted 2 lines
Assuming no issues turn up, I'll arrange to get these into master at some point before the 5.1 release.
I've made the minor renames from
CONFIG_toHAVE_where suggested and will put these into the tree via a target-arm pullreq I'm planning for Monday.thanks
-- PMM