From patchwork Tue Sep 26 00:09:00 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 818408 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=2001:4830:134:3::11; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=xilinx.onmicrosoft.com header.i=@xilinx.onmicrosoft.com header.b="b1kWVmTn"; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y1M1G5784z9s7C for ; Tue, 26 Sep 2017 10:15:46 +1000 (AEST) Received: from localhost ([::1]:44900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwdXM-0004Re-M2 for incoming@patchwork.ozlabs.org; Mon, 25 Sep 2017 20:15:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dwdUe-0002s8-10 for qemu-devel@nongnu.org; Mon, 25 Sep 2017 20:12:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dwdUc-0005ZB-6W for qemu-devel@nongnu.org; Mon, 25 Sep 2017 20:12:55 -0400 Received: from mail-bn3nam01on0084.outbound.protection.outlook.com ([104.47.33.84]:17328 helo=NAM01-BN3-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dwdUV-0005Vg-T7; Mon, 25 Sep 2017 20:12:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=3C4oOzTJJjHF3lZuxi1/TvAkg/sLRR51xeSZnKDnWpA=; b=b1kWVmTnwHF7Z6MORRPrs/13VfeuobwV8LlTw1ROmkhl7p30Bku+btpX4cGPDR1ATY1p+ekPvPWoVvlPvRD2uYZsbC4jyoucRdZNBbNz9bE7ih3OzqpfqpusX0lHJZReUdXyojkzYd6Es4andxxbSHbBb8T5MIdU9NDfKgwyH70= Received: from BN6PR02CA0089.namprd02.prod.outlook.com (10.161.158.30) by CY1PR02MB1134.namprd02.prod.outlook.com (10.163.15.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.77.7; Tue, 26 Sep 2017 00:12:44 +0000 Received: from SN1NAM02FT004.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::205) by BN6PR02CA0089.outlook.office365.com (2603:10b6:405:60::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.56.9 via Frontend Transport; Tue, 26 Sep 2017 00:12:44 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; nongnu.org; dkim=none (message not signed) header.d=none;nongnu.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT004.mail.protection.outlook.com (10.152.72.175) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.35.14 via Frontend Transport; Tue, 26 Sep 2017 00:12:43 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1dwdUR-0007Az-1w; Mon, 25 Sep 2017 17:12:43 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1dwdUQ-0008Uu-Tn; Mon, 25 Sep 2017 17:12:42 -0700 Received: from xsj-pvapsmtp01 (mailhost.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id v8Q0Ce53021944; Mon, 25 Sep 2017 17:12:40 -0700 Received: from [172.19.2.220] (helo=localhost.localdomain) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1dwdUO-0008Uh-6Q; Mon, 25 Sep 2017 17:12:40 -0700 From: Alistair Francis To: Date: Mon, 25 Sep 2017 17:09:00 -0700 Message-ID: X-Mailer: git-send-email 2.11.0 In-Reply-To: References: X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-23350.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(2980300002)(438002)(189002)(199003)(478600001)(36386004)(33646002)(39060400002)(8676002)(4326008)(76176999)(50986999)(50226002)(36756003)(2906002)(118296001)(48376002)(8936002)(81156014)(106466001)(81166006)(575784001)(5660300001)(54906003)(16586007)(5003940100001)(2351001)(9786002)(189998001)(47776003)(305945005)(50466002)(63266004)(2950100002)(356003)(6916009)(77096006)(316002)(6666003)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR02MB1134; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT004; 1:N4dyIZxjFlEDgbgALfG3JKyr2VFA0dx6/LHYL+spiebf+QP+p7GtuPEhsHroM4iIpcdAoL9dbAQ2kWhat3CDwjxbWJ+jfawWohT3lqUjBRW0X7+WEkOd2pXeguncK/3C MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f347566a-10cb-4d0c-fb9e-08d504734f57 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254152)(8251501002)(2017052603199)(201703131423075)(201703031133081)(201702281549075); SRVR:CY1PR02MB1134; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1134; 3:T6sngrlq6GGBqZ48WmpBp2lEVtSPNQiqOjJgthxqyM/B2sgiF42iUjBnbV/tJCTpur4HgZKWCQWpdmzjiDcyPjHZICZBl6DDvCqVFdmeULxTC8VXMKuWeSaWuGclz2aVdZrjrgWSvn7RdcIT1icppGLEfvjzHCn8vtR7kWTB6h4+nKvJQ2wmCX7tsP79TOYLI/JF0CdgwgunbMe0UEh0b78mw7BnZ1QWR5gAfX0+IhDBpt14uD5UnOm/CW46wyDnnHAPqc7JKzHyTAa31yI1h6cZomkEmCkV/icA5MlqmQdD9Gw4VkBNDS4DrCFrCnn5Nj7jx7GE+9/JnWucumVNovGCaBv8c6UmklxRc8uyb+M=; 25:a2InCc+xRUoDW/R1qRAVuUSihIHr8tHdauBpbkIj8NG3WdkgdUA1FMDfPajoUZfaFZu3SYM/Nf93Xgwu+wqZzu9wG2HNTpDZ5j7P20/qtdLcPz6dezS//6P68ZMIACV37vyGOXui/MxEpU+N+Pj0L9gaFa7v6DPAWYdGIZhWWQFgoFv2ii9f0k0grUkDvPx0DJy7fih29CyC87rmbfK6VYn1CaAJKHWRh9tDF7B832gx9fsEaHfFtGmz1C3KyeNpSYXeMN1uFuybG35GaJfIT5CfjOVvQtJK3/0VCSG3Y/Il7eAHNLtAAjavfplIXxTnfOU/1uM3TR7g+wvpjvlQsA== X-MS-TrafficTypeDiagnostic: CY1PR02MB1134: X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1134; 31:JdZq3Xcg+y9oLjXTO1Y+SxVIpeoaWDTUuaJZ4vZhnN8uxCnbKXgQ+UebrrFaeoLVB9aucRGM0Jfc8F80DhHAH/prvoegWWQvUnpBaZbs2WoAuibr16QmU3rwxN08Dltbu6Z3JwFXTW3LC2pYpZxNjfbqvyOUjzmbn2vUAXevqWLEX4YuRQUr1T/MHOeoppk/VVSJcpozNsMfHlfsYnXU5snsCXK1MrGq1IIhAXOu5sM=; 20:r6QkvL/Dhba5wB8TwsUhXAuT9UpMFbUHRKWkqy3pUvq3sBtrqCkNq1fzfQb+ySi5/lrueCj3T1IBifIso1KbR71hi4qtdWj3oABXY5qCWcXWQmrw4jJXwI+oWTaaDGEyEeW1pVXhKFP4GCOMVexQYGnTMGiSUjwHolGAwbJ0CE7jofqhVOJHLOp9A/gfxMjgn5eql2n525v2ysXF7g1PnmUlQ3n9Tl/mHykK7bCBOc0DgbYMreabkm6Ti/eoONZCRJJR5xYXaGcjCoXC+IoOlZG/LM1H5G5BfvsTS0d/2RJ5X5LDlxpIPtqgw0HhBzjUXA+S0ea08dXgIxreedLX5VeT4A0J3W1FS7VxcOAQJY3VzvsFvTLq0LmkuXUxSx/AtNgg5qym9lw6lvceudpyTXnsCc8E4b7r+EHsaFJc+7zcuutBGJxI2Rx+Iqkk4fwI2U0E6uCyclO1eWCZso0JuqJMx8imO3V9UZEU7Ck0h/QHk1VsJ5gDMXPz51w5Dr/l X-Exchange-Antispam-Report-Test: UriScan:(788757137089)(192813158149592); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(93006095)(93004095)(3002001)(10201501046)(6055026)(6041248)(20161123558100)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR02MB1134; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR02MB1134; X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1134; 4:vdGIoEdYPhuds36UbpeD6ygQWHSCdsR/GmEN5uxtR2YBNvBCXJtmNIowViNTFxpIXj9wiWbwJbZFhigso1uS2TcekGdQJUFaTv6SStT9eHldRc+rRS83+dz+8IJjTALpdvIryFKRJ5DY7qiTTjXU71GUge8BX1mUuo0bTtFbLK2JWXvyqtTJaLx83DziAWYg9uZQ6Io2vidM0vgbg7CJz1hb7ey76ML9nN5IhuKlbG3B+rwM5MavuHOsuSUyZ3XAZAQ5qjhMSUEh58Vhi7ihGChbfraZwAjG7jlw9NfEb56NtdGUcS9q+GrdmL3BQZFH1Y8terpE1JnMkrdLRwRubA== X-Forefront-PRVS: 0442E569BC X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR02MB1134; 23:4Awxav3SVFWLBD9xRtANnl8fq+y+84Z0piTEk6Xuj?= Epru5VhqvhBqmH9S4+3i/yrvJomlBQY1Qv7kyXmcG7lWD8uV/5qJxgw5ZlaDndkkTcXeFCQUbuV0JZcANbrmrurnwm144ETQvg6bleuVh/tWpAHBlp7Gy9ssFc9jqsyteZ9LQ55CdKv/gavmInJ/eyRZMqEzZO3xEFfIWp62W+ke3KyvIN22N0PkxQtYuSKEv8ZJ3uyi6r5D7xs0QSA9BE76Pbf0uHgguNegVTJsrFtjHxNOwERDcm7MZ3DpE88G4to8DCh6yrjdUvJ4fyH+lagy2JW2CKCuqENmdyIjGq2S0xG5cXheWM8mkaMQVltFJVNsk67sjgBdebeYB7zzX1ZMnfC7Ka/8bIC7dmPjekSjSLta78GEqeaCgOBKLCW6Q7sm8rUf3Aw+rAMedC9oqnkaG3NfMtoQfgqgtDK5Q+tQeCVhBYHdFMKwTSgz68uQWx9bBgxJT/RGIUKt3pji7gv7/EASTqnrB9kdmPlUVUvgzDv8CDEifClI0fM3qBOjhyX8AAHGJK3JHnpqAFZuVXWixKtBfnb7z3gIzpTGiR0wWlO+24/+rRBi6/md5WaBOxsksetAKMmiulAHtXLF1lA4l82+/B5ftirShK5MOapNNS+zA/Ms3aWyydzTw1jxIiy/IGaHTMxgLSKTShT4EiIa7OXcygKOE0WjZpQFWsJbIhIWKUWsVFb4LUHNeuORMaAzuqqPWyhJoN18gbFb9R2mX5b8rHXf9Afk3+PSZq8KVjczzo32dI1fDyyqQ2rgxtaihV3f5KPsiVpl6iMZJm741MHg71y4/UiC8T7kNi/jTPHwGMa+CLZLrPIP/KVOvnE0DY4e1THeZtpbPm2T0tqIxhRWAd1a+Oaino9kpnkSjwR4dT4jubIqDnKoD5dc/d0dH+WW5+2i1cGfmibPvqkPdNchj9Me+yAGfuk4NCvN0Ju2oRfXyEAuJLVLUU00ascUX91eXMd//vG0UPNV4qxMBcfgR9xTIp7jDM1hEwlzQ3srfTc0fo6NuatSlPRik8= X-Microsoft-Exchange-Diagnostics: 1; CY1PR02MB1134; 6:aF/L2Iznf+IhxL5giBHYMJi23NZHAwYwOyEo34xaUbPboOh1s4MhEMtO7/srQ7pZrt2/cPxBsDUjmnnDRePZhoS1iXnxsotbR3ru65YZ92ZCLFlORQYpcyPcQV0ZvXYNJWKuieI45uuzOhSPe3Y06w0UDAJeJgbV7Hbbyu7x30Y/0fjEbubqBqkqFYRohy3YWZSAyxEDWkp0uaP1UJdmQz9c30CVAtGFc7wlBDV4PRqQylnUtvV8nq7+In+vo954fbKt6nQ67oENX8dI91yoX29Q20wovMyG6WoGtbLO7ocPJRQfsKzCRmuf8mVubCQsPvF69hT/twjH8sA5Kes7FQ==; 5:LY/29A9MXsh6g3M0LY7w2mtQfyISVYMfpx6fzYb+QdZOfFbrNH0idtIaV7rURyHQFQn8patkNHhfRMrBMUQNqgMBkgwPHyrVRZSFU+PIsyyeWcW5KSNfZhfnDBwzpMSAmSNX35KzigIIupxgks2+fQ==; 24:mZI9GkRFl4BxQjsuJvZfhAp8L6wjEBAewsBc4rvyVcqeJNnFSrs10S1bhDr2oUrvO9xCQZsm2jSdYYJaHv6EldvHNjXvrvAAKmCIPL5ZXUo=; 7:Y1rjCQnwhRg8oHqUFJwr+VrtjXRcechoPvM7TyPIoGkNpACZWRotx36XwxyABMo4KX+pwNk6ukSB7mzHAa6QJdZVVgafSOkMnTadrt3OROja/SvokYN9182APLmEDsY/8bv5UO302F8/sEoSxGjLwnWv+gD43BNNmhakePkIdZtMHDIVC9EAA/pR8Xq3Zgkc5jBsAxzzc676E4ddZOotMqXGV2Zktspq0ftNtCar4OY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2017 00:12:43.4990 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR02MB1134 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.33.84 Subject: [Qemu-devel] [PATCH v1 5/8] util: Replace fprintf(stderr, "*\n" with error_report() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , qemu-block@nongnu.org, Stefan Weil , armbru@redhat.com, alistair.francis@xilinx.com, Paolo Bonzini , alistair23@gmail.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Replace a large number of the fprintf(stderr, "*\n" calls with error_report(). The functions were renamed with these commands and then compiler issues where manually fixed. find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N;N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + find ./* -type f -exec sed -i \ 'N; {s|fprintf(stderr, "\(.*\)\\n"\(.*\));|error_report("\1"\2);|Ig}' \ {} + Signed-off-by: Alistair Francis Cc: Kevin Wolf Cc: Markus Armbruster Cc: Paolo Bonzini Cc: Stefan Weil Cc: qemu-block@nongnu.org --- util/aio-posix.c | 5 +++-- util/coroutine-sigaltstack.c | 2 +- util/error.c | 2 +- util/main-loop.c | 2 +- util/mmap-alloc.c | 3 ++- util/module.c | 6 +++--- util/osdep.c | 4 ++-- util/oslib-posix.c | 3 ++- util/oslib-win32.c | 3 ++- util/qemu-coroutine.c | 5 +++-- util/qemu-progress.c | 3 ++- util/qemu-thread-posix.c | 5 +++-- util/qemu-thread-win32.c | 5 +++-- util/qemu-timer-common.c | 3 ++- util/qht.c | 2 +- 15 files changed, 31 insertions(+), 22 deletions(-) diff --git a/util/aio-posix.c b/util/aio-posix.c index 2d51239ec6..fe4772b4a9 100644 --- a/util/aio-posix.c +++ b/util/aio-posix.c @@ -15,6 +15,7 @@ #include "qemu/osdep.h" #include "qemu-common.h" +#include "qemu/error-report.h" #include "block/block.h" #include "qemu/rcu_queue.h" #include "qemu/sockets.h" @@ -696,8 +697,8 @@ void aio_context_setup(AioContext *ctx) { /* TODO remove this in final patch submission */ if (getenv("QEMU_AIO_POLL_MAX_NS")) { - fprintf(stderr, "The QEMU_AIO_POLL_MAX_NS environment variable has " - "been replaced with -object iothread,poll-max-ns=NUM\n"); + error_report("The QEMU_AIO_POLL_MAX_NS environment variable has " + "been replaced with -object iothread,poll-max-ns=NUM"); exit(1); } diff --git a/util/coroutine-sigaltstack.c b/util/coroutine-sigaltstack.c index f6fc49a0e5..96a01c2c88 100644 --- a/util/coroutine-sigaltstack.c +++ b/util/coroutine-sigaltstack.c @@ -80,7 +80,7 @@ static void __attribute__((constructor)) coroutine_init(void) ret = pthread_key_create(&thread_state_key, qemu_coroutine_thread_cleanup); if (ret != 0) { - fprintf(stderr, "unable to create leader key: %s\n", strerror(errno)); + error_report("unable to create leader key: %s", strerror(errno)); abort(); } } diff --git a/util/error.c b/util/error.c index 3efdd69162..e423368ca0 100644 --- a/util/error.c +++ b/util/error.c @@ -32,7 +32,7 @@ Error *error_fatal; static void error_handle_fatal(Error **errp, Error *err) { if (errp == &error_abort) { - fprintf(stderr, "Unexpected error in %s() at %s:%d:\n", + error_report("Unexpected error in %s() at %s:%d:", err->func, err->src, err->line); error_report_err(err); abort(); diff --git a/util/main-loop.c b/util/main-loop.c index 7558eb5f53..d8369716b2 100644 --- a/util/main-loop.c +++ b/util/main-loop.c @@ -95,7 +95,7 @@ static int qemu_signal_init(void) sigdelset(&set, SIG_IPI); sigfd = qemu_signalfd(&set); if (sigfd == -1) { - fprintf(stderr, "failed to create signalfd\n"); + error_report("failed to create signalfd"); return -errno; } diff --git a/util/mmap-alloc.c b/util/mmap-alloc.c index 3ec029a9ea..11887aac69 100644 --- a/util/mmap-alloc.c +++ b/util/mmap-alloc.c @@ -11,6 +11,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/mmap-alloc.h" #include "qemu/host-utils.h" @@ -51,7 +52,7 @@ size_t qemu_mempath_getpagesize(const char *mem_path) } while (ret != 0 && errno == EINTR); if (ret != 0) { - fprintf(stderr, "Couldn't statfs() memory path: %s\n", + error_report("Couldn't statfs() memory path: %s", strerror(errno)); exit(1); } diff --git a/util/module.c b/util/module.c index c90973721f..1153e3ebb0 100644 --- a/util/module.c +++ b/util/module.c @@ -124,13 +124,13 @@ static int module_load_file(const char *fname) g_module = g_module_open(fname, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL); if (!g_module) { - fprintf(stderr, "Failed to open module: %s\n", + error_report("Failed to open module: %s", g_module_error()); ret = -EINVAL; goto out; } if (!g_module_symbol(g_module, DSO_STAMP_FUN_STR, (gpointer *)&sym)) { - fprintf(stderr, "Failed to initialize module: %s\n", + error_report("Failed to initialize module: %s", fname); /* Print some info if this is a QEMU module (but from different build), * this will make debugging user problems easier. */ @@ -169,7 +169,7 @@ void module_load_one(const char *prefix, const char *lib_name) static GHashTable *loaded_modules; if (!g_module_supported()) { - fprintf(stderr, "Module is not supported by system.\n"); + error_report("Module is not supported by system."); return; } diff --git a/util/osdep.c b/util/osdep.c index a479fedc4a..62d92c9560 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -425,7 +425,7 @@ void fips_set_state(bool requested) #endif /* __linux__ */ #ifdef _FIPS_DEBUG - fprintf(stderr, "FIPS mode %s (requested %s)\n", + error_report("FIPS mode %s (requested %s)", (fips_enabled ? "enabled" : "disabled"), (requested ? "enabled" : "disabled")); #endif @@ -452,7 +452,7 @@ int socket_init(void) ret = WSAStartup(MAKEWORD(2, 2), &Data); if (ret != 0) { err = WSAGetLastError(); - fprintf(stderr, "WSAStartup: %d\n", err); + error_report("WSAStartup: %d", err); return -1; } atexit(socket_cleanup); diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 80086c549f..d840692dd7 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -34,6 +34,7 @@ #include "sysemu/sysemu.h" #include "trace.h" #include "qapi/error.h" +#include "qemu/error-report.h" #include "qemu/sockets.h" #include #include @@ -87,7 +88,7 @@ int qemu_daemon(int nochdir, int noclose) void *qemu_oom_check(void *ptr) { if (ptr == NULL) { - fprintf(stderr, "Failed to allocate memory: %s\n", strerror(errno)); + error_report("Failed to allocate memory: %s", strerror(errno)); abort(); } return ptr; diff --git a/util/oslib-win32.c b/util/oslib-win32.c index 69a6286d50..2197a6a4fc 100644 --- a/util/oslib-win32.c +++ b/util/oslib-win32.c @@ -30,6 +30,7 @@ * see the license comment there. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include #include "qapi/error.h" #include "sysemu/sysemu.h" @@ -44,7 +45,7 @@ void *qemu_oom_check(void *ptr) { if (ptr == NULL) { - fprintf(stderr, "Failed to allocate memory: %lu\n", GetLastError()); + error_report("Failed to allocate memory: %lu", GetLastError()); abort(); } return ptr; diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c index d6095c1d5a..1f7cce6706 100644 --- a/util/qemu-coroutine.c +++ b/util/qemu-coroutine.c @@ -13,6 +13,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "trace.h" #include "qemu-common.h" #include "qemu/thread.h" @@ -110,7 +111,7 @@ void qemu_aio_coroutine_enter(AioContext *ctx, Coroutine *co) trace_qemu_aio_coroutine_enter(ctx, self, co, co->entry_arg); if (co->caller) { - fprintf(stderr, "Co-routine re-entered recursively\n"); + error_report("Co-routine re-entered recursively"); abort(); } @@ -164,7 +165,7 @@ void coroutine_fn qemu_coroutine_yield(void) trace_qemu_coroutine_yield(self, to); if (!to) { - fprintf(stderr, "Co-routine is yielding to no one\n"); + error_report("Co-routine is yielding to no one"); abort(); } diff --git a/util/qemu-progress.c b/util/qemu-progress.c index 3c2223c1a2..84598f0fbb 100644 --- a/util/qemu-progress.c +++ b/util/qemu-progress.c @@ -23,6 +23,7 @@ */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" struct progress_state { @@ -68,7 +69,7 @@ static void sigusr_print(int signal) static void progress_dummy_print(void) { if (print_pending) { - fprintf(stderr, " (%3.2f/100%%)\n", state.current); + error_report(" (%3.2f/100%%)", state.current); print_pending = 0; } } diff --git a/util/qemu-thread-posix.c b/util/qemu-thread-posix.c index 4e95d272dc..4861b1fefc 100644 --- a/util/qemu-thread-posix.c +++ b/util/qemu-thread-posix.c @@ -11,6 +11,7 @@ * */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/thread.h" #include "qemu/atomic.h" #include "qemu/notify.h" @@ -25,14 +26,14 @@ void qemu_thread_naming(bool enable) #ifndef CONFIG_THREAD_SETNAME_BYTHREAD /* This is a debugging option, not fatal */ if (enable) { - fprintf(stderr, "qemu: thread naming not supported on this host\n"); + error_report("qemu: thread naming not supported on this host"); } #endif } static void error_exit(int err, const char *msg) { - fprintf(stderr, "qemu: %s: %s\n", msg, strerror(err)); + error_report("qemu: %s: %s", msg, strerror(err)); abort(); } diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c index 94f3491a87..46b5dac159 100644 --- a/util/qemu-thread-win32.c +++ b/util/qemu-thread-win32.c @@ -16,6 +16,7 @@ #endif #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu-common.h" #include "qemu/thread.h" #include "qemu/notify.h" @@ -29,7 +30,7 @@ void qemu_thread_naming(bool enable) /* But note we don't actually name them on Windows yet */ name_threads = enable; - fprintf(stderr, "qemu: thread naming not supported on this host\n"); + error_report("qemu: thread naming not supported on this host"); } static void error_exit(int err, const char *msg) @@ -38,7 +39,7 @@ static void error_exit(int err, const char *msg) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER, NULL, err, 0, (LPTSTR)&pstr, 2, NULL); - fprintf(stderr, "qemu: %s: %s\n", msg, pstr); + error_report("qemu: %s: %s", msg, pstr); LocalFree(pstr); abort(); } diff --git a/util/qemu-timer-common.c b/util/qemu-timer-common.c index 06d084d364..ab7b702c4f 100644 --- a/util/qemu-timer-common.c +++ b/util/qemu-timer-common.c @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu/osdep.h" +#include "qemu/error-report.h" #include "qemu/timer.h" /***********************************************************/ @@ -37,7 +38,7 @@ static void __attribute__((constructor)) init_get_clock(void) int ret; ret = QueryPerformanceFrequency(&freq); if (ret == 0) { - fprintf(stderr, "Could not calibrate ticks\n"); + error_report("Could not calibrate ticks"); exit(1); } clock_freq = freq.QuadPart; diff --git a/util/qht.c b/util/qht.c index ff4d2e6974..bfab5c7e5e 100644 --- a/util/qht.c +++ b/util/qht.c @@ -154,7 +154,7 @@ static void qht_bucket_debug__locked(struct qht_bucket *b) continue; } if (seen_empty) { - fprintf(stderr, "%s: b: %p, pos: %i, hash: 0x%x, p: %p\n", + error_report("%s: b: %p, pos: %i, hash: 0x%x, p: %p", __func__, b, i, b->hashes[i], b->pointers[i]); corrupt = true; }