Skip to content
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

sigwait() should not return when wrong signal becomes pending #1276

Open
wkozaczuk opened this issue Nov 4, 2023 · 0 comments
Open

sigwait() should not return when wrong signal becomes pending #1276

wkozaczuk opened this issue Nov 4, 2023 · 0 comments
Labels

Comments

@wkozaczuk
Copy link
Collaborator

The current implementation of sigwait():

int sigwait(const sigset_t *set, int *sig)
{
    sched::thread::wait_until([sig] { return *sig = thread_pending_signal; });
    thread_pending_signal = 0;
    return 0;
}

ignores the set argument and returns as soon as any signal is pending for this thread.

According to the Linux manual (https://man7.org/linux/man-pages/man3/sigwait.3.html):
"The sigwait() function suspends execution of the calling thread
until one of the signals specified in the signal set set becomes
pending. "

it should only return if the signal matches bit number set in set.

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

No branches or pull requests

1 participant