[][src]Struct sunrise_libuser::types::Process

#[repr(transparent)]pub struct Process(pub Handle);

A Process. Created with create_process syscall, or by calling Process::current().

Implementations

impl Process[src]

fn current() -> Process[src]

Gets the current process handle. Uses the 0xFFFF8001 meta-handle, which may not be valid in all contexts!

pub fn start(
    &self,
    main_thread_prio: u32,
    default_cpuid: u32,
    main_thread_stack_sz: u32
) -> Result<(), Error>
[src]

Start the given process on the provided CPU with the provided scheduler priority.

A stack of the given size will be allocated using the process' memory resource limit and memory pool.

The entrypoint is assumed to be the first address of the code_addr region provided in create_process. It takes two parameters: the first is the usermode exception handling context, and should always be NULL. The second is a handle to the main thread.

Errors

  • InvalidProcessorId
    • Attempted to start the process on a processor that doesn't exist on the current machine, or a processor that the process is not allowed to use.
  • InvalidThreadPriority
    • Attempted to use a priority above 0x3F, or a priority that the created process is not allowed to use.
  • MemoryFull
    • Provided stack size is bigger than available vmem space.

pub fn state(&self) -> Result<ProcessState, Error>[src]

Get the state the given process is currently in.

Shouldn't ever return an error, unless the user is doing weird things with handles.

pub fn wait_async(
    &self,
    queue: WorkQueue
) -> impl Future<Output = Result<(), Error>> + Unpin
[src]

Waits for the process to change state. Use Process::state to get the new state and Process::reset_signal to reset the signaled state.

Panics

Panics if used from outside the context of a Future spawned on a libuser future executor. Please make sure you only call this function from a future spawned on a WaitableManager.

pub fn reset_signal(&self) -> Result<(), Error>[src]

Clear the "signaled" state of a process. A process moves to the signaled state when it changes ProcessState (e.g. when exiting).

Note that once a Process enters the Exited state, it is permanently signaled and cannot be reset. Calling reset_signal will return an InvalidState error.

Errors

  • InvalidState
    • The event wasn't signaled.
    • The process was in Exited state.

pub fn pid(&self) -> Result<Pid, Error>[src]

Gets the Pid of this Process.

Will return an InvalidHandle error if called on Process::current().

Errors

  • InvalidHandle
    • Called in Process::current().

Trait Implementations

impl Debug for Process[src]

Auto Trait Implementations

impl RefUnwindSafe for Process

impl Send for Process

impl Sync for Process

impl Unpin for Process

impl UnwindSafe for Process

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SizedIPCBuffer for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.