/// Create a task that is the leader of a new thread group.
///
/// This function creates an underlying Zircon process to host the new
/// task.
Create a task that is the leader of a new thread group.
This function creates an underlying Zircon process to host the new
task.
Create a task that is the leader of a new thread group . This function creates an underlying Zircon process to host the new task .
pub fn create_process(
        kernel: &Arc<Kernel>,
        comm: &CString,
        parent: pid_t,
        files: Arc<FdTable>,
        fs: Arc<FsContext>,
        signal_actions: Arc<SignalActions>,
        creds: Credentials,
        abstract_socket_namespace: Arc<AbstractSocketNamespace>,
        exit_signal: Option<Signal>,
    ) -> Result<CurrentTask, Errno> {
        let (process, root_vmar) = kernel
            .job
            .create_child_process(comm.as_bytes())
            .map_err(|status| from_status_like_fdio!(status))?;
        let thread = process
            .create_thread(comm.as_bytes())
            .map_err(|status| from_status_like_fdio!(status))?;
        // TODO: Stop giving MemoryManager a duplicate of the process handle once a process
        // handle is not needed to implement read_memory or write_memory.
        let duplicate_process =
            process.duplicate_handle(zx::Rights::SAME_RIGHTS).map_err(impossible_error)?;
        let mut pids = kernel.pids.write();
        let id = pids.allocate_pid();
        let task = Self::new(
            id,
            comm.clone(),
            None,
            Arc::new(ThreadGroup::new(kernel.clone(), process, id)),
            parent,
            thread,
            files,
            Arc::new(
                MemoryManager::new(duplicate_process, root_vmar)
                    .map_err(|status| from_status_like_fdio!(status))?,
            ),
            fs,
            signal_actions,
            creds,
            abstract_socket_namespace,
            ShellJobControl::new(id),
            exit_signal,
        );
        pids.add_task(&task.task);
        pids.add_thread_group(&task.task.thread_group);
        Ok(task)
    }
pub fn create_process ( kernel : & Arc < Kernel > , comm : & CString , parent : pid_t , files : Arc < FdTable > , fs : Arc < FsContext > , signal_actions : Arc < SignalActions > , creds : Credentials , abstract_socket_namespace : Arc < AbstractSocketNamespace > , exit_signal : Option < Signal > , ) -> Result < CurrentTask , Errno > { let ( process , root_vmar ) = kernel . job . create_child_process ( comm . as_bytes ( ) ) . map_err ( | status | from_status_like_fdio ! ( status ) ) ? ; let thread = process . create_thread ( comm . as_bytes ( ) ) . map_err ( | status | from_status_like_fdio ! ( status ) ) ? ; // TODO: Stop giving MemoryManager a duplicate of the process handle once a process // handle is not needed to implement read_memory or write_memory. let duplicate_process = process . duplicate_handle ( zx :: Rights :: SAME_RIGHTS ) . map_err ( impossible_error ) ? ; let mut pids = kernel . pids . write ( ) ; let id = pids . allocate_pid ( ) ; let task = Self :: new ( id , comm . clone ( ) , None , Arc :: new ( ThreadGroup :: new ( kernel . clone ( ) , process , id ) ) , parent , thread , files , Arc :: new ( MemoryManager :: new ( duplicate_process , root_vmar ) . map_err ( | status | from_status_like_fdio ! ( status ) ) ? , ) , fs , signal_actions , creds , abstract_socket_namespace , ShellJobControl :: new ( id ) , exit_signal , ) ; pids . add_task ( & task . task ) ; pids . add_thread_group ( & task . task . thread_group ) ; Ok ( task ) }
Create a task that is the leader of a new thread group.
Create a task that is the leader of a new thread group .
kernel
&Arc<Kernel>
comm
&CString
parent
pid_t
files
Arc<FdTable>
fs
Arc<FsContext>
signal_actions
Arc<SignalActions>
creds
Credentials
abstract_socket_namespace
Arc<AbstractSocketNamespace>
exit_signal
Option<Signal>