Instead of handles / capabilities having numeric ids that are only valid for the owning process, they are now global in a system capabilities table. This will allow for specifying capabilities in IPC that doesn't need to be kernel-controlled. Processes will still need to be granted access to given capabilities, but that can become a simpler system call than the current method of sending them through mailbox messages (and worse, having to translate every one into a new capability like was the case before). In order to track which handles a process has access to, a new node_set based on node_map allows for an efficient storage and lookup of handles.
31 lines
791 B
Modula-2
31 lines
791 B
Modula-2
import "objects/object.def"
|
|
|
|
# Processes are a collection of handles and a virtual memory
|
|
# space inside which threads are run.
|
|
|
|
object process : object {
|
|
uid 0c69ee0b7502ba31
|
|
|
|
capabilities [
|
|
kill
|
|
create_thread
|
|
]
|
|
|
|
# Create a new empty process
|
|
method create [constructor]
|
|
|
|
# Stop all threads and exit the given process
|
|
method kill [destructor cap:kill]
|
|
|
|
# Stop all threads and exit the current process
|
|
method exit [static noreturn] {
|
|
param result int32 # The result to retrun to the parent process
|
|
}
|
|
|
|
# Give the given process a handle that points to the same
|
|
# object as the specified handle.
|
|
method give_handle {
|
|
param target ref object [handle] # A handle in the caller process to send
|
|
}
|
|
}
|