⚠️ VeridianOS Kernel Documentation - This is low-level kernel code. All functions are unsafe unless explicitly marked otherwise. no_std

SessionManager

Struct SessionManager 

Source
pub struct SessionManager { /* private fields */ }
Expand description

Manages all active sessions.

Implementations§

Source§

impl SessionManager

Source

pub const fn new() -> Self

Create a new, empty session manager.

Source

pub fn create_session( &mut self, user_id: u64, username: &str, vt: u8, ) -> Result<SessionId, KernelError>

Create a new session for a user.

Assigns the next available virtual terminal starting at VT_BASE. Returns Err if the maximum number of sessions is reached.

Source

pub fn destroy_session(&mut self, id: SessionId)

Destroy a session and remove it from tracking.

Source

pub fn get_session(&self, id: SessionId) -> Option<&Session>

Get a reference to a session by ID.

Source

pub fn get_session_mut(&mut self, id: SessionId) -> Option<&mut Session>

Get a mutable reference to a session by ID.

Source

pub fn get_active_session(&self) -> Option<SessionId>

Return the currently active (foreground) session ID.

Source

pub fn switch_session(&mut self, id: SessionId)

Switch to a different session.

The previously active session is moved to Background; the new session becomes Active.

Source

pub fn lock_session(&mut self, id: SessionId)

Lock a session (requires re-authentication to resume).

Source

pub fn unlock_session(&mut self, id: SessionId)

Unlock a previously locked session, returning it to Active.

Source

pub fn add_process(&mut self, session_id: SessionId, pid: ProcessId)

Add a process to a session.

Source

pub fn remove_process(&mut self, session_id: SessionId, pid: ProcessId)

Remove a process from a session.

Source

pub fn get_session_for_vt(&self, vt: u8) -> Option<SessionId>

Find the session assigned to a given VT number.

Source

pub fn list_sessions(&self) -> Vec<SessionId>

Return a list of all session IDs.

Source

pub fn session_count(&self) -> usize

Number of active sessions.

Source

pub fn can_signal(&self, source_pid: u64, target_pid: u64) -> bool

Check whether a process in one session may signal a process in another.

Session isolation: cross-session signaling is denied unless the source process belongs to the same session as the target.

Source

pub fn begin_logout(&mut self, id: SessionId)

Begin logout for a session: set state to LoggingOut.

Source

pub fn get_session_processes(&self, id: SessionId) -> Vec<u64>

Get all process IDs belonging to a session (for cleanup on logout).

Trait Implementations§

Source§

impl Default for SessionManager

Available on crate feature alloc only.
Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for SessionManager

§

impl RefUnwindSafe for SessionManager

§

impl Send for SessionManager

§

impl Sync for SessionManager

§

impl Unpin for SessionManager

§

impl UnwindSafe for SessionManager

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.