From nobody Sun Nov 24 10:48:42 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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 ARC-Seal: i=1; a=rsa-sha256; t=1725016572; cv=none; d=zohomail.com; s=zohoarc; b=eEfUVSN4TH2JPV/lxZc9sfhlDwJWFEzQO26aW30hJbM1wjWMrIG6iqZCR0zJWJjTVgYzfP5S+waEdMgMKXKJtKVdTsbqioHouuitRFZtlk5HDitdAp4V/4J1Ug8zskql+/ZulF2Q04Vz81Wuske6/fYKy9N4eIbGu+LNhZeDpjg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725016572; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=UX1I+w8ByQPca3qnMONfIXIWlrYZp+DRzwa9VLHBlBE=; b=mTk8frCqjTYi7ZRJiqnjFkkYXIqviBmjZCaUcoKl+UYrDVD27HVaIT8TWZEzn8q6wa14b0KRcUqLF+uu+2Dv5VnooA6l+iRziqZ9TfMxZri3vsWwKXjJ5AHvTS8MeGv7E8E9i9b6nadTQqGKTWE4NWJh5MWajk/VMlnFts9xC+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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 1725016572803496.31033109614316; Fri, 30 Aug 2024 04:16:12 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sjzaz-0007th-Me; Fri, 30 Aug 2024 07:15:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sjzax-0007qq-De for qemu-devel@nongnu.org; Fri, 30 Aug 2024 07:15:11 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sjzau-00071z-2V for qemu-devel@nongnu.org; Fri, 30 Aug 2024 07:15:11 -0400 Received: by mail-wr1-x430.google.com with SMTP id ffacd0b85a97d-374b25263a3so224472f8f.0 for ; Fri, 30 Aug 2024 04:15:07 -0700 (PDT) Received: from carbon-x1.. ([2a01:e0a:e17:9700:16d2:7456:6634:9626]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3749ee4a590sm3713859f8f.9.2024.08.30.04.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Aug 2024 04:15:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1725016506; x=1725621306; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=UX1I+w8ByQPca3qnMONfIXIWlrYZp+DRzwa9VLHBlBE=; b=yrqCZcQFD+vh1xdkk0ObKOMwtjnaQe1aY0maaq+H+v3LEqfVvffFmqcrBA8eq4sDn0 +/hhOoDektrQGe/EyYWWME6cFXpvs09TQxIunEN1TQATPTHSs5ffjHEraUednOSM31M2 jnOniqh09+rRXdiVbYkrMd8dRyIlOCrveGRGIb93+mVVn0ebaCZBB40q1jYWJzfhsshZ Aq11HDzVuHJdOvnca78dY0pYEx5xOeGa1QwLqIK8LOxgsee4C9VAMfqgeAFdgywq4ZW9 3myg18M6WxWz8qD4pPgMU08lDvrbwwxxN1XA8D4gWoHj8ZSoPanxG1GSfmdY/F25TBw8 2T0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725016506; x=1725621306; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UX1I+w8ByQPca3qnMONfIXIWlrYZp+DRzwa9VLHBlBE=; b=S7w4XIqW/NOF9Ql8slyQrnAhaKbWabUVv+uGgexJqYf3HOvCMcF0AiZqCEELHuvHp5 /FEr/J4J67m1EhlWF4MJkx/MipAGqIZbLMDjC9M21IPXNgqHCCaSM4kDdT7V5L/gYJpk hN8e1yom+Wrr3g201nxKGPfcokJOeSPWms/mMxJrAO+Th6JF6lWjFMfQyWHLmDqRw1sz xrXb5cWOUlk5a8mAHZotPyKCRtjJd7POlJV7eVW6urF5RtRloSEbscUBqs2gXaWqnEh6 l2xtawrLBO9KLN+6PvQWFc8MYZaKGPEWa8VVr0O/jOZTMwDr2nRNREuz/S3vAxJZy/yN Uc/Q== X-Forwarded-Encrypted: i=1; AJvYcCVkKDcBMFIT+pWuaCZ34wr5uTKS0C4YJh8R7/YwOr+Xn+HWM1DlWmo0M3iQDIGWlUvpfG+6YBskOIWE@nongnu.org X-Gm-Message-State: AOJu0YyXTtcdSKTGB8r81FktnzJnuKc2CTDYxevpBgKuwRQ9tIjh714o sIVbwQFrenQx2qcvRmswTyoAaAc/E0rSL+E4HYpuZ8hQ4wQB8fw76BjXoPLnnd4= X-Google-Smtp-Source: AGHT+IFNRvF35Y1a2a5LalbAm/b3WEqZt2TzYiJDJQUTH/9euy0HwTFGGi9Vvpy3KYZbRCHZ5njfHw== X-Received: by 2002:a5d:424b:0:b0:368:6f30:ddf1 with SMTP id ffacd0b85a97d-3749b58750amr3845162f8f.59.1725016505105; Fri, 30 Aug 2024 04:15:05 -0700 (PDT) From: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= To: Paolo Bonzini , qemu-devel@nongnu.org Cc: =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= , Richard Henderson , =?UTF-8?q?Daniel=20P=20=2E=20Berrang=C3=A9?= Subject: [PATCH 1/2] qemu/osdep: fix current process fds path for other OSes Date: Fri, 30 Aug 2024 13:14:49 +0200 Message-ID: <20240830111451.3799490-2-cleger@rivosinc.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240830111451.3799490-1-cleger@rivosinc.com> References: <20240830111451.3799490-1-cleger@rivosinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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=2a00:1450:4864:20::430; envelope-from=cleger@rivosinc.com; helo=mail-wr1-x430.google.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, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @rivosinc-com.20230601.gappssmtp.com) X-ZM-MESSAGEID: 1725016574357116600 While Linux and Solaris uses /proc/self/fd, other OSes (MacOS, FreeBSD) uses /dev/fd. In order to support theses OSes, use /dev/fd as a fallback. Fixes: 4ec5ebea078e ("qemu/osdep: Move close_all_open_fds() to oslib-posix") Reported-by: Daniel P. Berrang=C3=A9 Signed-off-by: Cl=C3=A9ment L=C3=A9ger Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Michael Tokarev --- util/oslib-posix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util/oslib-posix.c b/util/oslib-posix.c index 11b35e48fb..901dcccd73 100644 --- a/util/oslib-posix.c +++ b/util/oslib-posix.c @@ -814,8 +814,13 @@ static bool qemu_close_all_open_fd_proc(const int *ski= p, unsigned int nskip) int fd, dfd; DIR *dir; unsigned int skip_start =3D 0, skip_end =3D nskip; +#if defined(CONFIG_LINUX) || defined(CONFIG_SOLARIS) + const char *self_fd =3D "/proc/self/fd"; +#else + const char *self_fd =3D "/dev/fd"; +#endif =20 - dir =3D opendir("/proc/self/fd"); + dir =3D opendir(self_fd); if (!dir) { /* If /proc is not mounted, there is nothing that can be done. */ return false; --=20 2.45.2