-
Notifications
You must be signed in to change notification settings - Fork 119
Re-enable Mach.Port #129
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
Merged
Re-enable Mach.Port #129
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
af4544c
Re-enable Mach.Port
glessard 2df5b0b
srdelta argument to mach_port_destruct should be zero
loffgren bf16d3d
[test] use `XCTAssertEqual` or `XCTAssertNotEqual`
glessard 9123120
destroy Send rights with `mach_port_deallocate`
glessard 669dcf2
ensure Mach.Port lives until the function returns
glessard 0539daa
fix test of receive-right deallocation
glessard 6ee96ff
modify consuming methods to call `discard self`
glessard e8bb779
use inout conversion
glessard 40b5b30
test all the `relinquish()` methods
glessard 5e03246
test copies of dead mach port names
glessard d259ef4
test two-parameter `withBorrowedName`
glessard e4d06ae
simplify deinit
glessard 6189c1f
fix `copySendRight()` for send rights that become dead names
glessard f5edd72
clarify some tests
glessard 65693b8
improve memory rebinding for `mach_port_get_attributes` call
glessard 8730f2c
[gardening] 80-column enforcement
glessard faffb9a
Apply suggestions from code review
glessard ad40724
make test expression return `Void`
glessard 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this does simplify the logic, it also means the kernel will no longer validate the right type on
deinit
. e.g. If you have aMach.Port<Mach.RecieveRight>
incorrectly wrapping a send right, the old code would fail this precondition (the mach call would returnKERN_INVALID_RIGHT
, whereas this new code would (silently, but not incorrectly) decrement the reference count of the send right.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good point. I went this way because it had ballooned to 6 branches; there is probably a reasonable alternative somewhere in the middle.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A note from an out-of-band conversation: the previously-used
mach_port_mod_refs()
calls do not succeed when_name
has become a dead name, because it is no longer a send right (or a send-once right.) It is unclear whether there's a reasonable and performant way to re-validate the type of_name
in the deinit.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we find a better solution for the
deinit
, we'll update it in another PR.