-
-
Notifications
You must be signed in to change notification settings - Fork 134
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
Changes for managarm cancelable syscalls #884
Draft
Geertiebear
wants to merge
5
commits into
managarm:master
Choose a base branch
from
Geertiebear:cancelable_syscalls
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
50fb1f6
sysdeps/managarm: allow sys_read() cancellation
Geertiebear 11d2f5e
sysdeps/managarm: fix TIOCSPGRP argument passing
Geertiebear 2b242b0
sysdeps/managarm: allow _waitProgressFutex() to ignore cancellation
Geertiebear d6f6c07
sysdeps/managarm: make sys_read() cancelable
Geertiebear 1c76936
sysdeps/managarm: make sys_waitpid() cancelable
Geertiebear 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 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 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 |
---|---|---|
|
@@ -60,31 +60,42 @@ int sys_waitpid(pid_t pid, int *status, int flags, struct rusage *ru, pid_t *ret | |
return ENOSYS; | ||
} | ||
|
||
SignalGuard sguard; | ||
//SignalGuard sguard; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leftover I guess. |
||
|
||
HelHandle cancel_handle; | ||
HEL_CHECK(helCreateOneshotEvent(&cancel_handle)); | ||
helix::UniqueDescriptor cancel_event{cancel_handle}; | ||
|
||
managarm::posix::CntRequest<MemoryAllocator> req(getSysdepsAllocator()); | ||
req.set_request_type(managarm::posix::CntReqType::WAIT); | ||
req.set_pid(pid); | ||
req.set_flags(flags); | ||
|
||
auto [offer, send_head, recv_resp] = | ||
exchangeMsgsSync( | ||
auto [offer, send_head, push_descriptor, recv_resp] = | ||
exchangeMsgsSyncCancellable( | ||
getPosixLane(), | ||
cancel_handle, | ||
helix_ng::offer( | ||
helix_ng::sendBragiHeadOnly(req, getSysdepsAllocator()), | ||
helix_ng::pushDescriptor(cancel_event), | ||
helix_ng::recvInline() | ||
) | ||
); | ||
|
||
HEL_CHECK(offer.error()); | ||
HEL_CHECK(send_head.error()); | ||
HEL_CHECK(push_descriptor.error()); | ||
HEL_CHECK(recv_resp.error()); | ||
|
||
managarm::posix::SvrResponse<MemoryAllocator> resp(getSysdepsAllocator()); | ||
resp.ParseFromArray(recv_resp.data(), recv_resp.length()); | ||
if(resp.error() == managarm::posix::Errors::ILLEGAL_ARGUMENTS) { | ||
return EINVAL; | ||
} | ||
if (resp.error() == managarm::posix::Errors::INTERRUPTED) { | ||
mlibc::infoLogger() << "returning EINT" << frg::endlog; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we put this behind some debug flag? |
||
return EINTR; | ||
} | ||
__ensure(resp.error() == managarm::posix::Errors::SUCCESS); | ||
if(status) | ||
*status = resp.mode(); | ||
|
@@ -115,7 +126,10 @@ int sys_sleep(time_t *secs, long *nanos) { | |
globalQueue.getQueue(), 0, &async_id)); | ||
|
||
auto element = globalQueue.dequeueSingle(); | ||
auto result = parseSimple(element); | ||
if (!element) { | ||
return EINTR; | ||
} | ||
auto result = parseSimple(*element); | ||
HEL_CHECK(result->error); | ||
|
||
*secs = 0; | ||
|
This file contains 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 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 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
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.
Is this LSP? In any case, this should be replaced with
<>