fn finish_exec(&mut self, path: CString, resolved_elf: ResolvedElf) -> Result<(), Errno> {
        *self.argv.write() = resolved_elf.argv.clone();
        self.mm
            .exec(resolved_elf.file.name.clone())
            .map_err(|status| from_status_like_fdio!(status))?;
        let start_info = load_executable(self, resolved_elf, &path)?;
        self.registers = start_info.to_registers();
        self.dt_debug_address = start_info.dt_debug_address;

        self.signals.write().alt_stack = None;

        // TODO: All threads other than the calling thread are destroyed.

        // TODO: The file descriptor table is unshared, undoing the effect of
        //       the CLONE_FILES flag of clone(2).
        //
        // To make this work, we can put the files in an RwLock and then cache
        // a reference to the files on the CurrentTask. That will let
        // functions that have CurrentTask access the FdTable without
        // needing to grab the read-lock.
        //
        // For now, we do not implement that behavior.
        self.files.exec();

        // TODO: The dispositions of any signals that are being caught are
        //       reset to the default.

        // TODO: POSIX timers are not preserved.

        // TODO: The termination signal is reset to SIGCHLD.

        self.thread_group.set_name(&path)?;

        // Get the basename of the path, which will be used as the name displayed with
        // `prtcl(PR_GET_NAME)` and `/proc/self/stat`
        let basename = if let Some(idx) = memchr::memrchr(b'/', path.to_bytes()) {
            // SAFETY: Substring of a CString will contain no null bytes.
            CString::new(&path.to_bytes()[idx + 1..]).unwrap()
        } else {
            path
        };
        self.set_command_name(basename);
        Ok(())
    }
/// After the memory is unmapped, any failure in exec is unrecoverable and results in the
/// process crashing. This function is for that second half; any error returned from this
/// function will be considered unrecoverable.
After the memory is unmapped, any failure in exec is unrecoverable and results in the
process crashing. This function is for that second half; any error returned from this
function will be considered unrecoverable.
After the memory is unmapped any failure in exec is unrecoverable and results in the process crashing . This function is for that second half ; any error returned from this function will be considered unrecoverable .
fn finish_exec(&mut self, path: CString, resolved_elf: ResolvedElf) -> Result<(), Errno> {
        *self.argv.write() = resolved_elf.argv.clone();
        self.mm
            .exec(resolved_elf.file.name.clone())
            .map_err(|status| from_status_like_fdio!(status))?;
        let start_info = load_executable(self, resolved_elf, &path)?;
        self.registers = start_info.to_registers();
        self.dt_debug_address = start_info.dt_debug_address;
        self.signals.write().alt_stack = None;
        // TODO: All threads other than the calling thread are destroyed.
        // TODO: The file descriptor table is unshared, undoing the effect of
        //       the CLONE_FILES flag of clone(2).
        //
        // To make this work, we can put the files in an RwLock and then cache
        // a reference to the files on the CurrentTask. That will let
        // functions that have CurrentTask access the FdTable without
        // needing to grab the read-lock.
        //
        // For now, we do not implement that behavior.
        self.files.exec();
        // TODO: The dispositions of any signals that are being caught are
        //       reset to the default.
        // TODO: POSIX timers are not preserved.
        // TODO: The termination signal is reset to SIGCHLD.
        self.thread_group.set_name(&path)?;
        // Get the basename of the path, which will be used as the name displayed with
        // `prtcl(PR_GET_NAME)` and `/proc/self/stat`
        let basename = if let Some(idx) = memchr::memrchr(b'/', path.to_bytes()) {
            // SAFETY: Substring of a CString will contain no null bytes.
            CString::new(&path.to_bytes()[idx + 1..]).unwrap()
        } else {
            path
        };
        self.set_command_name(basename);
        Ok(())
    }
fn finish_exec ( & mut self , path : CString , resolved_elf : ResolvedElf ) -> Result < ( ) , Errno > { * self . argv . write ( ) = resolved_elf . argv . clone ( ) ; self . mm . exec ( resolved_elf . file . name . clone ( ) ) . map_err ( | status | from_status_like_fdio ! ( status ) ) ? ; let start_info = load_executable ( self , resolved_elf , & path ) ? ; self . registers = start_info . to_registers ( ) ; self . dt_debug_address = start_info . dt_debug_address ; self . signals . write ( ) . alt_stack = None ; // TODO: All threads other than the calling thread are destroyed. // TODO: The file descriptor table is unshared, undoing the effect of //       the CLONE_FILES flag of clone(2). // // To make this work, we can put the files in an RwLock and then cache // a reference to the files on the CurrentTask. That will let // functions that have CurrentTask access the FdTable without // needing to grab the read-lock. // // For now, we do not implement that behavior. self . files . exec ( ) ; // TODO: The dispositions of any signals that are being caught are //       reset to the default. // TODO: POSIX timers are not preserved. // TODO: The termination signal is reset to SIGCHLD. self . thread_group . set_name ( & path ) ? ; // Get the basename of the path, which will be used as the name displayed with // `prtcl(PR_GET_NAME)` and `/proc/self/stat` let basename = if let Some ( idx ) = memchr :: memrchr ( b'/' , path . to_bytes ( ) ) { // SAFETY: Substring of a CString will contain no null bytes. CString :: new ( & path . to_bytes ( ) [ idx + 1 .. ] ) . unwrap ( ) } else { path } ; self . set_command_name ( basename ) ; Ok ( ( ) ) }
After the memory is unmapped, any failure in exec is unrecoverable and results in the
process crashing.
After the memory is unmapped any failure in exec is unrecoverable and results in the process crashing .
&mut self
path
CString
resolved_elf
ResolvedElf
&mut self
path
CString
resolved_elf
ResolvedElf