Add support for the dup() syscall#1071
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #1071 +/- ##
==========================================
- Coverage 55.12% 54.95% -0.18%
==========================================
Files 128 128
Lines 19335 19341 +6
Branches 4612 4612
==========================================
- Hits 10659 10629 -30
- Misses 5918 5958 +40
+ Partials 2758 2754 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
| dup_helper(sys, args, fd) | ||
| } | ||
|
|
||
| pub fn dup_helper( |
There was a problem hiding this comment.
I missed this before, but I think we want to constrain the proliferation of the c:: autogen'd types as much as we can, right? That way as more code gets migrated to Rust, it can just call the "rusty" implementation methods with native rust types, dropping the c:: types altogether. I think that'll let us consolidate more of the unsafe blocks into conversion functions as well, which again can go away once we no longer need the corresponding c:: types.
e.g. here I think it'd be preferable to have the extern "C" wrappers convert to/from rust "native" types. I think we'd need to add a SysCallHandler wrapper type (e.g. somewhat like we have for Thread, though it can be a bit simpler since we don't have "subclasses" of SysCallHandler). Also SysCallReturn could be added to syscall_types.rs, and probably some more...
I'm ok with punting on it for this PR but we should decide whether that's a direction we prefer before implementing a lot more rust handlers.
There was a problem hiding this comment.
I definitely agree that some of the Rust syscall handler code should be reorganized, and there are a few other things I want to change as well. I didn't want to add too much code in that previous PR, but plan to improve this soon when I start working on more descriptor types.
Only works for the Rust descriptors, not the C descriptors.