From nobody Mon Mar 11 21:38:40 2024 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TtqsD74kXz5CXJq; Mon, 11 Mar 2024 21:38:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TtqsD5jWtz43bf; Mon, 11 Mar 2024 21:38:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710193120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gxoG+iE96WlT0FH8JG2Vpzl84qQOC8aAJMgZ7HDd7uI=; b=SG4SIWwCvHTfisD0OCsn6l3Zs2Warv9vRvcXHaQ9q4gNeh1aFzbclx2PVPiW/jXaHPehVS Wn13rpv1j+A3p5Ati0J6Nhrzbcbzl0gCAMXvZ4oHtHTSrRDTnDMiV6Z7DlcTZ8ljoykbT+ uw5Qbv2BGDL+MuwbRgZ3rgxw9Y00k3uSu9JHUKssAp1GgqCUj/oyoPSaLG+D9RofANtKFa lNqfFTFdEpGAHhcoWkWNuqjhvWPZ0jeZYXJ/EbULubxc7tjB5+JzK+CSWr/ofGfgNSyvoM zZXTH+v9s1XmFB56ryCBC0U8gIjRFxutT2R6O3O8P+JXNhvpAP74jdUMFSRBEg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1710193120; a=rsa-sha256; cv=none; b=Zu007M4VXHrkCwdIRwnClIUCQCyfUfoZossiOpPbQ7Vo1m6QDYvKV2macbDlLG9BfU8fQC KFGo4sxenJ+s877C8HpnvpADHj47MN4CRrrY52VeAyqjfPcQz427RXc1oGLbVUl1McTf1+ mVKqWXiQAe0R9BZp2LvngoHhr3f2ifelNCv+kS/XqlRJsMzgyHJAaatKMc16lkj7mLpNS8 kmvw32jwTuZ/I0vqYkJRJmSkmsqyAIGGL2kheTl7R6dxHVfkjSc11OM2f/cp+8TitUnsDb X7LN6U00M4zQ+HEgEj6fmmUap7yWfPBsSjYjUrhnje264+ScS+mzaEw7KGCZrw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1710193120; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=gxoG+iE96WlT0FH8JG2Vpzl84qQOC8aAJMgZ7HDd7uI=; b=J5dk1t4PzxGEUtzGWNqCHSbZLBCgHZGF+u25RCH5u5atn4Rp3+Lv+rbTpprvVVaWz62bcT pPAZsFoZ2VWBo/Obtt5ENHr60c6Oa7LVffMz1962mDRBdsEySTRYpW0MILqFp521L/EDs1 EDJboAC8wNq6TmGMCvo2bkVWCR/Xyox26+wydGjKDwrjLmR0/QgX7GEC0gxU0QMRTswWzk 1sCqZn/Ssyg6AAjQqto1ZYwbocBPgs4VaVQLxrRkU6BGohHMo+dh4K0UHElDJ9tuk0RhJO cgYAgyLGcl5HMJiWjGHWMBk9sbH3h9L/FvcABjYRkR/V1U/oZruDBKJeFFY3gw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TtqsD5CGCzmXv; Mon, 11 Mar 2024 21:38:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42BLceMN043110; Mon, 11 Mar 2024 21:38:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42BLceH7043107; Mon, 11 Mar 2024 21:38:40 GMT (envelope-from git) Date: Mon, 11 Mar 2024 21:38:40 GMT Message-Id: <202403112138.42BLceH7043107@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Christoph Moench-Tegeder Subject: git: 23fdb13510f5 - main - www/firefox-esr: fix process display in about::support List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: cmt X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 23fdb13510f59f2b4c473c0cc715e08d7cc63c6c Auto-Submitted: auto-generated The branch main has been updated by cmt: URL: https://cgit.FreeBSD.org/ports/commit/?id=23fdb13510f59f2b4c473c0cc715e08d7cc63c6c commit 23fdb13510f59f2b4c473c0cc715e08d7cc63c6c Author: Christoph Moench-Tegeder AuthorDate: 2024-03-11 21:36:49 +0000 Commit: Christoph Moench-Tegeder CommitDate: 2024-03-11 21:36:49 +0000 www/firefox-esr: fix process display in about::support same patch as in www/firefox PR: 277159 Reported By: Lars Herschke --- ...toolkit_components_processtools_procinfo__bsd.c | 104 +++++++++++++++++++++ 1 file changed, 104 insertions(+) diff --git a/www/firefox-esr/files/patch-toolkit_components_processtools_procinfo__bsd.c b/www/firefox-esr/files/patch-toolkit_components_processtools_procinfo__bsd.c new file mode 100644 index 000000000000..e2e9a3cc88f4 --- /dev/null +++ b/www/firefox-esr/files/patch-toolkit_components_processtools_procinfo__bsd.c @@ -0,0 +1,104 @@ +diff --git toolkit/components/processtools/ProcInfo_bsd.cpp toolkit/components/processtools/ProcInfo_bsd.cpp +index a6ff4881940c..f041ed5e50ce 100644 +--- toolkit/components/processtools/ProcInfo_bsd.cpp ++++ toolkit/components/processtools/ProcInfo_bsd.cpp +@@ -18,6 +18,9 @@ + #include + #include + #include ++#ifdef __FreeBSD__ ++#include ++#endif + + namespace mozilla { + +@@ -50,25 +53,39 @@ ProcInfoPromise::ResolveOrRejectValue GetProcInfoSync( + } + for (const auto& request : aRequests) { + size_t size; ++#ifdef __FreeBSD__ ++ int mib[4]; ++ int mibsize = 4; ++ mib[0] = CTL_KERN; ++ mib[1] = KERN_PROC; ++ mib[2] = KERN_PROC_PID | KERN_PROC_INC_THREAD; ++ mib[3] = request.pid; ++#else + int mib[6]; ++ int mibsize = 6; + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID | KERN_PROC_SHOW_THREADS; + mib[3] = request.pid; + mib[4] = sizeof(kinfo_proc); + mib[5] = 0; +- if (sysctl(mib, 6, nullptr, &size, nullptr, 0) == -1) { ++#endif ++ if (sysctl(mib, mibsize, nullptr, &size, nullptr, 0) == -1) { + // Can't get info for this process. Skip it. + continue; + } + ++#ifdef __FreeBSD__ ++ auto procs = MakeUniqueFallible(size / sizeof(kinfo_proc)); ++#else + mib[5] = size / sizeof(kinfo_proc); + auto procs = MakeUniqueFallible(mib[5]); ++#endif + if (!procs) { + result.SetReject(NS_ERROR_OUT_OF_MEMORY); + return result; + } +- if (sysctl(mib, 6, procs.get(), &size, nullptr, 0) == -1 && ++ if (sysctl(mib, mibsize, procs.get(), &size, nullptr, 0) == -1 && + errno != ENOMEM) { + continue; + } +@@ -84,19 +101,34 @@ ProcInfoPromise::ResolveOrRejectValue GetProcInfoSync( + bool found = false; + for (size_t i = 0; i < size / sizeof(kinfo_proc); i++) { + const auto& p = procs[i]; ++#ifdef __FreeBSD__ ++ if (i == 0) { ++#else + if (p.p_tid == -1) { ++#endif + // This is the process. + found = true; ++#ifdef __FreeBSD__ ++ info.cpuTime = uint64_t(p.ki_runtime) * 1'000u; ++ info.memory = (p.ki_tsize + p.ki_dsize + p.ki_ssize) * getpagesize(); ++#else + info.cpuTime = uint64_t(p.p_rtime_sec) * 1'000'000'000u + + uint64_t(p.p_rtime_usec) * 1'000u; + info.memory = + (p.p_vm_tsize + p.p_vm_dsize + p.p_vm_ssize) * getpagesize(); ++#endif ++ + } else { + // This is one of its threads. + ThreadInfo threadInfo; ++#ifdef __FreeBSD__ ++ threadInfo.tid = p.ki_tid; ++ threadInfo.cpuTime = uint64_t(p.ki_runtime) * 1'000u; ++#else + threadInfo.tid = p.p_tid; + threadInfo.cpuTime = uint64_t(p.p_rtime_sec) * 1'000'000'000u + + uint64_t(p.p_rtime_usec) * 1'000u; ++#endif + info.threads.AppendElement(threadInfo); + } + } +diff --git toolkit/components/processtools/moz.build toolkit/components/processtools/moz.build +index b7c164c1b0ac..a41dad52c343 100644 +--- toolkit/components/processtools/moz.build ++++ toolkit/components/processtools/moz.build +@@ -39,7 +39,7 @@ BROWSER_CHROME_MANIFESTS += ["tests/browser/browser.ini"] + # Platform-specific implementations of `ProcInfo`. + toolkit = CONFIG["MOZ_WIDGET_TOOLKIT"] + if toolkit == "gtk" or toolkit == "android": +- if CONFIG["OS_TARGET"] == "OpenBSD": ++ if CONFIG["OS_TARGET"] == "FreeBSD" or CONFIG["OS_TARGET"] == "OpenBSD": + UNIFIED_SOURCES += ["ProcInfo_bsd.cpp"] + else: + UNIFIED_SOURCES += ["ProcInfo_linux.cpp"]