-
Notifications
You must be signed in to change notification settings - Fork 5
Fix dup/dup2 + Fix fcntl + New fdtables API #117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d2afc0c
Fix dup/dup2 error handling and fix dup args
Yaxuan-w 86de3c4
Fix typo
Yaxuan-w 9737696
Add more comments
Yaxuan-w fa2814e
Fix dup/dup2
Yaxuan-w d3c1798
Add comments
Yaxuan-w 619a00a
Add comments and fix dispatcher
Yaxuan-w b483dcb
Merge branch 'fix-dup-reimpl' into fix-dup
Yaxuan-w b90cdc4
Fix fcntl
Yaxuan-w 80e96a8
Apply fdtables changes to all implementation + fcntl test case
Yaxuan-w e077989
Add fdtable test
Yaxuan-w 94740fa
Apply fmt
Yaxuan-w 21b4344
Add comments + Rename API
Yaxuan-w 57ce8e2
Correct errno
Yaxuan-w 4a9d1c1
Update comment
Yaxuan-w File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
Get a virtualfd mapping to put an item into the fdtable. | ||
|
||
This function requests an unused virtual FD starting from a specific position, as specified by the arg parameter. It behaves similarly to `get_unused_virtual_fd`, but starts the search at `arg` instead of `0`. | ||
|
||
This is intended for use with `fcntl()` commands like `F_DUPFD` and `F_DUPFD_CLOEXEC` | ||
|
||
# Panics | ||
if the cageid does not exist | ||
|
||
# Errors | ||
if the cage has used EMFILE virtual descriptors already, return EMFILE | ||
|
||
# Example | ||
``` | ||
# use fdtables::*; | ||
# let cage_id = threei::TESTING_CAGEID; | ||
# let underfd: u64 = 10; | ||
# let fdkind: u32 = 0; | ||
# let arg: u64 = 2; | ||
// Should not error... Ideally the `my_virt_fd` should be 2 in this case | ||
let my_virt_fd = get_unused_virtual_fd_from_startfd(cage_id, fdkind, underfd, false, 0, arg).unwrap(); | ||
// Check that you get the real fd back here... | ||
assert_eq!(underfd,translate_virtual_fd(cage_id, my_virt_fd).unwrap().underfd); | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.