1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//! Declarative resource quotas evaluated at the single syscall trap (M2 资源配额).
//!
//! The syscall gate ([`crate::scheduler::state_machine::LoopStateMachine::gate_syscall`]) is the
//! one chokepoint where effectful requests (`Invoke`/`Spawn`/`WriteMemory`/…) are adjudicated.
//! Governance rules already gate tool *invocation*; this adds the OS notion of **resource
//! quotas** to the *same* gate — without a new ABI shape — so spawning and memory writes become
//! bounded resources rather than unconditional `Allow`s.
//!
//! The kernel stays pure: a quota is declarative config + the facts the kernel already tracks
//! (running child tasks in the `TaskTable`, write timestamps from the observed clock). No I/O.
use ;
/// F5 projection pair (registered in `crate::projection_pairs`, 0.2.66): the wire
/// version is the ABI authority; this is the richer internal semantic vocabulary. The
/// only legal crossing is the driver's exhaustive conversion.
/// Opt-in resource limits. An unset field imposes no limit; an unset `ResourceQuota` (the default,
/// when [`crate::scheduler::state_machine::LoopStateMachine::set_resource_quota`] is never called)
/// preserves the pre-M2 behavior of unconditional `Allow` for spawn / memory syscalls.