From nobody Mon Feb 9 04:23:38 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647402936002364.8499952291394; Tue, 15 Mar 2022 20:55:36 -0700 (PDT) Received: from localhost ([::1]:45950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUKl6-0007Zv-7T for importer@patchew.org; Tue, 15 Mar 2022 23:55:36 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42380) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUKim-0004rb-Dn for qemu-devel@nongnu.org; Tue, 15 Mar 2022 23:53:12 -0400 Received: from smtp126.ord1c.emailsrvr.com ([108.166.43.126]:60914) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUKik-0005ax-G2 for qemu-devel@nongnu.org; Tue, 15 Mar 2022 23:53:12 -0400 Received: by smtp8.relay.ord1c.emailsrvr.com (Authenticated sender: adeason-AT-sinenomine.net) with ESMTPSA id 38F5EA00E4; Tue, 15 Mar 2022 23:53:09 -0400 (EDT) X-Auth-ID: adeason@sinenomine.net From: Andrew Deason To: qemu-devel@nongnu.org Subject: [PATCH v3 1/3] util/osdep: Avoid madvise proto on modern Solaris Date: Tue, 15 Mar 2022 22:52:25 -0500 Message-Id: <20220316035227.3702-2-adeason@sinenomine.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220316035227.3702-1-adeason@sinenomine.net> References: <20220316035227.3702-1-adeason@sinenomine.net> X-Classification-ID: bed69193-96d2-4a39-a762-e06e17567ffe-2-1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=108.166.43.126; envelope-from=adeason@sinenomine.net; helo=smtp126.ord1c.emailsrvr.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Andrew Deason , Richard Henderson , Paolo Bonzini , Ani Sinha , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1647402956994100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Peter Maydell --- Changes since v2: - Rename new symbol to HAVE_MADVISE_WITHOUT_PROTOTYPE - Move madvise prototype to include/qemu/osdep.h - More comments in meson.build Changes since v1: - madvise prototype check changed to not be platforms-specific, and turned = into CONFIG_MADVISE_MISSING_PROTOTYPE. include/qemu/osdep.h | 8 ++++++++ meson.build | 23 +++++++++++++++++++++-- util/osdep.c | 3 --- 3 files changed, 29 insertions(+), 5 deletions(-) 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 @@ -393,20 +393,28 @@ void qemu_anon_ram_free(void *ptr, size_t size); =20 #if defined(__linux__) || defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || defined(__DragonFly__) #define HAVE_CHARDEV_PARPORT 1 #endif =20 #if defined(__HAIKU__) #define SIGIO SIGPOLL #endif =20 +#ifdef HAVE_MADVISE_WITHOUT_PROTOTYPE +/* + * See MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=3D7156) for discu= ssion + * 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 #endif #ifndef BUS_MCEERR_AO #define BUS_MCEERR_AO 5 #endif #endif =20 #if defined(__linux__) && \ diff --git a/meson.build b/meson.build index bae62efc9c..282e7c4650 100644 --- a/meson.build +++ b/meson.build @@ -1708,25 +1708,44 @@ config_host_data.set('CONFIG_EVENTFD', cc.links(''' int main(void) { return eventfd(0, EFD_NONBLOCK | EFD_CLOEXEC); }''')) config_host_data.set('CONFIG_FDATASYNC', cc.links(gnu_source_prefix + ''' #include int main(void) { #if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0 return fdatasync(0); #else #error Not supported #endif }''')) -config_host_data.set('CONFIG_MADVISE', cc.links(gnu_source_prefix + ''' + +has_madvise =3D cc.links(gnu_source_prefix + ''' #include #include #include - int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }''')) + int main(void) { return madvise(NULL, 0, MADV_DONTNEED); }''') +missing_madvise_proto =3D false +if has_madvise + # Some platforms (illumos and Solaris before Solaris 11) provide madvise= () + # but forget to prototype it. In this case, has_madvise will be true (the + # test program links despite a compile warning). To detect the + # missing-prototype case, we try again with a definitely-bogus prototype. + # This will only compile if the system headers don't provide the prototy= pe; + # otherwise the conflicting prototypes will cause a compiler error. + missing_madvise_proto =3D cc.links(gnu_source_prefix + ''' + #include + #include + #include + extern int madvise(int); + int main(void) { return madvise(0); }''') +endif +config_host_data.set('CONFIG_MADVISE', has_madvise) +config_host_data.set('HAVE_MADVISE_WITHOUT_PROTOTYPE', missing_madvise_pro= to) + config_host_data.set('CONFIG_MEMFD', cc.links(gnu_source_prefix + ''' #include int main(void) { return memfd_create("foo", MFD_ALLOW_SEALING); }''')) config_host_data.set('CONFIG_OPEN_BY_HANDLE', cc.links(gnu_source_prefix += ''' #include #if !defined(AT_EMPTY_PATH) # error missing definition #else int main(void) { struct file_handle fh; return open_by_handle_at(0, &fh,= 0); } #endif''')) diff --git a/util/osdep.c b/util/osdep.c index 7c4deda6fe..1825399bcf 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -21,23 +21,20 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN * THE SOFTWARE. */ #include "qemu/osdep.h" #include "qapi/error.h" =20 /* Needed early for CONFIG_BSD etc. */ =20 #ifdef CONFIG_SOLARIS #include -/* See MySQL bug #7156 (http://bugs.mysql.com/bug.php?id=3D7156) for - discussion about Solaris header problems */ -extern int madvise(char *, size_t, int); #endif =20 #include "qemu-common.h" #include "qemu/cutils.h" #include "qemu/sockets.h" #include "qemu/error-report.h" #include "qemu/madvise.h" #include "qemu/mprotect.h" #include "qemu/hw-version.h" #include "monitor/monitor.h" --=20 2.11.0 From nobody Mon Feb 9 04:23:38 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647403065819618.2217152051494; Tue, 15 Mar 2022 20:57:45 -0700 (PDT) Received: from localhost ([::1]:50138 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUKnA-00024i-HJ for importer@patchew.org; Tue, 15 Mar 2022 23:57:44 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42412) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUKiu-0005Cm-GR for qemu-devel@nongnu.org; Tue, 15 Mar 2022 23:53:20 -0400 Received: from smtp120.ord1c.emailsrvr.com ([108.166.43.120]:56671) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUKis-0005cl-V0 for qemu-devel@nongnu.org; Tue, 15 Mar 2022 23:53:20 -0400 Received: by smtp8.relay.ord1c.emailsrvr.com (Authenticated sender: adeason-AT-sinenomine.net) with ESMTPSA id 9CD9EA00E8; Tue, 15 Mar 2022 23:53:17 -0400 (EDT) X-Auth-ID: adeason@sinenomine.net From: Andrew Deason To: qemu-devel@nongnu.org Subject: [PATCH v3 2/3] hw/i386/acpi-build: Avoid 'sun' identifier Date: Tue, 15 Mar 2022 22:52:26 -0500 Message-Id: <20220316035227.3702-3-adeason@sinenomine.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220316035227.3702-1-adeason@sinenomine.net> References: <20220316035227.3702-1-adeason@sinenomine.net> X-Classification-ID: bed69193-96d2-4a39-a762-e06e17567ffe-3-1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=108.166.43.120; envelope-from=adeason@sinenomine.net; helo=smtp120.ord1c.emailsrvr.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Andrew Deason , Richard Henderson , Paolo Bonzini , Ani Sinha , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1647403066124100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" On Solaris, 'sun' is #define'd to 1, which causes errors if a variable is named 'sun'. Slightly change the name of the var for the Slot User Number so we can build on Solaris. Reviewed-by: Ani Sinha Signed-off-by: Andrew Deason Reviewed-by: Michael S. Tsirkin --- hw/i386/acpi-build.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index 4ad4d7286c..dcf6ece3d0 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -576,32 +576,32 @@ static void build_append_pci_bus_devices(Aml *parent_= scope, PCIBus *bus, } =20 Aml *aml_pci_device_dsm(void) { Aml *method, *UUID, *ifctx, *ifctx1, *ifctx2, *ifctx3, *elsectx; Aml *acpi_index =3D aml_local(0); Aml *zero =3D aml_int(0); Aml *bnum =3D aml_arg(4); Aml *func =3D aml_arg(2); Aml *rev =3D aml_arg(1); - Aml *sun =3D aml_arg(5); + Aml *sunum =3D aml_arg(5); =20 method =3D aml_method("PDSM", 6, AML_SERIALIZED); =20 /* * PCI Firmware Specification 3.1 * 4.6. _DSM Definitions for PCI */ UUID =3D aml_touuid("E5C937D0-3553-4D7A-9117-EA4D19C3434D"); ifctx =3D aml_if(aml_equal(aml_arg(0), UUID)); { - aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sun), acpi_ind= ex)); + aml_append(ifctx, aml_store(aml_call2("AIDX", bnum, sunum), acpi_i= ndex)); ifctx1 =3D aml_if(aml_equal(func, zero)); { uint8_t byte_list[1]; =20 ifctx2 =3D aml_if(aml_equal(rev, aml_int(2))); { /* * advertise function 7 if device has acpi-index * acpi_index values: * 0: not present (default value) --=20 2.11.0 From nobody Mon Feb 9 04:23:38 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1647403009703997.1520622083234; Tue, 15 Mar 2022 20:56:49 -0700 (PDT) Received: from localhost ([::1]:47780 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUKmI-0000VP-2V for importer@patchew.org; Tue, 15 Mar 2022 23:56:50 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUKiy-0005Mk-7F for qemu-devel@nongnu.org; Tue, 15 Mar 2022 23:53:24 -0400 Received: from smtp126.ord1c.emailsrvr.com ([108.166.43.126]:34192) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUKiw-0005d7-Ks for qemu-devel@nongnu.org; Tue, 15 Mar 2022 23:53:23 -0400 Received: by smtp8.relay.ord1c.emailsrvr.com (Authenticated sender: adeason-AT-sinenomine.net) with ESMTPSA id 573A4A00FF; Tue, 15 Mar 2022 23:53:21 -0400 (EDT) X-Auth-ID: adeason@sinenomine.net From: Andrew Deason To: qemu-devel@nongnu.org Subject: [PATCH v3 3/3] util/osdep: Remove some early cruft Date: Tue, 15 Mar 2022 22:52:27 -0500 Message-Id: <20220316035227.3702-4-adeason@sinenomine.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20220316035227.3702-1-adeason@sinenomine.net> References: <20220316035227.3702-1-adeason@sinenomine.net> X-Classification-ID: bed69193-96d2-4a39-a762-e06e17567ffe-4-1 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=108.166.43.126; envelope-from=adeason@sinenomine.net; helo=smtp126.ord1c.emailsrvr.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eduardo Habkost , Peter Maydell , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= , "Michael S. Tsirkin" , Andrew Deason , Richard Henderson , Paolo Bonzini , Ani Sinha , Igor Mammedov Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1647403011879100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The include for statvfs.h has not been needed since all statvfs calls were removed in commit 4a1418e07bdc ("Unbreak large mem support by removing kqemu"). The comment mentioning CONFIG_BSD hasn't made sense since an include for config-host.h was removed in commit aafd75841001 ("util: Clean up includes"). Remove this cruft. Reviewed-by: Peter Maydell Signed-off-by: Andrew Deason --- util/osdep.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/util/osdep.c b/util/osdep.c index 1825399bcf..394804d32e 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -16,27 +16,20 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN * THE SOFTWARE. */ #include "qemu/osdep.h" #include "qapi/error.h" - -/* Needed early for CONFIG_BSD etc. */ - -#ifdef CONFIG_SOLARIS -#include -#endif - #include "qemu-common.h" #include "qemu/cutils.h" #include "qemu/sockets.h" #include "qemu/error-report.h" #include "qemu/madvise.h" #include "qemu/mprotect.h" #include "qemu/hw-version.h" #include "monitor/monitor.h" =20 static bool fips_enabled =3D false; --=20 2.11.0