Skip to content

Convert some Process code to Rust#2651

Merged
sporksmith merged 19 commits intoshadow:mainfrom
sporksmith:process-code
Jan 13, 2023
Merged

Convert some Process code to Rust#2651
sporksmith merged 19 commits intoshadow:mainfrom
sporksmith:process-code

Conversation

@sporksmith
Copy link
Copy Markdown
Contributor

@sporksmith sporksmith commented Jan 9, 2023

Stopped at a fairly arbitrary point just to sync up.

@sporksmith sporksmith self-assigned this Jan 9, 2023
@github-actions github-actions bot added Component: Libraries Support functions like LD_PRELOAD and logging Component: Main Composing the core Shadow executable labels Jan 9, 2023
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 9, 2023

Codecov Report

Base: 67.90% // Head: 67.70% // Decreases project coverage by -0.20% ⚠️

Coverage data is based on head (5c57717) compared to base (74d01b7).
Patch coverage: 78.04% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2651      +/-   ##
==========================================
- Coverage   67.90%   67.70%   -0.21%     
==========================================
  Files         202      202              
  Lines       30112    30289     +177     
  Branches     5856     5906      +50     
==========================================
+ Hits        20449    20508      +59     
- Misses       5032     5126      +94     
- Partials     4631     4655      +24     
Flag Coverage Δ
tests 67.70% <78.04%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/host/process.rs 77.82% <77.11%> (-5.92%) ⬇️
src/main/core/worker.rs 82.64% <100.00%> (+0.09%) ⬆️
src/main/host/host.rs 80.64% <100.00%> (+2.63%) ⬆️
src/main/host/descriptor/eventfd.rs 8.08% <0.00%> (-31.32%) ⬇️
src/main/host/syscall/handler/eventfd.rs 0.00% <0.00%> (-30.56%) ⬇️
src/main/core/scheduler/pools/bounded.rs 74.50% <0.00%> (-1.97%) ⬇️
src/main/host/syscall/handler/socket.rs 68.00% <0.00%> (-0.85%) ⬇️
...c/main/utility/synchronization/count_down_latch.rs 85.10% <0.00%> (-0.54%) ⬇️
src/main/host/memory_manager/memory_mapper.rs 71.42% <0.00%> (-0.21%) ⬇️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@github-actions github-actions bot removed the Component: Libraries Support functions like LD_PRELOAD and logging label Jan 11, 2023
@sporksmith sporksmith changed the title Process code Convert some Process code to Rust Jan 11, 2023
@sporksmith sporksmith marked this pull request as ready for review January 11, 2023 20:39
I can't think of a reason we currently need it, and tests pass without
it. I think it *might* previously have been needed when working with
ptrace.
Was going to do all of it, but I'm pretty sure I'll need to wrap the
threads in `RootedRc<RootedRefCell<_>>` first, so stopping to do that
now.
The `RootedRc` lets us hold a reference to a thread without holding a
reference to the thread list.

`ThreadRef` currently has mutable methods, so we need to be able to get
a mutable reference, so we use `RootedRefCell`. We could end up dropping
this if we change `ThreadRef` to use internal mutability everywhere as
we do with Process and Host.
Next tricky bit is setting up the thread's shared memory block.
This is where it more-properly belongs, and unblocks moving more Process
code to Rust.
If there could be non-running threads in the thread table, the code
would fail in a somewhat confusing way. Simplify the code to more
explicitly depend on the assumption that there are none.
@sporksmith sporksmith enabled auto-merge January 13, 2023 16:58
@sporksmith sporksmith merged commit fc67710 into shadow:main Jan 13, 2023
@sporksmith sporksmith deleted the process-code branch January 13, 2023 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Main Composing the core Shadow executable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants