push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
# Build settings based on the upstream Xcode project.
# See: https://github.com/apple-oss-distributions/top/blob/main/top.xcodeproj/project.pbxproj
# Project settings
project('top', 'c', version : '@version@')
# Dependencies
cc = meson.get_compiler('c')
libutil = cc.find_library('util', has_headers : 'libutil.h')
ncurses = [
dependency('ncurses'),
dependency('form'),
dependency('panel'),
]
sdk_frameworks = dependency('appleframeworks', modules : ['CoreFoundation', 'IOKit'])
# Libraries
libtop = static_library(
'top',
sources : [
'libtop.c',
],
)
install_headers(
'libtop.h',
)
# Binaries
top = executable(
'top',
dependencies : [libutil, ncurses, sdk_frameworks],
install : true,
link_with : libtop,
sources : [
'command.c',
'cpu.c',
'csw.c',
'faults.c',
'generic.c',
'globalstats.c',
'layout.c',
'log.c',
'logging.c',
'main.c',
'memstats.c',
'messages.c',
'options.c',
'pgrp.c',
'pid.c',
'ports.c',
'power.c',
'ppid.c',
'preferences.c',
'pstate.c',
'sig.c',
'statistic.c',
'syscalls.c',
'threads.c',
'timestat.c',
'top.c',
'uid.c',
'uinteger.c',
'user.c',
'userinput.c',
'userinput_help.c',
'userinput_mode.c',
'userinput_order.c',
'userinput_secondary_order.c',
'userinput_signal.c',
'userinput_sleep.c',
'userinput_user.c',
'workqueue.c',
],
)
install_man(
'top.1',
)

View File

@@ -0,0 +1,42 @@
{
apple-sdk,
libutil,
mkAppleDerivation,
ncurses,
pkg-config,
}:
let
xnu = apple-sdk.sourceRelease "xnu";
in
mkAppleDerivation {
releaseName = "top";
xcodeHash = "sha256-YeBhEstvPh8IX8ArVc7U8IRU6vqPoOE6kBTqcqZonGc=";
patches = [
# Upstream removed aarch64 support from the 137 source release, but the removal can be reverted.
# Otherwise, top will fail to run on aarch64-darwin.
# Based on https://github.com/apple-oss-distributions/top/commit/a989bd5d18246e330e5feadd80958b913351f8ae.diff
./patches/0001-Revert-change-that-dropped-aarch64-support.patch
];
postPatch = ''
# Fix duplicate symbol error. `tsamp` is unused in `main.c`.
substituteInPlace main.c \
--replace-fail 'const libtop_tsamp_t *tsamp;' ""
# Adding the whole sys folder causes header conflicts, so copy only the private headers that are needed.
mkdir sys
cp ${xnu}/bsd/sys/{kern_memorystatus.h,reason.h} sys/
'';
buildInputs = [
libutil
ncurses
];
nativeBuildInputs = [ pkg-config ];
meta.description = "Display information about processes";
}

View File

@@ -0,0 +1,68 @@
diff --git a/libtop.c b/libtop.c
index 5afeaf3f90..755a584073 100644
--- a/libtop.c
+++ b/libtop.c
@@ -703,11 +703,20 @@
mach_vm_address_t base = 0, size = 0;
switch (type) {
+ case CPU_TYPE_ARM64_32:
+ base = SHARED_REGION_BASE_ARM64_32;
+ size = SHARED_REGION_SIZE_ARM64_32;
+ break;
+
case CPU_TYPE_ARM:
base = SHARED_REGION_BASE_ARM;
size = SHARED_REGION_SIZE_ARM;
break;
+ case CPU_TYPE_ARM64:
+ base = SHARED_REGION_BASE_ARM64;
+ size = SHARED_REGION_SIZE_ARM64;
+ break;
case CPU_TYPE_X86_64:
base = SHARED_REGION_BASE_X86_64;
@@ -816,6 +825,8 @@
#if defined(__arm__)
libtop_p_fw_scan(mach_task_self(), SHARED_REGION_BASE_ARM, SHARED_REGION_SIZE_ARM);
+#elif defined(__arm64__) && !defined(__LP64__)
+ libtop_p_fw_scan(mach_task_self(), SHARED_REGION_BASE_ARM64_32, SHARED_REGION_SIZE_ARM64_32);
#elif defined(__arm64__)
libtop_p_fw_scan(mach_task_self(), SHARED_REGION_BASE_ARM64, SHARED_REGION_SIZE_ARM64);
#elif defined(__x86_64__) || defined(__i386__)
@@ -1329,6 +1340,14 @@
switch (type) {
case CPU_TYPE_ARM:
return SHARED_REGION_SIZE_ARM;
+#if defined(CPU_TYPE_ARM64)
+ case CPU_TYPE_ARM64:
+ return SHARED_REGION_SIZE_ARM64;
+#endif
+#if defined(CPU_TYPE_ARM64_32)
+ case CPU_TYPE_ARM64_32:
+ return SHARED_REGION_SIZE_ARM64_32;
+#endif
case CPU_TYPE_POWERPC:
return SHARED_REGION_SIZE_PPC;
case CPU_TYPE_POWERPC64:
diff --git a/pid.c b/pid.c
index 0d9a77460a..54d532d51b 100644
--- a/pid.c
+++ b/pid.c
@@ -54,8 +54,13 @@
proc_is_foreign = true;
#endif
break;
+#if defined(CPU_TYPE_ARM64)
+ case CPU_TYPE_ARM64:
+ proc_is_64 = true;
+ // FALLTHROUGH
+#endif
case CPU_TYPE_ARM:
-#if !defined(__arm__)
+#if !defined(__arm__) && !defined(__arm64__)
proc_is_foreign = true;
#endif
break;