10000 feat: add signal checking to waitpid_syscall by ChinmayShringi · Pull Request #228 · Lind-Project/lind-wasm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add signal checking to waitpid_syscall #228

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ChinmayShringi
Copy link
Contributor

Description

Fixes #118 (Blocking Calls for Signals) (waitpid)

This PR adds signal checking to the waitpid_syscall function to properly handle interruptions by signals. The changes ensure that waitpid returns EINTR when interrupted by signals, matching POSIX behavior. This is a critical fix for proper signal handling in the system.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

  • cargo build

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been added to a pull request and/or merged in other modules (native-client, lind-glibc, lind-project)

@ci-response-bot
Copy link

Commit 300bdeb: Build Success

@ci-response-bot
Copy link

Copy link
Contributor
@rennergade rennergade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment but looks good overall!

@ci-response-bot
Copy link

Commit d83aa7a: Build Success

Copy link
Contributor
@rennergade rennergade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me now.

@rennergade rennergade requested a review from Yaxuan-w May 21, 2025 23:20
@ci-response-bot
Copy link

Commit d83aa7a: Build Success

@ci-response-bot
Copy link

@ChinmayShringi ChinmayShringi requested a review from yzhang71 May 22, 2025 18:05
Copy link
Contributor
@yzhang71 yzhang71 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@lukpueh lukpueh closed this May 23, 2025
@lukpueh lukpueh reopened this May 23, 2025
@lukpueh
Copy link
Contributor
lukpueh commented May 23, 2025

Sorry for accidentally hitting the close button.

View Clippy Results

I just wanted to point out that clippy has a bunch of error messages now, which don't all seem related to this PR likely for the reasons described in #220.

@ci-response-bot
Copy link

Commit d83aa7a: Build Success

Copy link
Contributor
@qianxichen233 qianxichen233 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have some thoughts on whether to place the signal check at the beginning of the loop, or right after thread yield. Putting the signal check right after thread yield (i.e. after interface::lind_yield) makes more sense to me since it ensures that waitpid is only interruptible when it's actually about to wait. If we check for signals at the start of the loop, we could end up interrupting even when the child has already exited, which seems unnecessary. What do you think @rennergade

@rennergade
Copy link
Contributor

I would have some thoughts on whether to place the signal check at the beginning of the loop, or right after thread yield. Putting the signal check right after thread yield (i.e. after interface::lind_yield) makes more sense to me since it ensures that waitpid is only interruptible when it's actually about to wait. If we check for signals at the start of the loop, we could end up interrupting even when the child has already exited, which seems unnecessary. What do you think @rennergade

That makes sense to me as well.

Also from reviewing the manpage it seems like we should only return EINTR if WNOHANG isn't set.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blocking Calls for Signals
5 participants
0