feat(kernel): per-process budgets (pages, endpoints, notifs, regions) carved from creator, returned on death; init owns pool
This commit is contained in:
@@ -1,10 +1,19 @@
|
||||
use server_framework::Server;
|
||||
use types::bounded::CapSlot;
|
||||
use types::budget::Limits;
|
||||
|
||||
use crate::protocol::{AppId, SessionRequest, SessionResponse};
|
||||
|
||||
const MAX_APPS: usize = 16;
|
||||
|
||||
/// What each launched app may hold, out of the session server's budget.
|
||||
const APP_LIMITS: Limits = Limits {
|
||||
pages: 256,
|
||||
endpoints: 2,
|
||||
notifications: 2,
|
||||
regions: 2,
|
||||
};
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
pub struct AppEntry {
|
||||
pub name: &'static str,
|
||||
@@ -77,7 +86,10 @@ impl SessionServer {
|
||||
if self.running_mut(app).is_none_or(|r| r.is_some()) {
|
||||
return SessionResponse::Error;
|
||||
}
|
||||
let Some(process) = self.create_cap.and_then(libkos::syscall::create_process) else {
|
||||
let Some(process) = self
|
||||
.create_cap
|
||||
.and_then(|c| libkos::syscall::create_process(c, APP_LIMITS))
|
||||
else {
|
||||
return SessionResponse::Error;
|
||||
};
|
||||
if let Some(r) = self.running_mut(app) {
|
||||
|
||||
Reference in New Issue
Block a user