Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions kernel/src/arch_impl/aarch64/syscall_entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,8 @@ fn dispatch_syscall(
SyscallNumber::AudioInit => result_to_u64(crate::syscall::audio::sys_audio_init()),
SyscallNumber::AudioWrite => result_to_u64(crate::syscall::audio::sys_audio_write(arg1, arg2)),

// Display takeover
SyscallNumber::TakeOverDisplay => result_to_u64(crate::syscall::handlers::sys_take_over_display()),
// Testing/diagnostic syscalls
SyscallNumber::CowStats => sys_cow_stats_aarch64(arg1),
SyscallNumber::SimulateOom => sys_simulate_oom_aarch64(arg1),
Expand Down
40 changes: 39 additions & 1 deletion kernel/src/fs/procfs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ pub enum ProcEntryType {
BreenixDir,
/// /proc/breenix/testing - whether testing mode is active
BreenixTesting,
/// /proc/pids - list of all process IDs
Pids,
/// /proc/kmsg - kernel log messages
Kmsg,
/// /proc/[pid] - per-process directory (dynamic, not registered)
PidDir(u64),
/// /proc/[pid]/status - per-process status (dynamic, not registered)
Expand Down Expand Up @@ -107,6 +111,8 @@ impl ProcEntryType {
ProcEntryType::Mounts => "mounts",
ProcEntryType::BreenixDir => "breenix",
ProcEntryType::BreenixTesting => "testing",
ProcEntryType::Pids => "pids",
ProcEntryType::Kmsg => "kmsg",
ProcEntryType::PidDir(_) => "pid",
ProcEntryType::PidStatus(_) => "status",
}
Expand Down Expand Up @@ -134,6 +140,8 @@ impl ProcEntryType {
ProcEntryType::Mounts => "/proc/mounts",
ProcEntryType::BreenixDir => "/proc/breenix",
ProcEntryType::BreenixTesting => "/proc/breenix/testing",
ProcEntryType::Pids => "/proc/pids",
ProcEntryType::Kmsg => "/proc/kmsg",
// Dynamic entries don't have static paths
ProcEntryType::PidDir(_) => "/proc/<pid>",
ProcEntryType::PidStatus(_) => "/proc/<pid>/status",
Expand Down Expand Up @@ -163,6 +171,8 @@ impl ProcEntryType {
ProcEntryType::Mounts => 8,
ProcEntryType::BreenixDir => 200,
ProcEntryType::BreenixTesting => 201,
ProcEntryType::Pids => 9,
ProcEntryType::Kmsg => 10,
ProcEntryType::PidDir(pid) => 10000 + pid,
ProcEntryType::PidStatus(pid) => 20000 + pid,
}
Expand Down Expand Up @@ -232,6 +242,9 @@ pub fn init() {
procfs.entries.push(ProcEntry::new(ProcEntryType::BreenixDir));
procfs.entries.push(ProcEntry::new(ProcEntryType::BreenixTesting));

procfs.entries.push(ProcEntry::new(ProcEntryType::Pids));
procfs.entries.push(ProcEntry::new(ProcEntryType::Kmsg));

// Register /proc/trace directory and entries
procfs.entries.push(ProcEntry::new(ProcEntryType::TraceDir));
procfs.entries.push(ProcEntry::new(ProcEntryType::TraceEnable));
Expand Down Expand Up @@ -401,6 +414,8 @@ pub fn read_entry(entry_type: ProcEntryType) -> Result<String, i32> {
ProcEntryType::SlabInfo => Ok(generate_slabinfo()),
ProcEntryType::Stat => Ok(generate_stat()),
ProcEntryType::CowInfo => Ok(generate_cowinfo()),
ProcEntryType::Pids => Ok(generate_pids()),
ProcEntryType::Kmsg => Ok(generate_kmsg()),
ProcEntryType::Mounts => Ok(generate_mounts()),
ProcEntryType::BreenixDir => {
// Directory listing
Expand Down Expand Up @@ -732,6 +747,27 @@ fn generate_mounts() -> String {
out
}

/// Generate /proc/pids content (newline-separated PID list)
fn generate_pids() -> String {
use alloc::format;

let manager_guard = crate::process::manager();
let mut out = String::new();
if let Some(ref manager) = *manager_guard {
let mut pids = manager.all_pids();
pids.sort();
for pid in pids {
out.push_str(&format!("{}\n", pid.as_u64()));
}
}
out
}

/// Generate /proc/kmsg content (kernel log ring buffer)
fn generate_kmsg() -> String {
crate::log_buffer::read_all()
}

// =============================================================================
// Dynamic Per-PID Entries
// =============================================================================
Expand Down Expand Up @@ -878,7 +914,8 @@ fn generate_pid_status(pid: u64) -> String {
FdCount:\t{}\n\
VmCode:\t{} kB\n\
VmHeap:\t{} kB\n\
VmStack:\t{} kB\n",
VmStack:\t{} kB\n\
CpuTicks:\t{}\n",
process.name,
pid,
ppid,
Expand All @@ -888,5 +925,6 @@ fn generate_pid_status(pid: u64) -> String {
vm_code_kb,
vm_heap_kb,
vm_stack_kb,
process.cpu_ticks,
)
}
11 changes: 11 additions & 0 deletions kernel/src/graphics/render_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ pub fn drain_and_render() -> usize {
return 0;
}

// Skip rendering when userspace has taken over the display
if !crate::graphics::terminal_manager::is_display_active() {
// Still consume the data to prevent buffer backup
let head = QUEUE_HEAD.load(Ordering::Acquire);
let tail = QUEUE_TAIL.load(Ordering::Acquire);
if head != tail {
QUEUE_HEAD.store(tail, Ordering::Release);
}
return 0;
}

// Read current indices
let head = QUEUE_HEAD.load(Ordering::Acquire);
let tail = QUEUE_TAIL.load(Ordering::Acquire);
Expand Down
3 changes: 3 additions & 0 deletions kernel/src/graphics/render_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ fn render_thread_main_kthread() {
// Drain captured serial output to the Logs terminal
drain_log_capture();

// Refresh btop monitor view if flag is set and Monitor tab is active
crate::graphics::terminal_manager::refresh_btop_if_needed();

// Update mouse cursor position from tablet input device
#[cfg(target_arch = "aarch64")]
update_mouse_cursor();
Expand Down
Loading
Loading