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

posix, managarm: implement sigpending #947

Merged
merged 2 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions options/posix/generic/posix_signal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,15 @@ int sigwait(const sigset_t *__restrict set, int *__restrict sig) {
}
}

int sigpending(sigset_t *) {
__ensure(!"sigpending() not implemented");
__builtin_unreachable();
int sigpending(sigset_t *set) {
auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_sigpending, -1);

if(int e = sysdep(set)) {
errno = e;
return -1;
}

return 0;
}

int sigaltstack(const stack_t *__restrict ss, stack_t *__restrict oss) {
Expand Down
1 change: 1 addition & 0 deletions options/posix/include/mlibc/posix-sysdeps.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ int sys_vm_unmap(void *pointer, size_t size);
[[gnu::weak]] int sys_fchownat(int dirfd, const char *pathname, uid_t owner, gid_t group, int flags);
[[gnu::weak]] int sys_sigaltstack(const stack_t *ss, stack_t *oss);
[[gnu::weak]] int sys_sigsuspend(const sigset_t *set);
[[gnu::weak]] int sys_sigpending(sigset_t *set);
[[gnu::weak]] int sys_setgroups(size_t size, const gid_t *list);
[[gnu::weak]] int sys_statfs(const char *path, struct statfs *buf);
[[gnu::weak]] int sys_fstatfs(int fd, struct statfs *buf);
Expand Down
9 changes: 9 additions & 0 deletions sysdeps/managarm/generic/signals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,13 @@ int sys_sigsuspend(const sigset_t *set) {
return EINTR;
}

int sys_sigpending(sigset_t *set) {
uint64_t pendingMask;

HEL_CHECK(helSyscall0_1(kHelObserveSuperCall + posix::superSigGetPending, &pendingMask));
*set = pendingMask;

return 0;
}

} //namespace mlibc