Skip to content

Remove C usage of getActiveHost, getActiveProcess, getActiveThread#1393

Merged
sporksmith merged 1 commit intoshadow:devfrom
sporksmith:no-get-active
Jun 2, 2021
Merged

Remove C usage of getActiveHost, getActiveProcess, getActiveThread#1393
sporksmith merged 1 commit intoshadow:devfrom
sporksmith:no-get-active

Conversation

@sporksmith
Copy link
Copy Markdown
Contributor

This is conceptually a follow-up to #1386, but doesn't actually depend
on it. Once both this and #1386 are in, we can remove getActiveHost,
getActiveProcess, and getActiveThread entirely. This is helpful for
porting to Rust since we don't have or want those to be globals there.

In C code it suffices to pass around the "deepest" current context
object, since they all have "up" pointers. e.g. given a Thread we can
get the corresponding Process and Host. We might eventually want to
replace these parameters with their Context counterparts in #1386, but
this seems like a useful intermediate step.

@codecov
Copy link
Copy Markdown

codecov bot commented Jun 1, 2021

Codecov Report

Merging #1393 (6f8781c) into dev (e27b608) will increase coverage by 0.01%.
The diff coverage is 83.18%.

❗ Current head 6f8781c differs from pull request most recent head 53bb744. Consider uploading reports for the commit 53bb744 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #1393      +/-   ##
==========================================
+ Coverage   54.33%   54.35%   +0.01%     
==========================================
  Files         136      138       +2     
  Lines       20465    20521      +56     
  Branches     5169     5176       +7     
==========================================
+ Hits        11120    11154      +34     
- Misses       6417     6435      +18     
- Partials     2928     2932       +4     
Flag Coverage Δ
tests 54.35% <83.18%> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
src/main/host/descriptor/channel.c 28.72% <0.00%> (ø)
src/main/host/syscall/uio.c 20.39% <0.00%> (-0.14%) ⬇️
src/main/utility/pcap_writer.c 0.00% <0.00%> (ø)
src/main/host/descriptor/file.c 33.92% <41.66%> (-0.15%) ⬇️
src/main/host/syscall/unistd.c 49.26% <42.85%> (-0.50%) ⬇️
src/main/core/work/event.c 66.66% <50.00%> (ø)
src/main/routing/packet.c 70.94% <63.63%> (-1.48%) ⬇️
src/main/host/process.c 68.17% <66.66%> (+0.15%) ⬆️
src/main/routing/payload.c 61.97% <75.00%> (+1.40%) ⬆️
src/main/host/descriptor/udp.c 65.00% <82.35%> (ø)
... and 34 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e27b608...53bb744. Read the comment docs.

@sporksmith sporksmith requested a review from stevenengler June 1, 2021 22:37
@sporksmith sporksmith self-assigned this Jun 1, 2021
@sporksmith sporksmith added Component: Main Composing the core Shadow executable Type: Maintenance Refactoring, cleanup, documenation, or process improvements labels Jun 1, 2021
This is conceptually a follow-up to shadow#1386, but doesn't actually depend
on it. Once both this and shadow#1386 are in, we can remove getActiveHost,
getActiveProcess, and getActiveThread entirely. This is helpful for
porting to Rust since we don't have or want those to be globals there.

In C code it suffices to pass around the "deepest" current context
object, since they all have "up" pointers. e.g. given a Thread we can
get the corresponding Process and Host. We might eventually want to
replace these parameters with their Context counterparts in shadow#1386, but
this seems like a useful intermediate step.
@sporksmith sporksmith enabled auto-merge June 2, 2021 18:46
@sporksmith sporksmith merged commit 637b309 into shadow:dev Jun 2, 2021
@sporksmith sporksmith deleted the no-get-active branch June 2, 2021 18: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 Type: Maintenance Refactoring, cleanup, documenation, or process improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants