Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to "Fix" OpenBSD Build (Followup) #1361

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

BenBE
Copy link
Member

@BenBE BenBE commented Jan 6, 2024

This is a follow-up to #1277 from @time-killer-games.

This basically re-instates the variant I rebased onto current main (a0f7854).

I'll remove dropping the block of memory accounting code present in that commit, if there are no objections. Reasoning in the original PR.

@BenBE BenBE added bug 🐛 Something isn't working build system 🔧 Affects the build system rather then the user experience OpenBSD 🐡 OpenBSD related issues labels Jan 6, 2024
@BenBE BenBE added this to the 3.3.0 milestone Jan 6, 2024
@BenBE BenBE requested a review from natoscott January 6, 2024 14:22
Co-authored-by: Benny Baumann <BenBE@geshi.org>
@BenBE
Copy link
Member Author

BenBE commented Jan 6, 2024

@natoscott @time-killer-games: Any objections to drop this hunk from the PR?

diff --git a/openbsd/OpenBSDMachine.c b/openbsd/OpenBSDMachine.c
index 0ff893b5..95ab52fb 100644
--- a/openbsd/OpenBSDMachine.c
+++ b/openbsd/OpenBSDMachine.c
@@ -141,18 +141,7 @@ static void OpenBSDMachine_scanMemoryInfo(OpenBSDMachine* this) {
    }
 
    super->totalMem = uvmexp.npages * this->pageSizeKB;
-   super->usedMem = (uvmexp.npages - uvmexp.free - uvmexp.paging) * this->pageSizeKB;
-
-   // Taken from OpenBSD systat/iostat.c, top/machine.c and uvm_sysctl(9)
-   const int bcache_mib[] = { CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT };
-   struct bcachestats bcstats;
-   size_t size_bcstats = sizeof(bcstats);
-
-   if (sysctl(bcache_mib, 3, &bcstats, &size_bcstats, NULL, 0) < 0) {
-      CRT_fatalError("cannot get vfs.bcachestat");
-   }
-
-   super->cachedMem = bcstats.numbufpages * this->pageSizeKB;
+   super->usedMem = (uvmexp.npages - uvmexp.free) * this->pageSizeKB;
 
    /*
     * Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>

@time-killer-games
Copy link
Contributor

@natoscott @time-killer-games: Any objections to drop this hunk from the PR?

diff --git a/openbsd/OpenBSDMachine.c b/openbsd/OpenBSDMachine.c
index 0ff893b5..95ab52fb 100644
--- a/openbsd/OpenBSDMachine.c
+++ b/openbsd/OpenBSDMachine.c
@@ -141,18 +141,7 @@ static void OpenBSDMachine_scanMemoryInfo(OpenBSDMachine* this) {
    }
 
    super->totalMem = uvmexp.npages * this->pageSizeKB;
-   super->usedMem = (uvmexp.npages - uvmexp.free - uvmexp.paging) * this->pageSizeKB;
-
-   // Taken from OpenBSD systat/iostat.c, top/machine.c and uvm_sysctl(9)
-   const int bcache_mib[] = { CTL_VFS, VFS_GENERIC, VFS_BCACHESTAT };
-   struct bcachestats bcstats;
-   size_t size_bcstats = sizeof(bcstats);
-
-   if (sysctl(bcache_mib, 3, &bcstats, &size_bcstats, NULL, 0) < 0) {
-      CRT_fatalError("cannot get vfs.bcachestat");
-   }
-
-   super->cachedMem = bcstats.numbufpages * this->pageSizeKB;
+   super->usedMem = (uvmexp.npages - uvmexp.free) * this->pageSizeKB;
 
    /*
     * Copyright (c) 1994 Thorsten Lockert <tholo@sigmasoft.com>

No objection from me.

@BenBE BenBE merged commit 71021b2 into htop-dev:main Jan 9, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working build system 🔧 Affects the build system rather then the user experience OpenBSD 🐡 OpenBSD related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants