From 8900c204df0e521361e2bd31131d5f9089d08000 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 15 Mar 2022 22:52:25 -0500 Subject: util/osdep: Avoid madvise proto on modern Solaris On older Solaris releases (before Solaris 11), we didn't get a prototype for madvise, and so util/osdep.c provides its own prototype. Some time between the public Solaris 11.4 release and Solaris 11.4.42 CBE, we started getting an madvise prototype that looks like this: extern int madvise(void *, size_t, int); which conflicts with the prototype in util/osdeps.c. Instead of always declaring this prototype, check if we're missing the madvise() prototype, and only declare it ourselves if the prototype is missing. Move the prototype to include/qemu/osdep.h, the normal place to handle platform-specific header quirks. The 'missing_madvise_proto' meson check contains an obviously wrong prototype for madvise. So if that code compiles and links, we must be missing the actual prototype for madvise. Signed-off-by: Andrew Deason Message-id: 20220316035227.3702-2-adeason@sinenomine.net Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- include/qemu/osdep.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include') diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index 322103aadb..f2274b24cb 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -400,6 +400,14 @@ void qemu_anon_ram_free(void *ptr, size_t size); #define SIGIO SIGPOLL #endif +#ifdef HAVE_MADVISE_WITHOUT_PROTOTYPE +/* + * See MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=7156) for discussion + * about Solaris missing the madvise() prototype. + */ +extern int madvise(char *, size_t, int); +#endif + #if defined(CONFIG_LINUX) #ifndef BUS_MCEERR_AR #define BUS_MCEERR_AR 4 -- cgit v1.2.3