From patchwork Mon Jun 29 21:48:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David CARLIER X-Patchwork-Id: 11632955 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6892D13BD for ; Tue, 30 Jun 2020 00:45:12 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4116620781 for ; Tue, 30 Jun 2020 00:45:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kKOXdLhb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4116620781 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:48362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jq4Od-0003UP-G6 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 29 Jun 2020 20:45:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59996) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jq1dv-0007jp-Ew; Mon, 29 Jun 2020 17:48:47 -0400 Received: from mail-ej1-x642.google.com ([2a00:1450:4864:20::642]:42442) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jq1dt-00088g-QD; Mon, 29 Jun 2020 17:48:47 -0400 Received: by mail-ej1-x642.google.com with SMTP id i14so18367516ejr.9; Mon, 29 Jun 2020 14:48:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=7jJjssFU/PP2r5mJjLoPZrHhXjRyO0Aifak5gnKePUM=; b=kKOXdLhbX1+OtsYdNpmm/cgz0Ks+YNFM1H0aSO52Ay9yIDpbiB2cugthYA8zMXc5t8 ORn5ECnaMOl687qpUHQ2fzgly0pKdYiykVV6loqhsmNlK9MT+jx0u3ovOmSsDZfPo887 C1zuiwjjnoNZZsaQrAPmysbTRz/tH1+2fhOHFWLBkNEfn3D0iYzOphR8FMeNXPs5Jryd 8MejH84aufGOi5uWxJdOF9QBnMpPxrelCJl6w1h/IgF1hT8OBh5SVMGoA2oHX3C9YvYX CTMrDXEVZkiVUwYe1U1nE8qzJrnewFJtGFT7ly6f5WiC622a2ZT5f2jzd6omgvFJnbjB Jyzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7jJjssFU/PP2r5mJjLoPZrHhXjRyO0Aifak5gnKePUM=; b=GPawDCT9G4fsK0xHtWeFWpjaGQGJYV3C87H2RXF5OH7eqytT8tGEVAAnoiLVx/U9WB JgttaO2RYpEX0CS++ScSvz0Jr+oWAnZicMErBkIfKJ3d2xtozdI2+hGWFz9dG0pe/6Ti uHsaG3hZn/QvLNjioiPUD7g5q8ura2slXgQ50QauYZIjNt0J3rNi3F92mRQMaId5/+B9 oW8EOX/Pbct6u2eZdxxU38KA1DK4AFLXQ5R0Y79xGhFpv9TY0GUs94+3W2pJobD6CInF nHQRW6jn4DnlR/nzT/LHmOSrNs5tDyNrw0m6+E3yAsE5XkNRC2EZTr3Pd9S8a0YI/2ZR JVtA== X-Gm-Message-State: AOAM530TjNTThhpEI9g2NjCdSFtJu+K5q+D83qiPDER95BL6sUWkLVpg jLDk3ELHJkfWnEvLjldYkggjttK/Cx3pDBKbsz8N1uG21Ho= X-Google-Smtp-Source: ABdhPJwuBnm2oXTS3y7yncphMNAvb1eBjmctU/sgHxhlTUVu2pF8rezUuIXJ0FvDzTFYFJiSRpDfsymHcIyzLJHxZQ0= X-Received: by 2002:a17:907:100a:: with SMTP id ox10mr15206686ejb.351.1593467323961; Mon, 29 Jun 2020 14:48:43 -0700 (PDT) MIME-Version: 1.0 From: David CARLIER Date: Mon, 29 Jun 2020 22:48:33 +0100 Message-ID: Subject: [PATCH 9/9] Implementing qemu_init_exec_dir. To: QEMU Trivial , qemu-devel Received-SPF: pass client-ip=2a00:1450:4864:20::642; envelope-from=devnexen@gmail.com; helo=mail-ej1-x642.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-Mailman-Approved-At: Mon, 29 Jun 2020 20:42:18 -0400 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" From fcdb25804af98329b52a04e7a4e5191135aac4f6 Mon Sep 17 00:00:00 2001 From: David Carlier Date: Mon, 29 Jun 2020 22:36:03 +0000 Subject: [PATCH 9/9] Implementing qemu_init_exec_dir. Signed-off-by: David Carlier Reviewed-by: Peter Maydell --- util/oslib-posix.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) -- 2.26.0 diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 7ad9195c44..72907d4d7f 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -60,6 +60,10 @@ #include #endif +#ifdef __HAIKU__ +#include +#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]. */