Files
moss-kernel/src/process/thread_group/umask.rs
Matthew Leach aaac9ffd2c sched: eliminate CUR_TASK_PTR
Replace `CUR_TASK_PTR` with `ProcessCtx`. This allows differentiation
between functions that access process context (take in `ProcessCtx` as a
parameter) and those that don't.

When creating a new class of scheduleable tasks (softirqs, kthreads),
this ensure that those functions cannot call context-sensitive
functions.
2026-03-19 20:58:15 +00:00

15 lines
363 B
Rust

use core::convert::Infallible;
use crate::sched::syscall_ctx::ProcessCtx;
pub fn sys_umask(ctx: &ProcessCtx, new_umask: u32) -> core::result::Result<usize, Infallible> {
let task = ctx.shared();
let mut umask_guard = task.process.umask.lock_save_irq();
let old_umask = *umask_guard;
*umask_guard = new_umask & 0o777;
Ok(old_umask as _)
}