From patchwork Wed Nov 8 22:58:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alistair Francis X-Patchwork-Id: 836080 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="CEmeobDf"; 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 3yXN3G6yDgz9s4q for ; Thu, 9 Nov 2017 10:36:10 +1100 (AEDT) Received: from localhost ([::1]:34472 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCZtA-0001hR-BT for incoming@patchwork.ozlabs.org; Wed, 08 Nov 2017 18:36:08 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35145) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eCZNI-000188-7v for qemu-devel@nongnu.org; Wed, 08 Nov 2017 18:03:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eCZNG-0003r4-0s for qemu-devel@nongnu.org; Wed, 08 Nov 2017 18:03:12 -0500 Received: from mail-dm3nam03on0067.outbound.protection.outlook.com ([104.47.41.67]:50432 helo=NAM03-DM3-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 1eCZNA-0003pg-9S; Wed, 08 Nov 2017 18:03:04 -0500 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=GtlNESOj93WXxSR8kvBhsw7Q24RKZHt5mzjmGl6EY+g=; b=CEmeobDfcie2/kld9mhnoVu33NsPrFs35tSzjpvjK4LMteB91NhdSr8umHKQXF4K3YFbM303PxPG897JB+nddYOk6/dxs9PZI7bByFd1uF1x5Pjm3v+LR87SzerAtsDd9u1oZZkP+9y7SuDRCntUJ+dREfmKo7dPDiZIWlCgk9s= Received: from SN4PR0201CA0047.namprd02.prod.outlook.com (10.162.76.33) by CY4PR02MB3382.namprd02.prod.outlook.com (10.165.89.153) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Wed, 8 Nov 2017 23:03:01 +0000 Received: from CY1NAM02FT058.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e45::208) by SN4PR0201CA0047.outlook.office365.com (2603:10b6:803:2e::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.218.12 via Frontend Transport; Wed, 8 Nov 2017 23:03:01 +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 CY1NAM02FT058.mail.protection.outlook.com (10.152.74.149) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.197.9 via Frontend Transport; Wed, 8 Nov 2017 23:03:00 +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 1eCZN6-0001Nq-46; Wed, 08 Nov 2017 15:03:00 -0800 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1eCZN5-0003BM-SW; Wed, 08 Nov 2017 15:03:00 -0800 Received: from xsj-pvapsmtp01 (xsj-smtp.xilinx.com [149.199.38.66]) by xsj-smtp-dlp2.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id vA8N2s72010538; Wed, 8 Nov 2017 15:02:54 -0800 Received: from [172.19.2.220] (helo=xsjalistai50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1eCZN0-0003AM-LI; Wed, 08 Nov 2017 15:02:54 -0800 From: Alistair Francis To: Date: Wed, 8 Nov 2017 14:58:56 -0800 Message-ID: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: MIME-Version: 1.0 X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-23450.000 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)(376002)(346002)(39860400002)(2980300002)(438002)(199003)(189002)(4326008)(2950100002)(2906002)(9786002)(39060400002)(189998001)(6916009)(5660300001)(8676002)(50226002)(81166006)(77096006)(36756003)(8936002)(478600001)(81156014)(2870700001)(305945005)(356003)(106466001)(47776003)(316002)(118296001)(5820100001)(2351001)(54906003)(50986999)(63266004)(50466002)(76176999)(36386004)(23676003)(575784001)(33646002)(106002)(107986001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR02MB3382; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; PTR:unknown-60-83.xilinx.com; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; CY1NAM02FT058; 1:f6EOiUh1PA7h6U6BsB4WYy6ka/dzG1R2AzJMkn+SAekN0HBuSS4GVS7X6uH2bSyR/uu5qK7G8fDWD9ItkYo5gMLYTcIdqLG8ZBWJ61d3HS0xeToXl4a7NlnvWNoG170P X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fad43009-8720-4867-7da0-08d526fcdc67 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603249); SRVR:CY4PR02MB3382; X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB3382; 3:7uKGOSMQGyGMLNF6YmUQBze9tU3aQqxgf+5bsbkZXEp9iH3FWiGR2vI5RzRed8t0lwZu8+nac1AOjX4crLmoDK0MGz2Lgo8fyRCfSbKDQZEQteT9kYRmgLd/tCYO/s0WNezA9Mv9PEMomruX7WUQNSWiDqKUFXKQM4ZDQwN+dy7jQ9D4e4rhrCo8YihQjLyogKCrKcJttdiz0W5TuXfeKV5/Zod4xo2vWr4BN5xQ4RfPLFJ9OXHebhJWJVYtxxTMyrHVLi6RoKmst7HVl0QrdgNPhCycJ+4ep6JjxjWLrtdympKtc+ucr7DAq7MfqB1iqksW6PXt+FGP1hoqAQR761uCYHSnf9g6uQnKGjDo5cg=; 25:PRyM5CCMGNJxzBawHzDD6wG1FinOpDZfKnxxe0ZdMTiIL5kQi/namHoiKp69DBidn9tHkgbvNGCHjjcJhR+8EQ294V8Yvab92nC10jA1h8rcAC2WnBxssP9T7j/e4tKhVR3QTF009pYO0JNngoo/OJlS698L3nogghy1clHqhrSfDPXLHUqeOmSmDkmTiUR9FZu0yxBkUEz/sLKUAvf3LbL9JDHU17Us6TepkiZZa+GA/HiO/7cZJYOLHKu14GUuxc8yo5dSIL8XD/wWXOrnMMWWzDQxl5Sv6YhONibkScaYj0kt+HRx2Mkv9rtlneEmVoiMbdOdnPZRePjXbChhdA== X-MS-TrafficTypeDiagnostic: CY4PR02MB3382: X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB3382; 31:H+9EjnXQa3sSM4CjukobuZYTL8PN32HggC89L3hjgdShN8HmRc3/nykAYMtmo3L8Nrb0Tf2o85B7u9CIx0wBb2Q8PzNglAU/hLsB0NfSMRrI6WHPcLWokWquJGiKXWIGq8dfsgKm8KaiA4K80AMAe2FZmXdSpnRcuCvEbrd1VgG6o1GYlEHaldZq8HYCe2NTC+UgIHQiVMlGiwjlwb525O30JxBgbCIe+Xhl8/K4MSc=; 20:vdmzEPiMLgjiY0rYysWuMLwvX3W2xtPtXOIfXbJbMI/XOk/bq2VpffkbCMRltj9tcDDkZmPwD689OYVQcDQBKOQ6A5YZ31mfGsXgy5qcG5FQZfKwNT7p6brZokaN0Qh0e89uLFwjlmatN+1qWxFHXRmouJWvCJDh7UBDyyELIzwBpNPJN0J7eUVd0LbbbM7XP6EWlh5j1hpE+S5KP6ul68IiIMVELiw3Y6IDxIousLheZuR1y0XPLK11eD0VQTBjhzHKxjbRJ74KTpNhxlsxzj+OmMRzKKyHk6B2ARBGbIU8QitB/ik+hQWoMSfpHVXKKcRIeJyWXuWs/tulgLFLVnIOrz3INc9S9UPLpK5lcXaAzgDP8TKnV+SGNvepktnxHVnruVtvJ8ocWV+i7sJW2xBRx3ygrCxKdt5UxBNP4t/zetYl5ijIBk22UIjaLwnPy6jHY7dzAhmKsQ/Ng01Gb2jHR/5/qdpx8/gLG9URW2lud8bHzUW++not6998hfiB 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)(3231021)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93004095)(6055026)(6041248)(20161123560025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR02MB3382; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR02MB3382; X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB3382; 4:f0HsAsIPZ54U+5rT0nSuunQnuwFR4I5PnHr4x9mRIRyrJyHtdMXkO42CHhvM3xQYsH7eV+lqyO9dndQ1R2WVFjbvjBieRZ4njeq+11AzNWKin1eoaVUNJi6Mer9jPkzliRd+m3FelyYiqhlnlmjtFdAQ9IzqzCTYLhhOy4amdtXEAs8nqsz07YX4hhiyRYKPZG8+EwC8YQ7EQLZapt/gHxtGB8RMHjoEhzvZzPCnt1JKH7Fr7zU0B6SxtHNA81INYDRwaUfRCwThtJYvbGdASaWk0kQnOsuTFBudgESvDQnufG/u0o1DA2d49faYatcsxucVTUi0q/askjWU15aCew== X-Forefront-PRVS: 0485417665 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR02MB3382; 23:2e3bNGQQXa+pi9/BaysM4TifMCoQEDvNdNXIZL47d?= VQv75WBkn5NDF/VvwJUmparG2jSMiJU2pAUxKX/ahfdjGmYyujV5WqowLQITpVOdvaDZsmsBBiT9Bqf56eJ/s5CkO8FFbi0E27AgoGoDoyuPR6sRavj1dIlGtrMPVc1cpGzjLYEUXXiKiMwi+2/baYsikOTlsZgEnwqfVtfMnW51sO1d+Oi/Dls8bgFOLyn2yaDRd/pRFS64yl7eOZXVwKnvMB7qm/p7lKKg0kv41/VhhsvMcU42H7IawWLWFDmmF8ovjqxwaC6VjzxnPSD8mJ3XCFodxcVq4S4c/NZpK3EYuD+rvOkig5DRtVhK4BaJn16RBudU18V6oJpUvrc1G+MptQlBuot2Qt6sjXW7p6lIwh2BsrviCV8PYPPB1M7g2WnHV3VKTEtD2TrFeM5t4Q09l+I1VJF0BAY48T38y8MX7MTi2tIAgM0bMn2jVAGBLdKyuqE6EV1re2hO7RIO1VrmYYJM7sma3l4vhyTKmefIzV2nzDDrr+ztq65iHW4QsgM23V8whVT7I/Sw/7BicjjNxQj7UHuMaq1U/NtNtMkYiK0+F0/CzdFuStgaaEUM0Aj5WZKHjUvpKg41JgSCUict7XqTSgyu6g3+b8hyTnzbJwl6xzXxDhvi80slNfsSZFgwOTMwDgyZhpGFPPGjYLLWggw8NguImgyAIu5hdGk29zTQanVw43UJYYKYT7Od7Km2lqPfc2xb4TGMTyjuhA9x9aDtiUXiVaXWKbEhlz9MKySU5LkVvYQs43DnDGN7MKgL5dCAffrLgMUrT+07wUC9OkZtjQAaNCSegyr1y5qGf9YfxXTj/MfFqZTaEoSDLTOUTGi9uRu+tEhnSxkGnb1NwKC9WCNM0KWFkFXKKjs6jBOhScfTjEI3+pfY/Wd40PJ2gNpAr6zDhAEa1nHrBEdLYxdHY66Wu1Tg6WGFWJ3x4wbLaDAyIldnkri9rMAMTis1bFXL6Z7bTKBm535nG7C0a0c46F4rfx9eYTnILUQ00dgTQcrEGdVHp2cw/6NBk4= X-Microsoft-Exchange-Diagnostics: 1; CY4PR02MB3382; 6:OcP7Ne37/3jojbzQwn9udpz6MIZKAbTxoBLLccr39IgCojNdMd3Kmv9sqXnKJO3xUDG7z1JPmF22ZZGoLe8uCk4Zqco3Otv7sP9DkEzZv8cpiHF1pZDLzv1v1PEVaIrGS0AX6YdmLnUg+/8LACFYnf0iOsRPZKrztSxKfmpw4nIoTuSymkebVLACaMWX65PA9Nmh8OJjsLvk/0O9hn++ZrulyNsjyoRANw5vTVw/QOAXTUq0DlbnLBpDHE5SWP/AD/9VYRsNYRWjZBAonDQCSMoIESJXnhKC3UNEglq1O/BU040hfSnmSfwVIlJlyfodVSG9osWShR98IeGRJgkVE/bQpJdTcT2jFkraKHmJnWU=; 5:rEeXnouApF8ys3t1XdJl4zoucelwzdqWpoHy/OiQLCqs0KnDHgf2zfD7TO7xIKa56ay07QhsgdoNvd/FZtNHouqSCSVZfKM2BQo34J/s3Qsji/utng0mEBoRnjvupSEHhJ0kxWWk3WvMfA5AKCEswRBYAoFXZ7zS0PFcZUqou0U=; 24:c2mDQkBb027MghFCBF5XQ3mUDQxlKeiRSR65r1QH07AyfTq/ayJJWrqJi/FcBQz4fpjTMdZlsbufiw8vjQ06BR5ckVJXjxRG28CUAhMVCC4=; 7:lvfLgFpS1mDNIG18VuIutgexxMTtHABOee1POqcpyjvsTcChwSy6y0DNbVlJ+CXcXPCcrikJK9TMadvHTvjCJLQAd3bS7i89SSFXYr+pwimfpya7tynOtsfneiexh5UbLjl6PsjqAPVVtqpvoFTK4NwAszRf3b6kZmFcpZZveaG0WLt5+hHbA/0W+gtbnh5srF7e1r4JAyWAWS5bQF+curaFUdt8YHQGpTaAwYZ5vnNzJvRASRe3lULPArxrp3PC SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Nov 2017 23:03:00.8552 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fad43009-8720-4867-7da0-08d526fcdc67 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: CY4PR02MB3382 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 104.47.41.67 Subject: [Qemu-devel] [PATCH v4 42/45] 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}' \ {} + The error in aio_poll() was removed manually. Signed-off-by: Alistair Francis Cc: Kevin Wolf Cc: Markus Armbruster Cc: Paolo Bonzini Cc: Stefan Weil Cc: qemu-block@nongnu.org Reviewed-by: Philippe Mathieu-Daudé --- V4: - Remove the error in aio_poll() util/aio-posix.c | 1 + util/coroutine-sigaltstack.c | 2 +- util/error.c | 4 ++-- 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, 30 insertions(+), 21 deletions(-) diff --git a/util/aio-posix.c b/util/aio-posix.c index 1427f49b4a..8eeba93da6 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" 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..f524e138ec 100644 --- a/util/error.c +++ b/util/error.c @@ -32,8 +32,8 @@ 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", - err->func, err->src, err->line); + 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 1231f9f876..ec0ec7ed2c 100644 --- a/util/osdep.c +++ b/util/osdep.c @@ -466,7 +466,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 @@ -493,7 +493,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 77369c92ce..e34ebf094f 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 @@ -91,7 +92,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 7306475899..1207ef71d6 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("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("%s: %s", msg, strerror(err)); abort(); } diff --git a/util/qemu-thread-win32.c b/util/qemu-thread-win32.c index 94f3491a87..02b94e22da 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("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("%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; }