From nobody Wed Jun 21 11:35:41 2023 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 4QmLzK6F7Tz4fvRh; Wed, 21 Jun 2023 11:35:41 +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 4QmLzK4TbVz4Zhj; Wed, 21 Jun 2023 11:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687347341; 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=Ic5Fq9dd6Bi23AMrWkp8CB2vwQoF3fEKwnsmsGNhvI0=; b=i9oTX9u1QlokqvBATuLKFelHVpJTxqVKGfrFky3I5MhtNITmBPT94i70uiSLU+G0KV7aEU vCkh/yFYZI2yih9FJKKpeih3cNOvvC5mg/qgcgW5vhlT/mMV0hWDhe8a9Bv/S7ROPhxydN kewVu4wkSogLOQeW4tSFA94UHVstouSKKWnT1y4heMpTg97b8XBNfOUmZ69wwJ7qDulJ2A OjrLSKaEYoDF3n8/DbXMPN/wCwVktTVxV4hUjATFbocnuuvoyHEnVCeMPBsgPPdNH+eG36 H/povse2XcGVlX/a7iRCqhRfj3UB2ap4NO68UEJUZpT7xcsJGKezOfAbWHgUYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1687347341; 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=Ic5Fq9dd6Bi23AMrWkp8CB2vwQoF3fEKwnsmsGNhvI0=; b=dpwHYCaikghKzuj0zU/14qcuVYh5BTzS3zVo+kQ+44vZZIxIw28SSFUYdK8ugEpDiyDwoN ILoKVWt/po71JNEOfgSrqAZmlrx/vYuZIN1WwS0zqz7O3hMIgolq6erpIPu9FBbRp5uAns 2V4lNcqAgdn1wt1E3ZXCNc3Uwv0iY1yWamNdu11EdXafCitkI4iqXk/nXkl7uhbBXmh45x TXrHUAbBHK9YAtv9smGgfsa9/8vqiBjKKC7XXGkJ5WX8Pd+mNe1jbSIvz+vquEDq7I5nnZ ThmkjnJlkSotd31uTPW5+xrKFcUP2PvZ9aUdySH5x+K1kFVcGeqg/Cq1xWV6Rw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687347341; a=rsa-sha256; cv=none; b=CE+DsxFFpDOC4Waha6LEZzZc3DsLJiofyuTz0joRXpVxMIZO5zz20ZAXn9AKdoOWbBLbgj k4B7HOrlQgH0FeAUSuQG7GqekJYdvF9CGNX5DlfuyVSVxudxIPGqn3zn+bF1G1VRqmnuYQ n8w6r0Iwjrxue2jzwRm8AvnumsGoZkuug75A0/mKPOfA2/f0AJsmQ1ScYIeAB/Jje3G4HX /qP1LChajar5qVur72xYqbcY/YP2/1p3fCOGjCHSZzYPT45YtnLrV70iTuXDz9xFxn+aQo FHuPRww3/ULzLLY/P7BU2KtPf9kRzuJC0zjAA7fgw7doWrvuzZJ6JS2X/i1yyQ== 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 4QmLzK335wzg4w; Wed, 21 Jun 2023 11:35:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 35LBZfbH043460; Wed, 21 Jun 2023 11:35:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 35LBZfue043459; Wed, 21 Jun 2023 11:35:41 GMT (envelope-from git) Date: Wed, 21 Jun 2023 11:35:41 GMT Message-Id: <202306211135.35LBZfue043459@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: Mikael Urankar Subject: git: 36173e8b04c7 - main - www/deno: Add a FreeBSD implementation for rss() 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: mikael X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 36173e8b04c784250fb680e77f92339e2feb5496 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mikael: URL: https://cgit.FreeBSD.org/ports/commit/?id=36173e8b04c784250fb680e77f92339e2feb5496 commit 36173e8b04c784250fb680e77f92339e2feb5496 Author: Mikael Urankar AuthorDate: 2023-06-21 10:20:26 +0000 Commit: Mikael Urankar CommitDate: 2023-06-21 11:35:21 +0000 www/deno: Add a FreeBSD implementation for rss() Obtained from: OpenBSD Reviewed by: Val Packett --- www/deno/Makefile | 1 + www/deno/files/patch-runtime_ops_os_mod.rs | 41 +++++++++++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/www/deno/Makefile b/www/deno/Makefile index 33a2f65ef317..0fa1b659d4a1 100644 --- a/www/deno/Makefile +++ b/www/deno/Makefile @@ -1,6 +1,7 @@ PORTNAME= deno DISTVERSIONPREFIX= v DISTVERSION= 1.34.3 +PORTREVISION= 1 CATEGORIES= www PATCH_SITES= https://github.com/denoland/${PORTNAME}/commit/ diff --git a/www/deno/files/patch-runtime_ops_os_mod.rs b/www/deno/files/patch-runtime_ops_os_mod.rs index 15557b190562..c32b6594d71e 100644 --- a/www/deno/files/patch-runtime_ops_os_mod.rs +++ b/www/deno/files/patch-runtime_ops_os_mod.rs @@ -1,12 +1,47 @@ --- runtime/ops/os/mod.rs.orig 2023-01-13 13:12:37 UTC +++ runtime/ops/os/mod.rs -@@ -399,6 +399,11 @@ fn rss() -> usize { - task_info.resident_size as usize +@@ -427,6 +427,46 @@ fn rss() -> usize { + } } +#[cfg(target_os = "freebsd")] +fn rss() -> usize { -+ 0 ++ // Uses FreeBSD's KERN_PROC_PID sysctl(2) ++ // to retrieve information about the current ++ // process, part of which is the RSS (ki_rssize) ++ let pid = unsafe { libc::getpid() }; ++ // SAFETY: libc call (get system page size) ++ let pagesize = unsafe { libc::sysconf(libc::_SC_PAGESIZE) } as usize; ++ // KERN_PROC_PID returns a struct libc::kinfo_proc ++ let mut kinfoproc = std::mem::MaybeUninit::::uninit(); ++ let mut size = std::mem::size_of_val(&kinfoproc) as libc::size_t; ++ let mut mib = [ ++ libc::CTL_KERN, ++ libc::KERN_PROC, ++ libc::KERN_PROC_PID, ++ pid, ++ ]; ++ // SAFETY: libc call, mib has been statically initialized, ++ // kinfoproc is a valid pointer to a libc::kinfo_proc struct ++ let res = unsafe { ++ libc::sysctl( ++ mib.as_mut_ptr(), ++ mib.len() as _, ++ kinfoproc.as_mut_ptr() as *mut libc::c_void, ++ &mut size, ++ std::ptr::null_mut(), ++ 0, ++ ) ++ }; ++ ++ if res == 0 { ++ // SAFETY: sysctl returns 0 on success and kinfoproc is initialized ++ // ki_rssize contains size in pages -> multiply with pagesize to ++ // get size in bytes. ++ pagesize * unsafe { (*kinfoproc.as_mut_ptr()).ki_rssize as usize } ++ } else { ++ 0 ++ } +} + #[cfg(windows)]