// Process // // These are the interfaces through which operations are performed on // processes. namespace Proc; interface Process { guid: "9C751874-EAB6-11D9-8399-000A95BB581A"; }; // This interface is implemented by the Process class. interface ThreadFactory { guid: "9FDA3678-EAB6-11D9-97D1-000A95BB581A"; // Create a new thread in this process. If pc is 0, then the new // thread begins execution immediately after the call to new_thread. // Otherwise, the new thread begins execution at the address passed in // pc. If stack is 0, then the new thread begins with the same stack // pointer as the caller. Otherwise, the new thread begins with the // stack pointer specified in stack. Various flags can be specified // by the NewThreadFlags bitmask; see the definition above for // details. // // Upon return to the caller, the newly created thread is placed in // thread. If pc is 0, the newly created thread will begin at the same // address that the creator thread returns to, returning NULL in thread. new_thread(ulong pc, ulong stack, ulong param, Thread thread out); // This method is identical to new_thread except that it is asynchronous, // and thus cannot return thread, and cannot take a value of 0 for // pc or stack. new_thread_async(ulong pc, ulong stack, ulong param) async; }; // This interface provides control of the binding between Processes // and AddrSpaces. It is implemented by the Process class. interface ProcAddrSpace { guid: "A3494EFC-EAB6-11D9-955B-000A95BB581A"; // Return the AddrSpace in which the process executes get_addr_space(Mem.AddrSpace addr_space out); // Attach the process to an AddrSpace. If the process is currently // attached to an AddrSpace, that address space is first detached. set_addr_space(Mem.AddrSpace addr_space); // This is a hack to implement Unix-like exec() efficiently. // It atomically sets the address space and jumps to the address // given. If the current thread is not in this process, an // InvalidState exception is thrown. set_addr_space_and_jump(Mem.AddrSpace addr_space, ulong pc); }; // This interface is implemented by the Process class. interface ProcTokens { guid: "A616D69E-EAB6-11D9-967E-000A95BB581A"; // Sets has_token to true if the process has currently has the // specified token, or false if it does not. has_token(ulong token, bool has_token out); // Grants the specified token to the process. Throws a restartable // TokenFault if the process does not have grant rights to the token. grant_token(ulong token); }; // This interface is implemented by the Process class. interface ProcTraps { using Traps.Trappable; guid: "A88F3742-EAB6-11D9-B772-000A95BB581A"; // Returns a reference to the Trappable object for this process. // Traps sent to this object will be sent to all threads in // the process. get_trappable(Trappable trappable out); // Returns a reference to the TrapDistributor object for // this process. Traps sent to the distributor object will // be sent to one arbitrary thread in the process, rather than // all threads which are not ignoring the trap. A trap will // only be sent to a thread that masks the trap if all threads // mask the trap; likewise, a trap will only be ignored if // all threads ignore it (or if the process itself does). get_trap_distributor(Trappable trap_distributor out); };