mirror of
https://github.com/rcore-os/rCore-Tutorial-v3.git
synced 2024-11-24 10:26:25 +04:00
deploy: e7084e4a96
This commit is contained in:
parent
3e847a2ced
commit
a03f328057
@ -2,6 +2,6 @@
|
||||
<noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a class="sidebar-logo" href="../../../os/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div>
|
||||
</a><h2 class="location"><a href="#">Module process</a></h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li></ul></div><div id="sidebar-vars" data-name="process" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../os/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><div class="theme-picker hidden"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><form class="search-form"><div class="search-container"><div>
|
||||
<input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
|
||||
<h1 class="fqn"><span class="in-band">Module <a href="../../index.html">os</a>::<wbr><a href="../index.html">task</a>::<wbr><a class="mod" href="#">process</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../../src/os/task/process.rs.html#1-273" title="goto source code">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2>
|
||||
<h1 class="fqn"><span class="in-band">Module <a href="../../index.html">os</a>::<wbr><a href="../index.html">task</a>::<wbr><a class="mod" href="#">process</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../../src/os/task/process.rs.html#1-284" title="goto source code">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ProcessControlBlock.html" title="os::task::process::ProcessControlBlock struct">ProcessControlBlock</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.ProcessControlBlockInner.html" title="os::task::process::ProcessControlBlockInner struct">ProcessControlBlockInner</a></div><div class="item-right docblock-short"></div></div></div></section><section id="search" class="content hidden"></section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="os" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.60.0-nightly (9ad5d82f8 2022-01-18)" ></div>
|
||||
</body></html>
|
@ -5,9 +5,9 @@
|
||||
<h1 class="fqn"><span class="in-band">Struct <a href="../../index.html">os</a>::<wbr><a href="../index.html">task</a>::<wbr><a href="index.html">process</a>::<wbr><a class="struct" href="#">ProcessControlBlock</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../../src/os/task/process.rs.html#15-20" title="goto source code">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><div class="docblock item-decl"><pre class="rust struct"><code>pub struct ProcessControlBlock {
|
||||
pub pid: <a class="struct" href="../id/struct.PidHandle.html" title="struct os::task::id::PidHandle">PidHandle</a>,
|
||||
inner: <a class="struct" href="../../sync/up/struct.UPIntrFreeCell.html" title="struct os::sync::up::UPIntrFreeCell">UPIntrFreeCell</a><<a class="struct" href="struct.ProcessControlBlockInner.html" title="struct os::task::process::ProcessControlBlockInner">ProcessControlBlockInner</a>>,
|
||||
}</code></pre></div><h2 id="fields" class="fields small-section-header">Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.pid" class="structfield small-section-header"><a href="#structfield.pid" class="anchor field"></a><code>pid: <a class="struct" href="../id/struct.PidHandle.html" title="struct os::task::id::PidHandle">PidHandle</a></code></span><span id="structfield.inner" class="structfield small-section-header"><a href="#structfield.inner" class="anchor field"></a><code>inner: <a class="struct" href="../../sync/up/struct.UPIntrFreeCell.html" title="struct os::sync::up::UPIntrFreeCell">UPIntrFreeCell</a><<a class="struct" href="struct.ProcessControlBlockInner.html" title="struct os::task::process::ProcessControlBlockInner">ProcessControlBlockInner</a>></code></span><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#69-273" title="goto source code">source</a></div><a href="#impl" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div></summary><div class="impl-items"><div id="method.inner_exclusive_access" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#70-72" title="goto source code">source</a></div><a href="#method.inner_exclusive_access" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.inner_exclusive_access" class="fnname">inner_exclusive_access</a>(<br> &self<br>) -> <a class="struct" href="../../sync/up/struct.UPIntrRefMut.html" title="struct os::sync::up::UPIntrRefMut">UPIntrRefMut</a><'_, <a class="struct" href="struct.ProcessControlBlockInner.html" title="struct os::task::process::ProcessControlBlockInner">ProcessControlBlockInner</a>></h4></div><div id="method.new" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#74-143" title="goto source code">source</a></div><a href="#method.new" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>(elf_data: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.slice.html">]</a>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><Self></h4></div><details class="rustdoc-toggle method-toggle" open><summary><div id="method.exec" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#146-198" title="goto source code">source</a></div><a href="#method.exec" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.exec" class="fnname">exec</a>(self: &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><Self>, elf_data: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.slice.html">]</a>, args: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>)</h4></div></summary><div class="docblock"><p>Only support processes with a single thread.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fork" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#201-268" title="goto source code">source</a></div><a href="#method.fork" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.fork" class="fnname">fork</a>(self: &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><Self>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><Self></h4></div></summary><div class="docblock"><p>Only support processes with a single thread.</p>
|
||||
</div></details><div id="method.getpid" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#270-272" title="goto source code">source</a></div><a href="#method.getpid" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.getpid" class="fnname">getpid</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a></h4></div></div></details><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><div id="impl-RefUnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-RefUnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div><div id="impl-Send" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Send" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div><div id="impl-Sync" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Sync" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div><div id="impl-Unpin" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Unpin" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div><div id="impl-UnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-UnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Any" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132-136" title="goto source code">source</a></div><a href="#impl-Any" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.type_id" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#133" title="goto source code">source</a></div><a href="#method.type_id" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></div></summary><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
}</code></pre></div><h2 id="fields" class="fields small-section-header">Fields<a href="#fields" class="anchor"></a></h2><span id="structfield.pid" class="structfield small-section-header"><a href="#structfield.pid" class="anchor field"></a><code>pid: <a class="struct" href="../id/struct.PidHandle.html" title="struct os::task::id::PidHandle">PidHandle</a></code></span><span id="structfield.inner" class="structfield small-section-header"><a href="#structfield.inner" class="anchor field"></a><code>inner: <a class="struct" href="../../sync/up/struct.UPIntrFreeCell.html" title="struct os::sync::up::UPIntrFreeCell">UPIntrFreeCell</a><<a class="struct" href="struct.ProcessControlBlockInner.html" title="struct os::task::process::ProcessControlBlockInner">ProcessControlBlockInner</a>></code></span><h2 id="implementations" class="small-section-header">Implementations<a href="#implementations" class="anchor"></a></h2><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl" class="impl has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#69-284" title="goto source code">source</a></div><a href="#impl" class="anchor"></a><h3 class="code-header in-band">impl <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div></summary><div class="impl-items"><div id="method.inner_exclusive_access" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#70-72" title="goto source code">source</a></div><a href="#method.inner_exclusive_access" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.inner_exclusive_access" class="fnname">inner_exclusive_access</a>(<br> &self<br>) -> <a class="struct" href="../../sync/up/struct.UPIntrRefMut.html" title="struct os::sync::up::UPIntrRefMut">UPIntrRefMut</a><'_, <a class="struct" href="struct.ProcessControlBlockInner.html" title="struct os::task::process::ProcessControlBlockInner">ProcessControlBlockInner</a>></h4></div><div id="method.new" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#74-144" title="goto source code">source</a></div><a href="#method.new" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.new" class="fnname">new</a>(elf_data: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.slice.html">]</a>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><Self></h4></div><details class="rustdoc-toggle method-toggle" open><summary><div id="method.exec" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#147-199" title="goto source code">source</a></div><a href="#method.exec" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.exec" class="fnname">exec</a>(self: &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><Self>, elf_data: <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.slice.html">&[</a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.u8.html">u8</a><a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.slice.html">]</a>, args: <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a><<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>>)</h4></div></summary><div class="docblock"><p>Only support processes with a single thread.</p>
|
||||
</div></details><details class="rustdoc-toggle method-toggle" open><summary><div id="method.fork" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#202-279" title="goto source code">source</a></div><a href="#method.fork" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.fork" class="fnname">fork</a>(self: &<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><Self>) -> <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/sync/struct.Arc.html" title="struct alloc::sync::Arc">Arc</a><Self></h4></div></summary><div class="docblock"><p>Only support processes with a single thread.</p>
|
||||
</div></details><div id="method.getpid" class="method has-srclink"><div class="rightside"><a class="srclink" href="../../../src/os/task/process.rs.html#281-283" title="goto source code">source</a></div><a href="#method.getpid" class="anchor"></a><h4 class="code-header">pub fn <a href="#method.getpid" class="fnname">getpid</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.usize.html">usize</a></h4></div></div></details><h2 id="synthetic-implementations" class="small-section-header">Auto Trait Implementations<a href="#synthetic-implementations" class="anchor"></a></h2><div id="synthetic-implementations-list"><div id="impl-RefUnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-RefUnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.RefUnwindSafe.html" title="trait core::panic::unwind_safe::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div><div id="impl-Send" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Send" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div><div id="impl-Sync" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Sync" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div><div id="impl-Unpin" class="impl has-srclink"><div class="rightside"></div><a href="#impl-Unpin" class="anchor"></a><h3 class="code-header in-band">impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div><div id="impl-UnwindSafe" class="impl has-srclink"><div class="rightside"></div><a href="#impl-UnwindSafe" class="anchor"></a><h3 class="code-header in-band">impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/panic/unwind_safe/trait.UnwindSafe.html" title="trait core::panic::unwind_safe::UnwindSafe">UnwindSafe</a> for <a class="struct" href="struct.ProcessControlBlock.html" title="struct os::task::process::ProcessControlBlock">ProcessControlBlock</a></h3></div></div><h2 id="blanket-implementations" class="small-section-header">Blanket Implementations<a href="#blanket-implementations" class="anchor"></a></h2><div id="blanket-implementations-list"><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Any" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#132-136" title="goto source code">source</a></div><a href="#impl-Any" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br> T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.type_id" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/any.rs.html#133" title="goto source code">source</a></div><a href="#method.type_id" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id" class="fnname">type_id</a>(&self) -> <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></h4></div></summary><div class='docblock'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-Borrow%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#209-214" title="goto source code">source</a></div><a href="#impl-Borrow%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#211" title="goto source code">source</a></div><a href="#method.borrow" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow" class="fnname">borrow</a>(&self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&</a>T</h4></div></summary><div class='docblock'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-BorrowMut%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#218-222" title="goto source code">source</a></div><a href="#impl-BorrowMut%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a><T> for T <span class="where fmt-newline">where<br> T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, </span></h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.borrow_mut" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#219" title="goto source code">source</a></div><a href="#method.borrow_mut" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut" class="fnname">borrow_mut</a>(&mut self) -> <a class="primitive" href="https://doc.rust-lang.org/nightly/core/primitive.reference.html">&mut </a>T</h4></div></summary><div class='docblock'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
|
||||
</div></details></div></details><details class="rustdoc-toggle implementors-toggle" open><summary><div id="impl-From%3CT%3E" class="impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#549-553" title="goto source code">source</a></div><a href="#impl-From%3CT%3E" class="anchor"></a><h3 class="code-header in-band">impl<T> <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a><T> for T</h3></div></summary><div class="impl-items"><details class="rustdoc-toggle method-toggle" open><summary><div id="method.from" class="method trait-impl has-srclink"><div class="rightside"><a class="srclink" href="https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#550" title="goto source code">source</a></div><a href="#method.from" class="anchor"></a><h4 class="code-header">pub fn <a href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from" class="fnname">from</a>(t: T) -> T</h4></div></summary><div class='docblock'><p>Performs the conversion.</p>
|
||||
|
File diff suppressed because one or more lines are too long
@ -2,7 +2,7 @@
|
||||
<noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="alternate icon" type="image/png" href="../../../favicon-16x16.png"><link rel="alternate icon" type="image/png" href="../../../favicon-32x32.png"><link rel="icon" type="image/svg+xml" href="../../../favicon.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu" role="button">☰</div><a class="sidebar-logo" href="../../../os/index.html"><div class="logo-container"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></div>
|
||||
</a><h2 class="location"><a href="#">Module task</a></h2><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><div id="sidebar-vars" data-name="task" data-ty="mod" data-relpath="./"></div><script defer src="./sidebar-items.js"></script></div></nav><main><div class="width-limiter"><div class="sub-container"><a class="sub-logo-container" href="../../../os/index.html"><img class="rust-logo" src="../../../rust-logo.svg" alt="logo"></a><nav class="sub"><div class="theme-picker hidden"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu" title="themes"><img width="18" height="18" alt="Pick another theme!" src="../../../brush.svg"></button><div id="theme-choices" role="menu"></div></div><form class="search-form"><div class="search-container"><div>
|
||||
<input class="search-input" name="search" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><button type="button" id="help-button" title="help">?</button><a id="settings-menu" href="../../../settings.html" title="settings"><img width="18" height="18" alt="Change settings" src="../../../wheel.svg"></a></div></form></nav></div><section id="main-content" class="content"><div class="main-heading">
|
||||
<h1 class="fqn"><span class="in-band">Module <a href="../../index.html">os</a>::<wbr><a href="../index.html">task</a>::<wbr><a class="mod" href="#">task</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../../src/os/task/task.rs.html#1-79" title="goto source code">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2>
|
||||
<h1 class="fqn"><span class="in-band">Module <a href="../../index.html">os</a>::<wbr><a href="../index.html">task</a>::<wbr><a class="mod" href="#">task</a><button id="copy-path" onclick="copy_path(this)" title="Copy item path to clipboard"><img src="../../../clipboard.svg" width="19" height="18" alt="Copy item path"></button></span></h1><span class="out-of-band"><a class="srclink" href="../../../src/os/task/task.rs.html#1-80" title="goto source code">source</a> · <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span></div><h2 id="structs" class="small-section-header"><a href="#structs">Structs</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.TaskControlBlock.html" title="os::task::task::TaskControlBlock struct">TaskControlBlock</a></div><div class="item-right docblock-short"></div></div><div class="item-row"><div class="item-left module-item"><a class="struct" href="struct.TaskControlBlockInner.html" title="os::task::task::TaskControlBlockInner struct">TaskControlBlockInner</a></div><div class="item-right docblock-short"></div></div></div><h2 id="enums" class="small-section-header"><a href="#enums">Enums</a></h2>
|
||||
<div class="item-table"><div class="item-row"><div class="item-left module-item"><a class="enum" href="enum.TaskStatus.html" title="os::task::task::TaskStatus enum">TaskStatus</a></div><div class="item-right docblock-short"></div></div></div></section><section id="search" class="content hidden"></section></div></main><div id="rustdoc-vars" data-root-path="../../../" data-current-crate="os" data-themes="ayu,dark,light" data-resource-suffix="" data-rustdoc-version="1.60.0-nightly (9ad5d82f8 2022-01-18)" ></div>
|
||||
</body></html>
|
File diff suppressed because one or more lines are too long
@ -406,7 +406,7 @@
|
||||
<span class="kw">let</span> <span class="ident">process</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">process</span>.<span class="ident">upgrade</span>().<span class="ident">unwrap</span>();
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">process_inner</span> <span class="op">=</span> <span class="ident">process</span>.<span class="ident">inner_exclusive_access</span>();
|
||||
<span class="comment">// alloc user stack</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::id::TaskUserRes::alloc_user_res(): alloc user stack"</span>);
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::id::TaskUserRes::alloc_user_res(): alloc user stack for TCB"</span>);
|
||||
<span class="kw">let</span> <span class="ident">ustack_bottom</span> <span class="op">=</span> <span class="ident">ustack_bottom_from_tid</span>(<span class="self">self</span>.<span class="ident">ustack_base</span>, <span class="self">self</span>.<span class="ident">tid</span>);
|
||||
<span class="kw">let</span> <span class="ident">ustack_top</span> <span class="op">=</span> <span class="ident">ustack_bottom</span> <span class="op">+</span> <span class="ident">USER_STACK_SIZE</span>;
|
||||
<span class="ident">process_inner</span>.<span class="ident">memory_set</span>.<span class="ident">insert_framed_area</span>(
|
||||
@ -415,7 +415,7 @@
|
||||
<span class="ident">MapPermission::R</span> <span class="op">|</span> <span class="ident">MapPermission::W</span> <span class="op">|</span> <span class="ident">MapPermission::U</span>,
|
||||
);
|
||||
<span class="comment">// alloc trap_cx</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::id::TaskUserRes::alloc_user_res(): alloc trap_cx"</span>);
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::id::TaskUserRes::alloc_user_res(): alloc trap_cx for TCB"</span>);
|
||||
<span class="kw">let</span> <span class="ident">trap_cx_bottom</span> <span class="op">=</span> <span class="ident">trap_cx_bottom_from_tid</span>(<span class="self">self</span>.<span class="ident">tid</span>);
|
||||
<span class="kw">let</span> <span class="ident">trap_cx_top</span> <span class="op">=</span> <span class="ident">trap_cx_bottom</span> <span class="op">+</span> <span class="ident">PAGE_SIZE</span>;
|
||||
<span class="ident">process_inner</span>.<span class="ident">memory_set</span>.<span class="ident">insert_framed_area</span>(
|
||||
|
@ -274,6 +274,17 @@
|
||||
<span id="271">271</span>
|
||||
<span id="272">272</span>
|
||||
<span id="273">273</span>
|
||||
<span id="274">274</span>
|
||||
<span id="275">275</span>
|
||||
<span id="276">276</span>
|
||||
<span id="277">277</span>
|
||||
<span id="278">278</span>
|
||||
<span id="279">279</span>
|
||||
<span id="280">280</span>
|
||||
<span id="281">281</span>
|
||||
<span id="282">282</span>
|
||||
<span id="283">283</span>
|
||||
<span id="284">284</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident"><span class="kw">super</span>::id::RecycleAllocator</span>;
|
||||
<span class="kw">use</span> <span class="ident"><span class="kw">super</span>::manager::insert_into_pid2process</span>;
|
||||
<span class="kw">use</span> <span class="ident"><span class="kw">super</span>::TaskControlBlock</span>;
|
||||
@ -410,9 +421,10 @@
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">process_inner</span> <span class="op">=</span> <span class="ident">process</span>.<span class="ident">inner_exclusive_access</span>();
|
||||
<span class="ident">process_inner</span>.<span class="ident">tasks</span>.<span class="ident">push</span>(<span class="prelude-val">Some</span>(<span class="ident">Arc::clone</span>(<span class="kw-2">&</span><span class="ident">task</span>)));
|
||||
<span class="ident">drop</span>(<span class="ident">process_inner</span>);
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::new(): insert <pid, PCB> in PID2PCB BTreeMap"</span>);
|
||||
<span class="ident">insert_into_pid2process</span>(<span class="ident">process</span>.<span class="ident">getpid</span>(), <span class="ident">Arc::clone</span>(<span class="kw-2">&</span><span class="ident">process</span>));
|
||||
<span class="comment">// add main thread to scheduler</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::new(): add_task(task): add main thread to tscheduler"</span>);
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::new(): add_task(task): add main thread to scheduler"</span>);
|
||||
<span class="ident">add_task</span>(<span class="ident">task</span>);
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::new() end"</span>);
|
||||
<span class="ident">process</span>
|
||||
@ -479,10 +491,13 @@
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">parent</span> <span class="op">=</span> <span class="self">self</span>.<span class="ident">inner_exclusive_access</span>();
|
||||
<span class="macro">assert_eq!</span>(<span class="ident">parent</span>.<span class="ident">thread_count</span>(), <span class="number">1</span>);
|
||||
<span class="comment">// clone parent's memory_set completely including trampoline/ustacks/trap_cxs</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): clone parent's memory_set for child"</span>);
|
||||
<span class="kw">let</span> <span class="ident">memory_set</span> <span class="op">=</span> <span class="ident">MemorySet::from_existed_user</span>(<span class="kw-2">&</span><span class="ident">parent</span>.<span class="ident">memory_set</span>);
|
||||
<span class="comment">// alloc a pid</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): alloc a new pid for child"</span>);
|
||||
<span class="kw">let</span> <span class="ident">pid</span> <span class="op">=</span> <span class="ident">pid_alloc</span>();
|
||||
<span class="comment">// copy fd table</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): copy fd table for child"</span>);
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">new_fd_table</span>: <span class="ident">Vec</span><span class="op"><</span><span class="prelude-ty">Option</span><span class="op"><</span><span class="ident">Arc</span><span class="op"><</span><span class="kw">dyn</span> <span class="ident">File</span> <span class="op">+</span> <span class="ident">Send</span> <span class="op">+</span> <span class="ident">Sync</span><span class="op">></span><span class="op">></span><span class="op">></span> <span class="op">=</span> <span class="ident">Vec::new</span>();
|
||||
<span class="kw">for</span> <span class="ident">fd</span> <span class="kw">in</span> <span class="ident">parent</span>.<span class="ident">fd_table</span>.<span class="ident">iter</span>() {
|
||||
<span class="kw">if</span> <span class="kw">let</span> <span class="prelude-val">Some</span>(<span class="ident">file</span>) <span class="op">=</span> <span class="ident">fd</span> {
|
||||
@ -492,6 +507,7 @@
|
||||
}
|
||||
}
|
||||
<span class="comment">// create child process pcb</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): new child PCB with new pid, memory_set, fd_table, ..."</span>);
|
||||
<span class="kw">let</span> <span class="ident">child</span> <span class="op">=</span> <span class="ident">Arc::new</span>(<span class="self">Self</span> {
|
||||
<span class="ident">pid</span>,
|
||||
<span class="ident">inner</span>: <span class="kw">unsafe</span> {
|
||||
@ -512,8 +528,10 @@
|
||||
},
|
||||
});
|
||||
<span class="comment">// add child</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): add child link in parent' children Vec"</span>);
|
||||
<span class="ident">parent</span>.<span class="ident">children</span>.<span class="ident">push</span>(<span class="ident">Arc::clone</span>(<span class="kw-2">&</span><span class="ident">child</span>));
|
||||
<span class="comment">// create main thread of child process</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): TaskControlBlock::new(): create main thread of child process"</span>);
|
||||
<span class="kw">let</span> <span class="ident">task</span> <span class="op">=</span> <span class="ident">Arc::new</span>(<span class="ident">TaskControlBlock::new</span>(
|
||||
<span class="ident">Arc::clone</span>(<span class="kw-2">&</span><span class="ident">child</span>),
|
||||
<span class="ident">parent</span>
|
||||
@ -528,16 +546,20 @@
|
||||
<span class="bool-val">false</span>,
|
||||
));
|
||||
<span class="comment">// attach task to child process</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): attach child TCB to child PCB"</span>);
|
||||
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">child_inner</span> <span class="op">=</span> <span class="ident">child</span>.<span class="ident">inner_exclusive_access</span>();
|
||||
<span class="ident">child_inner</span>.<span class="ident">tasks</span>.<span class="ident">push</span>(<span class="prelude-val">Some</span>(<span class="ident">Arc::clone</span>(<span class="kw-2">&</span><span class="ident">task</span>)));
|
||||
<span class="ident">drop</span>(<span class="ident">child_inner</span>);
|
||||
<span class="comment">// modify kstack_top in trap_cx of this thread</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): modify child's kstack_top in trap_cx of child"</span>);
|
||||
<span class="kw">let</span> <span class="ident">task_inner</span> <span class="op">=</span> <span class="ident">task</span>.<span class="ident">inner_exclusive_access</span>();
|
||||
<span class="kw">let</span> <span class="ident">trap_cx</span> <span class="op">=</span> <span class="ident">task_inner</span>.<span class="ident">get_trap_cx</span>();
|
||||
<span class="ident">trap_cx</span>.<span class="ident">kernel_sp</span> <span class="op">=</span> <span class="ident">task</span>.<span class="ident">kstack</span>.<span class="ident">get_top</span>();
|
||||
<span class="ident">drop</span>(<span class="ident">task_inner</span>);
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): insert <child pid, child PCB> in PID2PCB BTreeMap"</span>);
|
||||
<span class="ident">insert_into_pid2process</span>(<span class="ident">child</span>.<span class="ident">getpid</span>(), <span class="ident">Arc::clone</span>(<span class="kw-2">&</span><span class="ident">child</span>));
|
||||
<span class="comment">// add this thread to scheduler</span>
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork(): add_task(child task): add child thread to scheduler"</span>);
|
||||
<span class="ident">add_task</span>(<span class="ident">task</span>);
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] task::process::fork() end"</span>);
|
||||
<span class="ident">child</span>
|
||||
|
@ -80,6 +80,7 @@
|
||||
<span id="77">77</span>
|
||||
<span id="78">78</span>
|
||||
<span id="79">79</span>
|
||||
<span id="80">80</span>
|
||||
</pre><pre class="rust"><code><span class="kw">use</span> <span class="ident"><span class="kw">super</span>::id::TaskUserRes</span>;
|
||||
<span class="kw">use</span> <span class="kw">super</span>::{<span class="ident">kstack_alloc</span>, <span class="ident">KernelStack</span>, <span class="ident">ProcessControlBlock</span>, <span class="ident">TaskContext</span>};
|
||||
<span class="kw">use</span> <span class="ident"><span class="kw">crate</span>::trap::TrapContext</span>;
|
||||
@ -134,6 +135,7 @@
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] TaskControlBlock::new() begin"</span>);
|
||||
<span class="kw">let</span> <span class="ident">res</span> <span class="op">=</span> <span class="ident">TaskUserRes::new</span>(<span class="ident">Arc::clone</span>(<span class="kw-2">&</span><span class="ident">process</span>), <span class="ident">ustack_base</span>, <span class="ident">alloc_user_res</span>);
|
||||
<span class="kw">let</span> <span class="ident">trap_cx_ppn</span> <span class="op">=</span> <span class="ident">res</span>.<span class="ident">trap_cx_ppn</span>();
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] TaskControlBlock::new(): alloc kernel stack for TCB"</span>);
|
||||
<span class="kw">let</span> <span class="ident">kstack</span> <span class="op">=</span> <span class="ident">kstack_alloc</span>();
|
||||
<span class="kw">let</span> <span class="ident">kstack_top</span> <span class="op">=</span> <span class="ident">kstack</span>.<span class="ident">get_top</span>();
|
||||
<span class="macro">kprintln!</span>(<span class="string">"[KERN] TaskControlBlock::new() end"</span>);
|
||||
|
Loading…
Reference in New Issue
Block a user